Search in sources :

Example 21 with EditorNotificationPanel

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

the class JavaFxCouldBeEnabledNotificationProvider method createNotificationPanel.

@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull final FileEditor fileEditor) {
    if (file.getFileType() != MarkdownFileType.INSTANCE) {
        return null;
    }
    if (PropertiesComponent.getInstance().getBoolean(DONT_ASK_TO_CHANGE_PROVIDER_TYPE_KEY)) {
        return null;
    }
    final MarkdownApplicationSettings markdownApplicationSettings = MarkdownApplicationSettings.getInstance();
    final MarkdownPreviewSettings oldPreviewSettings = markdownApplicationSettings.getMarkdownPreviewSettings();
    if (oldPreviewSettings.getHtmlPanelProviderInfo().getClassName().equals(JavaFxHtmlPanelProvider.class.getName())) {
        return null;
    }
    final MarkdownHtmlPanelProvider.AvailabilityInfo availabilityInfo = new JavaFxHtmlPanelProvider().isAvailable();
    if (availabilityInfo == MarkdownHtmlPanelProvider.AvailabilityInfo.UNAVAILABLE) {
        return null;
    }
    final EditorNotificationPanel panel = new EditorNotificationPanel();
    panel.setText("JavaFX WebKit-based preview renderer is available.");
    panel.createActionLabel("Change preview browser to JavaFX", () -> {
        final boolean isSuccess = availabilityInfo.checkAvailability(panel);
        if (isSuccess) {
            markdownApplicationSettings.setMarkdownPreviewSettings(new MarkdownPreviewSettings(oldPreviewSettings.getSplitEditorLayout(), new JavaFxHtmlPanelProvider().getProviderInfo(), oldPreviewSettings.isUseGrayscaleRendering()));
            EditorNotifications.updateAll();
        } else {
            Logger.getInstance(JavaFxCouldBeEnabledNotificationProvider.class).warn("Could not install and apply OpenJFX");
        }
    });
    panel.createActionLabel("Do not show again", () -> {
        PropertiesComponent.getInstance().setValue(DONT_ASK_TO_CHANGE_PROVIDER_TYPE_KEY, true);
        EditorNotifications.updateAll();
    });
    return panel;
}
Also used : MarkdownApplicationSettings(org.intellij.plugins.markdown.settings.MarkdownApplicationSettings) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) MarkdownHtmlPanelProvider(org.intellij.plugins.markdown.ui.preview.MarkdownHtmlPanelProvider) MarkdownPreviewSettings(org.intellij.plugins.markdown.settings.MarkdownPreviewSettings) Nullable(org.jetbrains.annotations.Nullable)

Example 22 with EditorNotificationPanel

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

the class DartEditorNotificationsProvider method createNotificationToEnableDartSupport.

@NotNull
private EditorNotificationPanel createNotificationToEnableDartSupport(@NotNull final Module module) {
    final String message = DartSdkLibUtil.isIdeWithMultipleModuleSupport() ? DartBundle.message("dart.support.is.not.enabled.for.module.0", module.getName()) : DartBundle.message("dart.support.is.not.enabled.for.project");
    final EditorNotificationPanel panel = new EditorNotificationPanel().icon(DartIcons.Dart_16).text(message);
    panel.createActionLabel(DartBundle.message("enable.dart.support"), new EnableDartSupportForModule(module));
    panel.createActionLabel(DartBundle.message("open.dart.settings"), new OpenDartSettingsRunnable(myProject));
    return panel;
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) NotNull(org.jetbrains.annotations.NotNull)

Example 23 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project ballerina by ballerina-lang.

the class WrongSdkConfigurationNotificationProvider method createMissingSdkPanel.

@NotNull
private static EditorNotificationPanel createMissingSdkPanel(@NotNull Project project, @Nullable Module module) {
    EditorNotificationPanel panel = new EditorNotificationPanel();
    panel.setText(ProjectBundle.message("project.sdk.not.defined"));
    panel.createActionLabel(ProjectBundle.message("project.sdk.setup"), () -> BallerinaSdkService.getInstance(project).chooseAndSetSdk(module));
    return panel;
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) NotNull(org.jetbrains.annotations.NotNull)

Example 24 with EditorNotificationPanel

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

the class TemplateToolkitEditorNotificationsProvider method createNotificationPanel.

@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
    if (file.getFileType() == TemplateToolkitFileType.INSTANCE) {
        TemplateToolkitSettings settings = TemplateToolkitSettings.getInstance(myProject);
        if (!settings.isVirtualFileUnderRoot(file)) {
            EditorNotificationPanel panel = new EditorNotificationPanel();
            panel.setText(PerlBundle.message("tt2.error.file.not.in.root"));
            panel.createActionLabel("Configure", () -> Perl5SettingsConfigurable.open(myProject));
            return panel;
        }
    }
    return null;
}
Also used : TemplateToolkitSettings(com.perl5.lang.tt2.idea.settings.TemplateToolkitSettings) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) Nullable(org.jetbrains.annotations.Nullable)

Example 25 with EditorNotificationPanel

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

the class PerlAssociationEditorNotification method createNotificationPanel.

@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
    PerlLocalSettings perlLocalSettings = PerlLocalSettings.getInstance(myProject);
    if (perlLocalSettings.DISABLE_ASSOCIATIONS_CHECKING) {
        return null;
    }
    Optional<Map.Entry<FileNameMatcher, FileType>> matchedEntry = PERL_FILE_TYPES.entrySet().stream().filter(entry -> entry.getKey().accept(file.getName())).findFirst();
    if (matchedEntry == null || !matchedEntry.isPresent()) {
        return null;
    }
    FileType expectedType = matchedEntry.get().getValue();
    if (file.getFileType() == expectedType) {
        return null;
    }
    EditorNotificationPanel panel = new EditorNotificationPanel();
    panel.setText(PerlBundle.message("perl.notification.wrong.association", matchedEntry.get().getKey(), expectedType.getName(), file.getFileType().getName()));
    panel.createActionLabel(PerlBundle.message("perl.configure.plugins"), () -> ShowSettingsUtil.getInstance().showSettingsDialog(null, PluginManagerConfigurable.class));
    panel.createActionLabel(PerlBundle.message("perl.configure.associations"), () -> ShowSettingsUtil.getInstance().showSettingsDialog(null, FileTypeConfigurable.class));
    panel.createActionLabel(PerlBundle.message("perl.notification.disable.notification"), () -> {
        perlLocalSettings.DISABLE_ASSOCIATIONS_CHECKING = true;
        EditorNotifications.getInstance(myProject).updateAllNotifications();
    });
    return panel;
}
Also used : ShowSettingsUtil(com.intellij.openapi.options.ShowSettingsUtil) EditorNotifications(com.intellij.ui.EditorNotifications) PerlBundle(com.perl5.PerlBundle) VirtualFile(com.intellij.openapi.vfs.VirtualFile) Key(com.intellij.openapi.util.Key) FileType(com.intellij.openapi.fileTypes.FileType) PluginManagerConfigurable(com.intellij.ide.plugins.PluginManagerConfigurable) ContainerUtil(com.intellij.util.containers.ContainerUtil) FileEditor(com.intellij.openapi.fileEditor.FileEditor) Nullable(org.jetbrains.annotations.Nullable) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) List(java.util.List) FileNameMatcher(com.intellij.openapi.fileTypes.FileNameMatcher) FileTypeConfigurable(com.intellij.openapi.fileTypes.impl.FileTypeConfigurable) Map(java.util.Map) PerlLocalSettings(com.perl5.lang.perl.idea.configuration.settings.PerlLocalSettings) Project(com.intellij.openapi.project.Project) Optional(java.util.Optional) DumbAware(com.intellij.openapi.project.DumbAware) NotNull(org.jetbrains.annotations.NotNull) FileType(com.intellij.openapi.fileTypes.FileType) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) PerlLocalSettings(com.perl5.lang.perl.idea.configuration.settings.PerlLocalSettings) FileTypeConfigurable(com.intellij.openapi.fileTypes.impl.FileTypeConfigurable) PluginManagerConfigurable(com.intellij.ide.plugins.PluginManagerConfigurable) Nullable(org.jetbrains.annotations.Nullable)

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