Search in sources :

Example 1 with CheckStyleToolWindowPanel

use of org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel in project checkstyle-idea by jshiell.

the class ScrollToSource method isSelected.

@Override
public boolean isSelected(final AnActionEvent event) {
    final Project project = DataKeys.PROJECT.getData(event.getDataContext());
    if (project == null) {
        return false;
    }
    final CheckStylePlugin checkStylePlugin = project.getComponent(CheckStylePlugin.class);
    if (checkStylePlugin == null) {
        throw new IllegalStateException("Couldn't get checkstyle plugin");
    }
    final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
    final Content content = toolWindow.getContentManager().getContent(0);
    if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
        return ((CheckStyleToolWindowPanel) content.getComponent()).isScrollToSource();
    }
    return false;
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) CheckStyleToolWindowPanel(org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel) CheckStylePlugin(org.infernus.idea.checkstyle.CheckStylePlugin)

Example 2 with CheckStyleToolWindowPanel

use of org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel in project checkstyle-idea by jshiell.

the class BaseAction method setProgressText.

protected void setProgressText(final ToolWindow toolWindow, final String progressTextKey) {
    final Content content = toolWindow.getContentManager().getContent(0);
    if (content != null) {
        final JComponent component = content.getComponent();
        // the content instance will be a JLabel while the component initialises
        if (component instanceof CheckStyleToolWindowPanel) {
            final CheckStyleToolWindowPanel panel = (CheckStyleToolWindowPanel) component;
            panel.setProgressText(CheckStyleBundle.message(progressTextKey));
        }
    }
}
Also used : Content(com.intellij.ui.content.Content) CheckStyleToolWindowPanel(org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel)

Example 3 with CheckStyleToolWindowPanel

use of org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel in project checkstyle-idea by jshiell.

the class CollapseAll method actionPerformed.

@Override
public void actionPerformed(final AnActionEvent event) {
    final Project project = DataKeys.PROJECT.getData(event.getDataContext());
    if (project == null) {
        return;
    }
    final CheckStylePlugin checkStylePlugin = project.getComponent(CheckStylePlugin.class);
    if (checkStylePlugin == null) {
        throw new IllegalStateException("Couldn't get checkstyle plugin");
    }
    final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
    final Content content = toolWindow.getContentManager().getContent(0);
    if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
        ((CheckStyleToolWindowPanel) content.getComponent()).collapseTree();
    }
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) CheckStyleToolWindowPanel(org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel) CheckStylePlugin(org.infernus.idea.checkstyle.CheckStylePlugin)

Example 4 with CheckStyleToolWindowPanel

use of org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel in project checkstyle-idea by jshiell.

the class DisplayErrors method setSelected.

@Override
public void setSelected(final AnActionEvent event, final boolean selected) {
    final Project project = DataKeys.PROJECT.getData(event.getDataContext());
    if (project == null) {
        return;
    }
    final CheckStylePlugin checkStylePlugin = project.getComponent(CheckStylePlugin.class);
    if (checkStylePlugin == null) {
        throw new IllegalStateException("Couldn't get checkstyle plugin");
    }
    final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
    final Content content = toolWindow.getContentManager().getContent(0);
    if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
        final CheckStyleToolWindowPanel panel = (CheckStyleToolWindowPanel) content.getComponent();
        panel.setDisplayingErrors(selected);
        panel.filterDisplayedResults();
    }
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) CheckStyleToolWindowPanel(org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel) CheckStylePlugin(org.infernus.idea.checkstyle.CheckStylePlugin)

Example 5 with CheckStyleToolWindowPanel

use of org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel in project checkstyle-idea by jshiell.

the class DisplayInfo method isSelected.

@Override
public boolean isSelected(final AnActionEvent event) {
    final Project project = DataKeys.PROJECT.getData(event.getDataContext());
    if (project == null) {
        return false;
    }
    final CheckStylePlugin checkStylePlugin = project.getComponent(CheckStylePlugin.class);
    if (checkStylePlugin == null) {
        throw new IllegalStateException("Couldn't get checkstyle plugin");
    }
    final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(CheckStyleToolWindowPanel.ID_TOOLWINDOW);
    final Content content = toolWindow.getContentManager().getContent(0);
    if (content != null && content.getComponent() instanceof CheckStyleToolWindowPanel) {
        return ((CheckStyleToolWindowPanel) content.getComponent()).isDisplayingInfo();
    }
    return false;
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) CheckStyleToolWindowPanel(org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel) CheckStylePlugin(org.infernus.idea.checkstyle.CheckStylePlugin)

Aggregations

CheckStyleToolWindowPanel (org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel)12 Content (com.intellij.ui.content.Content)11 Project (com.intellij.openapi.project.Project)10 ToolWindow (com.intellij.openapi.wm.ToolWindow)10 CheckStylePlugin (org.infernus.idea.checkstyle.CheckStylePlugin)10