Search in sources :

Example 1 with StudyPluginConfigurator

use of org.stepik.core.StudyPluginConfigurator in project intellij-plugins by StepicOrg.

the class StudyToolWindow method getActionGroup.

@NotNull
private static DefaultActionGroup getActionGroup(@NotNull final Project project) {
    DefaultActionGroup group = new DefaultActionGroup();
    if (!StepikProjectManager.isStepikProject(project)) {
        logger.warn(project.getName() + " is not Stepik-project");
        return group;
    }
    StudyPluginConfigurator configurator = StudyUtils.getConfigurator(project);
    if (configurator != null) {
        group.addAll(configurator.getActionGroup(project));
        return group;
    } else {
        logger.warn("No configurator is provided for plugin");
        return StudyBasePluginConfigurator.getDefaultActionGroup();
    }
}
Also used : DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) StudyPluginConfigurator(org.stepik.core.StudyPluginConfigurator) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with StudyPluginConfigurator

use of org.stepik.core.StudyPluginConfigurator in project intellij-plugins by StepicOrg.

the class StudyToolWindow method init.

void init(@NotNull final Project project) {
    this.project = project;
    final DefaultActionGroup group = getActionGroup(project);
    setActionToolbar(group);
    final JPanel panel = new JPanel(new BorderLayout());
    JComponent stepInfoPanel = createStepInfoPanel(project);
    panel.add(stepInfoPanel, BorderLayout.CENTER);
    contentPanel.add(STEP_INFO_ID, panel);
    splitPane.setFirstComponent(contentPanel);
    addAdditionalPanels(project);
    cardLayout.show(contentPanel, STEP_INFO_ID);
    setContent(splitPane);
    StudyPluginConfigurator configurator = StudyUtils.getConfigurator(project);
    if (configurator != null) {
        final FileEditorManagerListener listener = configurator.getFileEditorManagerListener(project);
        project.getMessageBus().connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, listener);
    }
    StudyNode<?, ?> stepNode = StepikProjectManager.getSelected(project);
    setStepNode(stepNode);
}
Also used : DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) FileEditorManagerListener(com.intellij.openapi.fileEditor.FileEditorManagerListener) StudyPluginConfigurator(org.stepik.core.StudyPluginConfigurator)

Aggregations

DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)2 StudyPluginConfigurator (org.stepik.core.StudyPluginConfigurator)2 FileEditorManagerListener (com.intellij.openapi.fileEditor.FileEditorManagerListener)1 NotNull (org.jetbrains.annotations.NotNull)1