use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class JsonSchemaConflictNotificationProvider method createNotificationPanel.
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
final List<Pair<Boolean, String>> descriptors = myJsonSchemaService.getMatchingSchemaDescriptors(file);
if (descriptors == null || descriptors.size() <= 1)
return null;
final Worker worker = new Worker();
final String message = worker.createMessage(descriptors);
if (message == null)
return null;
final EditorNotificationPanel panel = new EditorNotificationPanel(LightColors.RED);
panel.setText(message);
panel.createActionLabel("Edit JSON Schema Mappings", () -> {
ShowSettingsUtil.getInstance().editConfigurable(myProject, new JsonSchemaMappingsConfigurable(myProject));
EditorNotifications.getInstance(myProject).updateNotifications(file);
});
return panel;
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class SrcFileAnnotator method showEditorWarningMessage.
private void showEditorWarningMessage(final String message) {
Editor textEditor = myEditor;
PsiFile file = myFile;
ApplicationManager.getApplication().invokeLater(() -> {
if (textEditor == null || textEditor.isDisposed() || file == null)
return;
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
final VirtualFile vFile = file.getVirtualFile();
assert vFile != null;
Map<FileEditor, EditorNotificationPanel> map = file.getCopyableUserData(NOTIFICATION_PANELS);
if (map == null) {
map = new HashMap<>();
file.putCopyableUserData(NOTIFICATION_PANELS, map);
}
final FileEditor[] editors = fileEditorManager.getAllEditors(vFile);
for (final FileEditor editor : editors) {
if (isCurrentEditor(editor)) {
final EditorNotificationPanel panel = new EditorNotificationPanel() {
{
myLabel.setIcon(AllIcons.General.ExclMark);
myLabel.setText(message);
}
};
panel.createActionLabel("Close", () -> fileEditorManager.removeTopComponent(editor, panel));
map.put(editor, panel);
fileEditorManager.addTopComponent(editor, panel);
break;
}
}
});
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class DiffNotifications method createNotification.
@NotNull
public static JPanel createNotification(@NotNull String text, @Nullable final Color background, boolean showHideAction) {
final EditorNotificationPanel panel = new EditorNotificationPanel(background);
panel.text(text);
if (showHideAction) {
HyperlinkLabel link = panel.createActionLabel("Hide", () -> panel.setVisible(false));
link.setToolTipText("Hide this notification");
}
return panel;
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class IdeFrameFixture method requireEditorNotification.
@NotNull
public EditorNotificationPanelFixture requireEditorNotification(@NotNull final String message) {
final Ref<EditorNotificationPanel> notificationPanelRef = new Ref<EditorNotificationPanel>();
pause(new Condition("Notification with message '" + message + "' shows up") {
@Override
public boolean test() {
EditorNotificationPanel notificationPanel = findNotificationPanel(message);
notificationPanelRef.set(notificationPanel);
return notificationPanel != null;
}
});
EditorNotificationPanel notificationPanel = notificationPanelRef.get();
assertNotNull(notificationPanel);
return new EditorNotificationPanelFixture(robot(), notificationPanel);
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class FileChangedNotificationProvider method createPanel.
private EditorNotificationPanel createPanel(@NotNull final VirtualFile file) {
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(IdeBundle.message("file.changed.externally.message"));
panel.createActionLabel(IdeBundle.message("file.changed.externally.reload"), () -> {
if (!myProject.isDisposed()) {
file.refresh(false, false);
EditorNotifications.getInstance(myProject).updateNotifications(file);
}
});
return panel;
}
Aggregations