mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
[code] action.update() sample
This commit is contained in:
parent
4e58d9a813
commit
debcb42f47
@ -1,7 +1,7 @@
|
||||
package org.jetbrains.tutorials.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
/**
|
||||
* @author Anna Bulenkova
|
||||
@ -11,4 +11,13 @@ public class SimpleAction extends AnAction {
|
||||
public void actionPerformed(AnActionEvent anActionEvent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent anActionEvent) {
|
||||
final Project project = anActionEvent.getData(CommonDataKeys.PROJECT);
|
||||
if (project != null)
|
||||
return;
|
||||
Object navigatable = anActionEvent.getData(CommonDataKeys.NAVIGATABLE);
|
||||
anActionEvent.getPresentation().setVisible(navigatable != null);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user