Skip to content

Commit

Permalink
Add index-based anchor command API in the ribbon
Browse files Browse the repository at this point in the history
For #495
  • Loading branch information
kirill-grouchnikov committed Nov 25, 2024
1 parent 8bdc6a2 commit 67645c0
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -641,19 +641,36 @@ public synchronized void addTask(RibbonTask task) {
* @param projection Command projection to add.
* @see #getAnchoredCommands()
* @see #removeAnchoredCommand(CommandButtonProjection)
* @see #addAnchoredCommand(CommandButtonProjection, int)
*/
public synchronized void addAnchoredCommand(CommandButtonProjection projection) {
this.anchoredCommands.add(projection);
this.fireStateChanged();
}

/**
* Adds the specified ribbon command projection at the specified index of the task toggle strip
* of this ribbon.
*
* @param projection Command projection to add.
* @param index Index of the projection
* @see #getAnchoredCommands()
* @see #removeAnchoredCommand(CommandButtonProjection)
* @see #addAnchoredCommand(CommandButtonProjection, int)
*/
public synchronized void addAnchoredCommand(CommandButtonProjection projection, int index) {
this.anchoredCommands.add(index, projection);
this.fireStateChanged();
}

/**
* Removes the specified ribbon command from the trailing edge of the task toggle strip of this
* ribbon.
*
* @param projection Command projection to remove.
* @see #getAnchoredCommands()
* @see #addAnchoredCommand(CommandButtonProjection)
* @see #addAnchoredCommand(CommandButtonProjection, int)
*/
public synchronized void removeAnchoredCommand(CommandButtonProjection projection) {
this.anchoredCommands.remove(projection);
Expand Down

0 comments on commit 67645c0

Please sign in to comment.