From ce889105ef0fde979d6afbbfed4fb47a2f1b3667 Mon Sep 17 00:00:00 2001 From: Felix Ding Date: Tue, 17 Sep 2024 11:11:04 -0700 Subject: [PATCH] Makes adjustment for various checkstyle items --- .../AbstractQToggleSuggestionsHandler.java | 20 ++++++++++++++++++- .../util/QInlineVerifyKeyListener.java | 1 - .../amazonq/util/QInvocationSession.java | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/plugin/src/software/aws/toolkits/eclipse/amazonq/handlers/AbstractQToggleSuggestionsHandler.java b/plugin/src/software/aws/toolkits/eclipse/amazonq/handlers/AbstractQToggleSuggestionsHandler.java index 6d8735bb..6b85577f 100644 --- a/plugin/src/software/aws/toolkits/eclipse/amazonq/handlers/AbstractQToggleSuggestionsHandler.java +++ b/plugin/src/software/aws/toolkits/eclipse/amazonq/handlers/AbstractQToggleSuggestionsHandler.java @@ -21,6 +21,22 @@ public final boolean isEnabled() { && qInvocationSessionInstance.isPreviewingSuggestions(); } + /** + * Executes the command when the user triggers the handler. + *

+ * Subclasses overriding this method should ensure that the following conditions are met: + *

+ * + * + * @param event The execution event that triggered the handler. + * @return The result of the execution, or null if there is no result. + * + * @implSpec + * Implementations should call {@code super.execute(event)} at the end to delegate the actual movement. + */ @Override public Object execute(final ExecutionEvent event) { QInvocationSession qInvocationSessionInstance = QInvocationSession.getInstance(); @@ -32,12 +48,14 @@ public Object execute(final ExecutionEvent event) { case BACKWARD: qInvocationSessionInstance.decrementCurrentSuggestionIndex(); break; + default: + qInvocationSessionInstance.incrementCurentSuggestionIndex(); } return null; } - protected void setCommandDirection(final Direction direction) { + protected final void setCommandDirection(final Direction direction) { this.direction = direction; } } diff --git a/plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInlineVerifyKeyListener.java b/plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInlineVerifyKeyListener.java index 72905ad5..5f5484e8 100644 --- a/plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInlineVerifyKeyListener.java +++ b/plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInlineVerifyKeyListener.java @@ -164,7 +164,6 @@ public void verifyKey(final VerifyEvent event) { break; } } - leadingWhitespaceSkipped += newWs; qInvocationSessionInstance.setLeadingWhitespaceSkipped(leadingWhitespaceSkipped); } diff --git a/plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInvocationSession.java b/plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInvocationSession.java index 8fa77264..9de065f3 100644 --- a/plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInvocationSession.java +++ b/plugin/src/software/aws/toolkits/eclipse/amazonq/util/QInvocationSession.java @@ -322,7 +322,7 @@ public void incrementCurentSuggestionIndex() { } } - public void setHasBeenTypedahead(boolean hasBeenTypedahead) { + public void setHasBeenTypedahead(final boolean hasBeenTypedahead) { this.hasBeenTypedahead = hasBeenTypedahead; }