forked from pharo-project/pharo
-
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.
- Loading branch information
Showing
16 changed files
with
246 additions
and
57 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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
" | ||
I show a compiler error as a popover (instead inserting an error string, which pollutes the text) | ||
" | ||
Class { | ||
#name : #SpCodePopoverErrorPresenter, | ||
#superclass : #SpPopoverContentPresenter, | ||
#instVars : [ | ||
'object', | ||
'code', | ||
'text', | ||
'message' | ||
], | ||
#category : #'Spec2-Code' | ||
} | ||
|
||
{ #category : #'instance creation' } | ||
SpCodePopoverErrorPresenter class >> newCode: aPresenter message: aString [ | ||
|
||
^ (self on: aString) | ||
code: aPresenter; | ||
yourself | ||
] | ||
|
||
{ #category : #accessing } | ||
SpCodePopoverErrorPresenter >> code [ | ||
|
||
^ code | ||
] | ||
|
||
{ #category : #accessing } | ||
SpCodePopoverErrorPresenter >> code: aPresenter [ | ||
|
||
code := aPresenter | ||
] | ||
|
||
{ #category : #'api-focus' } | ||
SpCodePopoverErrorPresenter >> defaultKeyboardFocus [ | ||
|
||
^ text | ||
] | ||
|
||
{ #category : #api } | ||
SpCodePopoverErrorPresenter >> dismiss [ | ||
|
||
super dismiss. | ||
self code takeKeyboardFocus | ||
] | ||
|
||
{ #category : #initialization } | ||
SpCodePopoverErrorPresenter >> initializePresenters [ | ||
|
||
self initializeText. | ||
|
||
layout := SpBoxLayout newHorizontal | ||
add: text; | ||
yourself. | ||
|
||
text eventHandler whenFocusLostDo: [ self dismiss ]. | ||
|
||
self flag: #TODO. "This is uber bad. Keybindings needs to come from application configuration" | ||
text | ||
bindKeyCombination: | ||
Character escape asKeyCombination | ||
| Character backspace asKeyCombination | ||
| Character cr asKeyCombination | ||
toAction: [ self dismiss ] | ||
] | ||
|
||
{ #category : #initialization } | ||
SpCodePopoverErrorPresenter >> initializeText [ | ||
|
||
text := self newText | ||
propagateNaturalWidth: true; | ||
propagateNaturalHeight: false; | ||
editable: false; | ||
text: self message; | ||
"addStyle: 'codePopover';" | ||
addStyle: 'codePopoverError'; | ||
yourself | ||
] | ||
|
||
{ #category : #accessing } | ||
SpCodePopoverErrorPresenter >> message [ | ||
|
||
^ message | ||
] | ||
|
||
{ #category : #accessing } | ||
SpCodePopoverErrorPresenter >> message: aString [ | ||
|
||
message := aString | ||
] | ||
|
||
{ #category : #'accessing model' } | ||
SpCodePopoverErrorPresenter >> setModelBeforeInitialization: aString [ | ||
|
||
message := aString | ||
] |
Oops, something went wrong.