[code + md] getting the active editor

This commit is contained in:
Anna Bulenkova 2014-12-09 17:26:30 +01:00
parent 3e9a8cadf8
commit 8ace7fde95

View File

@ -16,8 +16,10 @@ public class EditorIllustration extends AnAction {
}
@Override
public void update(AnActionEvent e) {
//Get required data keys
final Project project = e.getData(CommonDataKeys.PROJECT);
final Editor editor = e.getData(CommonDataKeys.EDITOR);
//Set visibility only in case of existing project and editor and if some text in the editor is selected
e.getPresentation().setVisible((project != null && editor != null && editor.getSelectionModel().hasSelection()));
}
}