Search in sources :

Example 1 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.

the class CCSubtaskEditorNotificationProvider method createNotificationPanel.

@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
    if (!CCUtils.isCourseCreator(myProject)) {
        return null;
    }
    boolean isTestFile = CCUtils.isTestsFile(myProject, file);
    if (!isTestFile && StudyUtils.getTaskFile(myProject, file) == null) {
        return null;
    }
    Task task = StudyUtils.getTaskForFile(myProject, file);
    if (task == null || !task.hasSubtasks()) {
        return null;
    }
    EditorNotificationPanel panel = new EditorNotificationPanel(EditorColors.GUTTER_BACKGROUND);
    String header = (isTestFile ? "test" : "task") + " file";
    int activeSubtaskIndex = task.getActiveSubtaskIndex() + 1;
    int subtaskSize = task.getLastSubtaskIndex() + 1;
    panel.setText("This is a " + header + " for " + EduNames.SUBTASK + " " + activeSubtaskIndex + "/" + subtaskSize);
    panel.createActionLabel(SWITCH_SUBTASK, () -> createPopup(task, myProject).show(RelativePoint.getSouthEastOf(panel)));
    return panel;
}
Also used : Task(com.jetbrains.edu.learning.courseFormat.Task) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) RelativePoint(com.intellij.ui.awt.RelativePoint) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.

the class JavaFxSdkSetupNotificationTest method testJavaFxAsLibrary.

public void testJavaFxAsLibrary() throws Exception {
    ModuleRootModificationUtil.updateModel(myModule, model -> AbstractJavaFXTestCase.addJavaFxJarAsLibrary(myModule, model));
    final EditorNotificationPanel panel = configureBySdkAndText(IdeaTestUtil.getMockJdk18(), false, "sample.fxml", SAMPLE_FXML);
    assertNull(panel);
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel)

Example 3 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.

the class JavaFxSdkSetupNotificationTest method testJavaFxInModuleSdk.

public void testJavaFxInModuleSdk() throws Exception {
    final EditorNotificationPanel panel = configureBySdkAndText(getTestJdk(), true, "sample.fxml", SAMPLE_FXML);
    assertNull(panel);
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel)

Example 4 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.

the class JavaFxSdkSetupNotificationTest method testJavaFxInProjectSdk.

public void testJavaFxInProjectSdk() throws Exception {
    final EditorNotificationPanel panel = configureBySdkAndText(getTestJdk(), false, "sample.fxml", SAMPLE_FXML);
    assertNull(panel);
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel)

Example 5 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.

the class JavaFxSdkSetupNotificationTest method testNoJavaFx.

public void testNoJavaFx() throws Exception {
    final EditorNotificationPanel panel = configureBySdkAndText(IdeaTestUtil.getMockJdk17(), false, "sample.fxml", SAMPLE_FXML);
    assertSdkSetupPanelShown(panel, "The JavaFX runtime is not configured");
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel)

Aggregations

EditorNotificationPanel (com.intellij.ui.EditorNotificationPanel)56 Nullable (org.jetbrains.annotations.Nullable)20 NotNull (org.jetbrains.annotations.NotNull)13 FileEditor (com.intellij.openapi.fileEditor.FileEditor)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 PsiFile (com.intellij.psi.PsiFile)7 Editor (com.intellij.openapi.editor.Editor)6 TextEditor (com.intellij.openapi.fileEditor.TextEditor)5 Project (com.intellij.openapi.project.Project)4 Module (com.intellij.openapi.module.Module)3 PluginManagerConfigurable (com.intellij.ide.plugins.PluginManagerConfigurable)2 Document (com.intellij.openapi.editor.Document)2 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)2 Sdk (com.intellij.openapi.projectRoots.Sdk)2 Ref (com.intellij.openapi.util.Ref)2 PerlLocalSettings (com.perl5.lang.perl.idea.configuration.settings.PerlLocalSettings)2 File (java.io.File)2 List (java.util.List)2 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 ModelWizardDialog (com.android.tools.idea.wizard.model.ModelWizardDialog)1