Skip to content

How to extend Algernon

Patrick R edited this page Jan 7, 2022 · 3 revisions

Create a new kind of result

  1. Create a subclass of ALGType to create a new category in your results and therefore also a new kind
  2. If needed, add a new icon for it into the ALGIconFactory (class side)

Create a new action

Actions are always defined for a specific ALGType.

  1. In your ALGType add a new createActionXXX method
  2. In this method specify the target as an argument and specify the constants shown below
  3. In your ALGType add your new action creation method to createListOfAlgeractions
ALGAction
	withName: 'ACTION_NAME' 
	rank: A_NUMBER "the higher the further at the top"
	target: TARGET_ARGUMENT
	selector: THE_SYMBOL_TO_CALL_ON_YOUR_TARGET
	args: ARRAY_OF_ARGUMENTS_FOR_THAT_SELECTOR_TO_CALL

Update Configuration

Execute the following two lines to update the run-time state:

ALGItemProvider initializeItems.
ALGInstallation someInstance cleanup.

Examples

ALGClassType

createActionExploreFor: aClass

	^ ALGAction
			withName: 'explore instances' 
			rank: 6
			target: aClass
			selector: #allInstancesDo:
			args: (OrderedCollection with: [ :instance | instance explore ])

ALGCategoryType

createActionBrowseNewFor: aCategory

	^ ALGAction
			withName: 'browse (new)' 
			rank: 5
			target: self
			selector: #openInNewBrowser: 
			args: (OrderedCollection with: aCategory)