AnActionEvent#getProject() - shorthand for getData(PlatformDataKeys.PROJECT).
[idea/community.git] / platform / platform-api / src / com / intellij / openapi / actionSystem / AnActionEvent.java
index f3a9c20bd77671347c6b78092998ef1bf21104b9..05e9217dc5c0127c780270ae51b2df362b431ff5 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.openapi.actionSystem;
 
+import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.text.StringUtil;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.Nullable;
@@ -72,6 +73,14 @@ public class AnActionEvent {
     return myInputEvent;
   }
 
+  /**
+   * @return Project from the context of this event.
+   */
+  @Nullable
+  public Project getProject() {
+    return getData(PlatformDataKeys.PROJECT);
+  }
+
   @NonNls
   public static String injectedId(String dataId) {
     synchronized(ourInjectedIds) {