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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations