Search in sources :

Example 26 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project Perl5-IDEA by Camelcade.

the class MasonPathsNotification method createNotificationPanel.

@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, @NotNull FileEditor fileEditor) {
    if (file.getFileType() instanceof MasonPurePerlComponentFileType) {
        String message = null;
        if (MasonSettings.getInstance(myProject).getComponentsRoots().isEmpty()) {
            message = "Mason2 components roots are not configured";
        } else {
            PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
            if (psiFile instanceof MasonFileImpl && ((MasonFileImpl) psiFile).getComponentRoot() == null) {
                message = "Component is not under one of configured roots";
            }
        }
        if (message != null) {
            EditorNotificationPanel panel = new EditorNotificationPanel();
            panel.setText(message);
            panel.createActionLabel("Configure", () -> Perl5SettingsConfigurable.open(myProject));
            return panel;
        }
    }
    return null;
}
Also used : MasonPurePerlComponentFileType(com.perl5.lang.mason2.filetypes.MasonPurePerlComponentFileType) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) MasonFileImpl(com.perl5.lang.mason2.psi.impl.MasonFileImpl) PsiFile(com.intellij.psi.PsiFile) Nullable(org.jetbrains.annotations.Nullable)

Example 27 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project Perl5-IDEA by Camelcade.

the class HTMLMasonPathsNotification method createNotificationPanel.

@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, @NotNull FileEditor fileEditor) {
    if (file.getFileType() == HTMLMasonFileType.INSTANCE) {
        String message = null;
        if (HTMLMasonSettings.getInstance(myProject).getComponentsRoots().isEmpty()) {
            message = "HTML::Mason components roots are not configured";
        } else {
            PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
            if (psiFile instanceof HTMLMasonFileImpl && ((HTMLMasonFileImpl) psiFile).getComponentRoot() == null) {
                message = "Component is not under one of configured roots";
            }
        }
        if (message != null) {
            EditorNotificationPanel panel = new EditorNotificationPanel();
            panel.setText(message);
            panel.createActionLabel("Configure", () -> Perl5SettingsConfigurable.open(myProject));
            return panel;
        }
    }
    return null;
}
Also used : HTMLMasonFileImpl(com.perl5.lang.htmlmason.parser.psi.impl.HTMLMasonFileImpl) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) PsiFile(com.intellij.psi.PsiFile) Nullable(org.jetbrains.annotations.Nullable)

Example 28 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project intellij by bazelbuild.

the class AdditionalLanguagesHelper method createNotificationPanel.

@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(VirtualFile file, FileEditor fileEditor) {
    String ext = file.getExtension();
    if (ext == null) {
        return null;
    }
    LanguageClass language = LanguageClass.fromExtension(ext);
    if (language == null || notifiedLanguages.contains(language)) {
        return null;
    }
    BlazeProjectData projectData = BlazeProjectDataManager.getInstance(project).getBlazeProjectData();
    if (projectData == null) {
        return null;
    }
    WorkspaceLanguageSettings settings = projectData.workspaceLanguageSettings;
    if (settings.isLanguageActive(language)) {
        return null;
    }
    if (!LanguageSupport.supportedLanguagesForWorkspaceType(settings.getWorkspaceType()).contains(language)) {
        return null;
    }
    String langName = language.getName();
    String message = String.format("Do you want to enable %s plugin %s support?", Blaze.buildSystemName(project), langName);
    EditorNotificationPanel panel = new EditorNotificationPanel();
    panel.setText(message);
    panel.createActionLabel(String.format("Enable %s support", langName), () -> {
        enableLanguageSupport(project, ImmutableList.of(language));
        suppressNotifications(language);
    });
    panel.createActionLabel("Don't show again", () -> suppressNotifications(language));
    return panel;
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData) WorkspaceLanguageSettings(com.google.idea.blaze.base.sync.projectview.WorkspaceLanguageSettings) LanguageClass(com.google.idea.blaze.base.model.primitives.LanguageClass) Nullable(javax.annotation.Nullable)

Example 29 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project flutter-intellij by flutter.

the class IncompatibleDartPluginNotificationProvider method createUpdateDartPanel.

@Nullable
private static EditorNotificationPanel createUpdateDartPanel(@NotNull Project project, @Nullable Module module, @NotNull String currentVersion, @NotNull String minimumVersion) {
    if (module == null)
        return null;
    final EditorNotificationPanel panel = new EditorNotificationPanel();
    panel.setText(FlutterBundle.message("flutter.incompatible.dart.plugin.warning", minimumVersion, currentVersion));
    panel.createActionLabel(FlutterBundle.message("dart.plugin.update.action.label"), () -> ShowSettingsUtil.getInstance().showSettingsDialog(project, PluginManagerConfigurable.class));
    return panel;
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) PluginManagerConfigurable(com.intellij.ide.plugins.PluginManagerConfigurable) Nullable(org.jetbrains.annotations.Nullable)

Example 30 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project flutter-intellij by flutter.

the class SdkConfigurationNotificationProvider method createOutOfDateFlutterSdkPanel.

private EditorNotificationPanel createOutOfDateFlutterSdkPanel(@NotNull FlutterSdk sdk) {
    final FlutterUIConfig settings = FlutterUIConfig.getInstance();
    if (settings.shouldIgnoreOutOfDateFlutterSdks())
        return null;
    final EditorNotificationPanel panel = new EditorNotificationPanel();
    panel.icon(FlutterIcons.Flutter);
    panel.setText(FlutterBundle.message("flutter.old.sdk.warning"));
    panel.createActionLabel("Dismiss", () -> {
        settings.setIgnoreOutOfDateFlutterSdks();
        panel.setVisible(false);
    });
    return panel;
}
Also used : FlutterUIConfig(io.flutter.settings.FlutterUIConfig) 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