use of org.intellij.plugins.markdown.settings.MarkdownApplicationSettings 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 org.intellij.plugins.markdown.settings.MarkdownApplicationSettings in project intellij-plugins by JetBrains.
the class JavaFxHtmlPanel method subscribeForGrayscaleSetting.
private void subscribeForGrayscaleSetting() {
MessageBusConnection settingsConnection = ApplicationManager.getApplication().getMessageBus().connect(this);
MarkdownApplicationSettings.SettingsChangedListener settingsChangedListener = new MarkdownApplicationSettings.SettingsChangedListener() {
@Override
public void onSettingsChange(@NotNull final MarkdownApplicationSettings settings) {
runInPlatformWhenAvailable(() -> {
if (myWebView != null) {
updateFontSmoothingType(myWebView, settings.getMarkdownPreviewSettings().isUseGrayscaleRendering());
}
});
}
};
settingsConnection.subscribe(MarkdownApplicationSettings.SettingsChangedListener.TOPIC, settingsChangedListener);
}
Aggregations