Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1712 self application inform inherits from object UI manager dependency #1730

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Iceberg-Plugin-GitHub/IceGitHubAction.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ IceGitHubAction >> credentials [
^ credentials ifNil: [ credentials := self obtainCredentials ]
]

{ #category : #private }
IceGitHubAction >> defaultApplication [

^ SpApplication defaultApplication
]

{ #category : #executing }
IceGitHubAction >> execute [
self withErrorHandlingDo: [
Expand Down Expand Up @@ -63,13 +69,13 @@ IceGitHubAction >> remote: anObject [

{ #category : #private }
IceGitHubAction >> reportError: error [

| message |
message := error messageBody.
message = 'Invalid field: head'
ifTrue: [ message := 'Branch does not exist on github. Please commit and push your changes.' ].
SpApplication defaultApplication newInform
message = 'Invalid field: head' ifTrue: [
message := 'Branch does not exist on github. Please commit and push your changes.' ].
self defaultApplication newInform
label: message;
title: 'Error creating pull request: ', error messageText;
title: 'Error creating pull request: ' , error messageText;
openModal
]
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,12 @@ IceGitHubNewBranchFromIssuePanel >> validateIssue: aString [
getIssue: remote owner
project: remote projectName
number: number.
self defaultApplication defer: [
self defer: [
self updateText: (self sanitizeTitle: (issue at: 'title')) ] ]
on: IceGitHubError
do: [ :e |
e messageText = 'Not Found' ifFalse: [ e pass ].
self defaultApplication defer: [
self defer: [
self updateText: self unknownTitle ] ] ]
]

Expand Down
27 changes: 14 additions & 13 deletions Iceberg-Plugin-GitHub/IceGitHubNewPullRequestAction.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,29 @@ IceGitHubNewPullRequestAction >> informPullRequestDone: pullRequest [

pullRequestDatas := pullRequest send.
url := pullRequestDatas at: 'html_url'.
UIManager default
inform: 'Pull request created. Click to view on Github.'
actionOnClick: [ WebBrowser openOn: url ]
self defaultApplication newInform
title: 'Pull request created. Click to view on Github.';
onAccept: [ WebBrowser openOn: url ];
openModal.
]
on: IceGitHubError
do: [ :e | self reportError: e ]
]

{ #category : #private }
IceGitHubNewPullRequestAction >> validateMakePullRequestOn: aRepository [

| status |

status := OrderedCollection new: 2.
aRepository isModified
ifTrue: [ status add: 'Uncommited changes' ].
(aRepository outgoingCommitsTo: remote)
ifNotEmpty: [ :commits | '{1} not published' format: { commits size } ].
aRepository isModified ifTrue: [ status add: 'Uncommited changes' ].
(aRepository outgoingCommitsTo: remote) ifNotEmpty: [ :commits |
'{1} not published' format: { commits size } ].
status ifEmpty: [ ^ true ].

^ SpApplication defaultApplication newConfirm
title: ('{1} has ongoing modifications.' format: { aRepository name.});
label: ('{2}

^ self defaultApplication newConfirm
title:
('{1} has ongoing modifications.' format: { aRepository name });
label: ('{2}
Do you want to continue anyway?' format: { status asCommaString });
openModal
openModal
]
37 changes: 20 additions & 17 deletions Iceberg-Plugin-GitHub/IceGitHubOpenOnGithubAction.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,30 @@ IceGitHubOpenOnGithubAction class >> organisation: aString projectName: anotherS

{ #category : #executing }
IceGitHubOpenOnGithubAction >> basicExecute [
[


[
| url |
url := (self github getRepository: self organisation project: self projectName) at: 'html_url'.

self class environment
at: #WebBrowser
ifPresent: [ :webBrowser | webBrowser openOn: url ]
ifAbsent: [
SpApplication defaultApplication
url := (self github
getRepository: self organisation
project: self projectName) at: 'html_url'.

self class environment
at: #WebBrowser
ifPresent: [ :webBrowser | webBrowser openOn: url ]
ifAbsent: [
self defaultApplication
title: ('Cannot open "{1}"' format: { url });
label: 'Because the project WebBrowser is not present by default in Pharo 6.';
openModal ]

]
label:
'Because the project WebBrowser is not present by default in Pharo 6.';
openModal ] ]
on: IceGitHubError
do: [
SpApplication defaultApplication
do: [
self defaultApplication
title: 'Invalid Github repository.';
label: ('No project named "{1}" found for the owner "{2}"'
format: { self projectName . self organisation});
label:
('No project named "{1}" found for the owner "{2}"' format: {
self projectName.
self organisation });
openModal ]
]

Expand Down
15 changes: 7 additions & 8 deletions Iceberg-Plugin-GitHub/IceGitHubRemoveBranchesAction.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,17 @@ IceGitHubRemoveBranchesAction >> remoteBranches [

{ #category : #actions }
IceGitHubRemoveBranchesAction >> removeBranch: json [

| branchName |

branchName := json at: 'name'.
IceGitHubAPI new
IceGitHubAPI new
credentials: self credentials;
deleteBranch: self remote owner
project: self remote projectBasename
name: branchName.
SpApplication defaultApplication
deleteBranch: self remote owner
project: self remote projectBasename
name: branchName.
self defaultApplication
title: ('Branch {1} removed.' format: { branchName });
openModal

openModal
]

{ #category : #actions }
Expand Down
4 changes: 2 additions & 2 deletions Iceberg-Plugin-GitHub/IceGitHubTipPullRequestBrowser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ IceGitHubTipPullRequestBrowser >> mergeButton [
{ #category : #actions }
IceGitHubTipPullRequestBrowser >> mergePullRequestIntoImage [

(UIManager default confirm:
('I will create a new local branch named {1}. Should I continue?'
(self confirm:
('I will create a new local branch named {1}. Should I continue?'
format: { self pullRequest branchName })) ifFalse: [ ^ self ].

IceGitHubAPI ensureCredentials.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,30 @@ IceGitHubViewPullRequestOnGithubAction class >> organisation: aString projectNam

{ #category : #executing }
IceGitHubViewPullRequestOnGithubAction >> basicExecute [
[


[
| url |
url := (self github getRepository: self organisation project: self projectName) at: 'html_url'.

self class environment
at: #WebBrowser
ifPresent: [ :webBrowser | webBrowser openOn: url ]
ifAbsent: [
SpApplication defaultApplication newInform
title: ('Cannot open "{1}"' format: { url });
label: 'Because the project WebBrowser is not present by default in Pharo 6.';
openModal ]

]
url := (self github
getRepository: self organisation
project: self projectName) at: 'html_url'.

self class environment
at: #WebBrowser
ifPresent: [ :webBrowser | webBrowser openOn: url ]
ifAbsent: [
self defaultApplication newInform
title: ('Cannot open "{1}"' format: { url });
label:
'Because the project WebBrowser is not present by default in Pharo 6.';
openModal ] ]
on: IceGitHubError
do: [
SpApplication defaultApplication newInform
do: [
SpApplication defaultApplication newInform
title: 'Invalid Github repository.';
label: ('No project named "{1}" found for the owner "{2}"'
format: { self projectName . self organisation});
label:
('No project named "{1}" found for the owner "{2}"' format: {
self projectName.
self organisation });
openModal ]
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ IceTipMetacelloInstallBaselineGroupCommand class >> defaultName [
IceTipMetacelloInstallBaselineGroupCommand >> execute [

| result |
result := UIManager default
request: 'Groups to install (a comma separated string)'
initialAnswer: ''
title: 'Enter groups to install'.
result ifNil: [ ^ self ].
self
result := self application newRequest
title: 'Enter groups to install';
label: 'Groups to install (a comma separated string)';
text: 'All'; openModal.
result ifNil: [ ^ self ].

self
installBaseline: self package
groups: ((result substrings: ',')
collect: #trimmed
as: Array)
groups:
((result substrings: ',')
collect: [ :each | each trimmed ]
as: Array)
]
9 changes: 6 additions & 3 deletions Iceberg-Tests/IceParameterizedTestCase.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,15 @@ IceParameterizedTestCase >> printOn: aStream [

{ #category : #running }
IceParameterizedTestCase >> setUp [

super setUp.
oldShareRepositoriesBetweenImages := IceLibgitRepository shareRepositoriesBetweenImages.
oldShareRepositoriesBetweenImages := IceLibgitRepository
shareRepositoriesBetweenImages.
IceLibgitRepository shareRepositoriesBetweenImages: false.
provider := IceCredentialsProvider providerType.
IceCredentialsProvider providerType: IceNonInteractiveCredentialsProvider.
self parameters do: #activate.
IceCredentialsProvider providerType:
IceNonInteractiveCredentialsProvider.
self parameters do: [ :each | each activate ]
]

{ #category : #running }
Expand Down
19 changes: 8 additions & 11 deletions Iceberg-TipUI/IceTipEditProjectDialog.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -332,21 +332,18 @@ IceTipEditProjectDialog >> onAccept: aBlockClosure [
IceTipEditProjectDialog >> removeDirectory [

| toRemove newSelection |

newSelection := selectedDirectoryPath parent.
toRemove := selectedDirectoryPath asResolvedBy: self model fileSystem.

toRemove exists
ifTrue: [
(UIManager default
questionWithoutCancel: ('Are you sure to delete ''{1}''?' format: {toRemove basename})
title: 'Remove directory')
ifFalse: [ ^ self].
toRemove ensureDelete ].

sourceDirectoryTree roots: { self model fileSystem }.
self expandAndSelect: newSelection.
toRemove exists ifTrue: [
(self application newConfirm
title: 'Remove directory';
label: ('Are you sure to delete ''{1}''?' format: { toRemove basename });
openModal) ifFalse: [ ^ self ].
toRemove ensureDelete ].

sourceDirectoryTree roots: { self model fileSystem }.
self expandAndSelect: newSelection
]

{ #category : #accessing }
Expand Down
10 changes: 6 additions & 4 deletions Iceberg-TipUI/IceTipFetchAllProjectCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ IceTipFetchAllProjectCommand >> iconName [
{ #category : #executing }
IceTipFetchAllProjectCommand >> isConfirmed [

^ UIManager default
confirm:
'This operation can take some times depending on the size and number of your repositories. Are you sure you want to fetch all repositories?'
label: 'Proceed?'
^ self application newConfirm
title: 'Proceed?';
label:
'This operation can take some times depending on the size and number of your repositories. Are you sure you want to fetch all repositories?';
openModal

]
Loading
Loading