-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use annotations for operation descriptions (#851)
* Autodiscover operations at startup. Use annotations for descriptions Re-enable CompatibilityTest. Fix some backwards compatbility issues. Not really a fan of injecting the Injector into the Operations class. Need to see if there's a better solution * Cleanup from review comments
- Loading branch information
1 parent
316458a
commit 978b4a9
Showing
87 changed files
with
811 additions
and
517 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package edu.wpi.grip.core; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import static edu.wpi.grip.core.OperationDescription.Category; | ||
import static edu.wpi.grip.core.OperationDescription.Category.MISCELLANEOUS; | ||
|
||
/** | ||
* Annotates an {@link Operation} subclass to describe it. This annotation gets transformed into a | ||
* {@link OperationDescription}. All operation classes with this annotation will be automatically | ||
* discovered and added to the palette at startup. | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface Description { | ||
|
||
/** | ||
* The name of the operation being described. | ||
*/ | ||
String name(); | ||
|
||
/** | ||
* A brief summary of the operation. In-depth descriptions, usage guides, and examples | ||
* should be on the wiki, not here. | ||
*/ | ||
String summary(); | ||
|
||
/** | ||
* The category the operation belongs to. Defaults to | ||
* {@link OperationDescription.Category#MISCELLANEOUS MISCELLANEOUS}. | ||
*/ | ||
Category category() default MISCELLANEOUS; | ||
|
||
/** | ||
* All known aliases of the operation. If the name of the operation changes, the previous name | ||
* should be here. Defaults to an empty array. | ||
*/ | ||
String[] aliases() default {}; | ||
|
||
/** | ||
* The name of the icon to use to display the operation. If empty ({@code ""}), no icon will be | ||
* shown. The icon should be located in {@code /edu/wpi/grip/ui/icons/}. | ||
*/ | ||
String iconName() default ""; | ||
|
||
} |
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
383 changes: 222 additions & 161 deletions
383
core/src/main/java/edu/wpi/grip/core/operations/Operations.java
Large diffs are not rendered by default.
Oops, something went wrong.
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
Oops, something went wrong.