From e80017689d1e08cf4e34d6f98ec95b82702c36df Mon Sep 17 00:00:00 2001 From: Anna Bulenkova Date: Tue, 20 Jan 2015 13:26:33 +0100 Subject: [PATCH] [md] "register actions" rewritten accordingly to review --- tutorials/action_system.md | 88 ++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 46 deletions(-) diff --git a/tutorials/action_system.md b/tutorials/action_system.md index ccc95795a..193599915 100644 --- a/tutorials/action_system.md +++ b/tutorials/action_system.md @@ -10,7 +10,8 @@ or be bound to UI element and could be invoked on demand. These UI elements incl **TODO - links to source** #Working with custom actions. -An action is technically a class, derived from the [AnAction] (https://github.com/JetBrains/intellij-community/blob/master/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java) class. +An action is technically a class, derived from the [AnAction] (https://github.com/JetBrains/intellij-community/blob/master/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java) +class. To update the state of the action, the method AnAction.update() is periodically called by IDEA. The object of type [AnActionEvent] (https://github.com/JetBrains/intellij-community/blob/ff16ce78a1e0ddb6e67fd1dbc6e6a597e20d483a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnActionEvent.java) passed to this method carries the information about the current context for the action, @@ -18,14 +19,14 @@ and in particular, the specific presentation which needs to be updated. ##Creating actions. To create a new we need to extend -[AnAction] () -class +[AnAction] (https://github.com/JetBrains/intellij-community/blob/master/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java) +class: public class SimpleAction extends AnAction { } The only method of an inheritor of -[AnAction] () +[AnAction] (https://github.com/JetBrains/intellij-community/blob/master/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java) which needs to be overridden is ```public void actionPerformed(AnActionEvent anActionEvent);``` , and it should contain a part of code to be executed after the action has been invoked. @@ -60,49 +61,44 @@ file will look like this: ------------- +Full list of action's attributes can also be set manually in +[plugin.xml]() +configuration file like the following code sample shows: -Under construction -TODO: rewrite accordingly to the guidelines/review - - - - - - - - - - - - - - - - - -[Link to source code] (https://github.com/JetBrains/intellij-sdk/blob/master/code_samples/plugin_sample/META-INF/plugin.xml) + + + + + + + + + + + + -----------