-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ability to show the inlay hint for logging #1239
Conversation
} | ||
|
||
fun handleClick(editor: Editor, element: PsiElement, loggerIdentifier: String) { | ||
val actionGroup = DefaultActionGroup().apply { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define new action group and action via xml
, later in the code get that action group via ActionManager.getInstance().getAction(..)
. See example - ccv2.toolbar.actions
.
Move logic responsible for availability of the action to the action itself, its presentation configuration set via update
method. Rely on dataContext
to pass required data to be used in the action itself.
p.s. it can stay as a first start, but it will produce too many unwanted instances of the Actions.
val title = "Logger - $resultMessage" | ||
Notifications.create( | ||
NotificationType.INFORMATION, title, | ||
"Set the log level: $logLevel for $logIdentifier. Server response: ${result.statusCode}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better wording may improve understanding, kinda: "Log level set to FATAL for server server alias."
) | ||
|
||
val resultMessage = if (result.statusCode == 200) "Success" else "Failed" | ||
val title = "Logger - $resultMessage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need in extra variable, feel free to inline it and change to actionable. some extras related to UI development can be found here https://plugins.jetbrains.com/docs/intellij/notification-types.html#what-notification-to-use.
.build(); | ||
} | ||
|
||
if (json.get("stacktraceText") != null && isNotEmpty(json.get("stacktraceText").toString())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stacktraceText
looks like a candidate for a new variable
@@ -295,4 +295,60 @@ public HybrisHttpResult executeSolrSearch(final Project project, @Nullable final | |||
return null; | |||
} | |||
} | |||
|
|||
public @NotNull |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use 1 line for public ... method(
} | ||
} | ||
|
||
class LoggerAction(private val logLevel: String, val logIdentifier: String, val icon: Icon) : AnAction(logLevel, "", icon) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this action to BGT
thread, see https://plugins.jetbrains.com/docs/intellij/basic-action-system.html#anactiongetactionupdatethread and https://plugins.jetbrains.com/docs/intellij/threading-model.html.
Inlay hint on a package level:
Inlay hint on a class level:
Inlay hint on a class with a super class
Inlay hint on a class with a nested class
Execute HTTP Call to SAP Commerce...