-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1143 from moosetechnology/critic-browser
Make query result tree an independant widget
- Loading branch information
Showing
16 changed files
with
440 additions
and
245 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
" | ||
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser | ||
" | ||
Class { | ||
#name : #ManifestMooseIDECore, | ||
#superclass : #PackageManifest, | ||
#category : #'MooseIDE-Core-Manifest' | ||
} |
192 changes: 192 additions & 0 deletions
192
src/MooseIDE-Core/MiMooseGroupsTreeTablePresenter.class.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,192 @@ | ||
" | ||
I am a presenter thas shows the result of the current selected query in a tree presenter. | ||
" | ||
Class { | ||
#name : #MiMooseGroupsTreeTablePresenter, | ||
#superclass : #SpTreeTablePresenter, | ||
#instVars : [ | ||
'sortedEntitiesCache', | ||
'headerTitle', | ||
'childrenSortingBlock', | ||
'extensionMenuItems', | ||
'manageNodesFromMenu' | ||
], | ||
#category : #'MooseIDE-Core-Widgets' | ||
} | ||
|
||
{ #category : #commands } | ||
MiMooseGroupsTreeTablePresenter class >> buildCommandsGroupWith: presenterInstance forRoot: aCmCommandsGroup [ | ||
|
||
aCmCommandsGroup register: | ||
(MiInspectCommand forSpecContext: presenterInstance) | ||
] | ||
|
||
{ #category : #menu } | ||
MiMooseGroupsTreeTablePresenter >> addExtensionMenugroupIn: aContextMenu [ | ||
|
||
extensionMenuItems ifEmpty: [ ^ self ]. | ||
|
||
aContextMenu addGroup: [ :group | | ||
extensionMenuItems do: [ :item | group addItem: item ] ] | ||
] | ||
|
||
{ #category : #api } | ||
MiMooseGroupsTreeTablePresenter >> addMenuItem: aBlockOrMenuItem [ | ||
|
||
extensionMenuItems add: aBlockOrMenuItem | ||
] | ||
|
||
{ #category : #menu } | ||
MiMooseGroupsTreeTablePresenter >> addNodesManagementMenuGroupIn: aContextMenu [ | ||
|
||
manageNodesFromMenu ifFalse: [ ^ self ]. | ||
|
||
aContextMenu addGroup: [ :group | | ||
group | ||
addItem: [ :item | | ||
item | ||
name: 'Collapse all'; | ||
icon: self theme treeUnexpandedForm; | ||
action: [ self collapseAll ] ]; | ||
addItem: [ :item | | ||
item | ||
name: 'Expand all'; | ||
icon: self theme treeExpandedForm; | ||
action: [ self expandAll ] ] ] | ||
] | ||
|
||
{ #category : #testing } | ||
MiMooseGroupsTreeTablePresenter >> canPropagate [ | ||
|
||
^ true | ||
] | ||
|
||
{ #category : #accessing } | ||
MiMooseGroupsTreeTablePresenter >> childrenSortingBlock [ | ||
|
||
^ childrenSortingBlock ifNil: [ #displayString ascending ] | ||
] | ||
|
||
{ #category : #accessing } | ||
MiMooseGroupsTreeTablePresenter >> childrenSortingBlock: aBlock [ | ||
|
||
childrenSortingBlock := aBlock | ||
] | ||
|
||
{ #category : #api } | ||
MiMooseGroupsTreeTablePresenter >> displayIcon: aValuable [ | ||
|
||
columns := columns copyWithFirst: (SpImageTableColumn new | ||
evaluated: aValuable; | ||
width: 35; | ||
yourself) | ||
] | ||
|
||
{ #category : #initialization } | ||
MiMooseGroupsTreeTablePresenter >> initialize [ | ||
|
||
super initialize. | ||
|
||
self addColumn: | ||
(SpStringTableColumn evaluated: [ :item | self stringForItem: item ]). | ||
|
||
self initializeChildrenBlock. | ||
self beMultipleSelection. | ||
self initializeContextMenu. | ||
self setDoubleClickInspect. | ||
self hideColumnHeaders. | ||
|
||
self whenRootsChangedDo: [ self resetEntitiesCache ]. | ||
|
||
manageNodesFromMenu := false | ||
] | ||
|
||
{ #category : #initialization } | ||
MiMooseGroupsTreeTablePresenter >> initializeChildrenBlock [ | ||
|
||
self children: [ :item | | ||
(self roots includes: item) | ||
ifTrue: [ | ||
sortedEntitiesCache | ||
at: item | ||
ifAbsentPut: [ item entities sort: self childrenSortingBlock ] ] | ||
ifFalse: [ { } ] ] | ||
] | ||
|
||
{ #category : #initialization } | ||
MiMooseGroupsTreeTablePresenter >> initializeContextMenu [ | ||
|
||
self contextMenu: [ | ||
| menu | | ||
menu := self rootCommandsGroup asMenuPresenter. | ||
self addNodesManagementMenuGroupIn: menu. | ||
self addExtensionMenugroupIn: menu. | ||
menu ]. | ||
|
||
extensionMenuItems := OrderedCollection new | ||
] | ||
|
||
{ #category : #menu } | ||
MiMooseGroupsTreeTablePresenter >> manageNodesFromMenu [ | ||
|
||
manageNodesFromMenu := true | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
MiMooseGroupsTreeTablePresenter >> miInspect [ | ||
|
||
self selectedItem miInspect | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
MiMooseGroupsTreeTablePresenter >> miPropagate [ | ||
|
||
self selectedItem miPropagate | ||
] | ||
|
||
{ #category : #accessing } | ||
MiMooseGroupsTreeTablePresenter >> miSelectedItem [ | ||
|
||
^ self selectedItem ifNil: [ { } ] | ||
] | ||
|
||
{ #category : #update } | ||
MiMooseGroupsTreeTablePresenter >> resetEntitiesCache [ | ||
|
||
^ sortedEntitiesCache := IdentityDictionary new | ||
] | ||
|
||
{ #category : #accessing } | ||
MiMooseGroupsTreeTablePresenter >> rootBrowser [ | ||
|
||
^ owner rootBrowser | ||
] | ||
|
||
{ #category : #initialization } | ||
MiMooseGroupsTreeTablePresenter >> setDoubleClickInspect [ | ||
|
||
self | ||
activateOnDoubleClick; | ||
whenActivatedDo: [ :each | each selectedItem miInspect ] | ||
] | ||
|
||
{ #category : #naming } | ||
MiMooseGroupsTreeTablePresenter >> stringForItem: item [ | ||
|
||
(self roots includes: item) ifTrue: [ ^ item description ]. | ||
|
||
^ item displayString | ||
] | ||
|
||
{ #category : #update } | ||
MiMooseGroupsTreeTablePresenter >> updateForEntities: entities [ | ||
|
||
| groups | | ||
groups := (entities allEntityTypes collect: [ :type | | ||
entities allWithType: type ]) asOrderedCollection. | ||
|
||
groups do: [ :group | group description: group details ]. | ||
|
||
self roots: | ||
(groups sort: [ :group | group description onlyLetters ] ascending) | ||
] |
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,13 @@ | ||
Extension { #name : #FamixCBViolation } | ||
|
||
{ #category : #'*MooseIDE-CriticBrowser' } | ||
FamixCBViolation >> mooseIcon [ | ||
|
||
^ self iconNamed: self violatedCondition severity iconName | ||
] | ||
|
||
{ #category : #'*MooseIDE-CriticBrowser' } | ||
FamixCBViolation >> severityLevel [ | ||
|
||
^ self violatedCondition severity level | ||
] |
23 changes: 23 additions & 0 deletions
23
src/MooseIDE-CriticBrowser/MiCBExportRulesCommand.class.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,23 @@ | ||
Class { | ||
#name : #MiCBExportRulesCommand, | ||
#superclass : #MiCommand, | ||
#category : #'MooseIDE-CriticBrowser-Commands' | ||
} | ||
|
||
{ #category : #default } | ||
MiCBExportRulesCommand class >> defaultIconName [ | ||
|
||
^ #smallSave | ||
] | ||
|
||
{ #category : #default } | ||
MiCBExportRulesCommand class >> defaultName [ | ||
|
||
^ 'Export rules' | ||
] | ||
|
||
{ #category : #executing } | ||
MiCBExportRulesCommand >> execute [ | ||
|
||
self context exportRules | ||
] |
23 changes: 23 additions & 0 deletions
23
src/MooseIDE-CriticBrowser/MiCBImportRulesCommand.class.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,23 @@ | ||
Class { | ||
#name : #MiCBImportRulesCommand, | ||
#superclass : #MiCommand, | ||
#category : #'MooseIDE-CriticBrowser-Commands' | ||
} | ||
|
||
{ #category : #default } | ||
MiCBImportRulesCommand class >> defaultIconName [ | ||
|
||
^ #smallOpen | ||
] | ||
|
||
{ #category : #default } | ||
MiCBImportRulesCommand class >> defaultName [ | ||
|
||
^ 'Import rules' | ||
] | ||
|
||
{ #category : #executing } | ||
MiCBImportRulesCommand >> execute [ | ||
|
||
self context importRules | ||
] |
23 changes: 23 additions & 0 deletions
23
src/MooseIDE-CriticBrowser/MiCBRunAllRulesCommand.class.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,23 @@ | ||
Class { | ||
#name : #MiCBRunAllRulesCommand, | ||
#superclass : #MiCommand, | ||
#category : #'MooseIDE-CriticBrowser-Commands' | ||
} | ||
|
||
{ #category : #default } | ||
MiCBRunAllRulesCommand class >> defaultIconName [ | ||
|
||
^ #glamorousPlay | ||
] | ||
|
||
{ #category : #default } | ||
MiCBRunAllRulesCommand class >> defaultName [ | ||
|
||
^ 'Run' | ||
] | ||
|
||
{ #category : #executing } | ||
MiCBRunAllRulesCommand >> execute [ | ||
|
||
self context runAllRules | ||
] |
Oops, something went wrong.