if (checkStylePlugin == null) {
throw new IllegalStateException("Couldn't get checkstyle plugin");
}
// check if tool window is registered
final ToolWindow toolWindow = ToolWindowManager.getInstance(
project).getToolWindow(CheckStyleConstants.ID_TOOLWINDOW);
if (toolWindow == null) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
// enable
presentation.setEnabled(toolWindow.isAvailable());
presentation.setVisible(true);
} catch (Throwable e) {
final CheckStylePluginException processed
= CheckStylePlugin.processError(null, e);