use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class GroovyStubNotificationProvider method decorateStubFile.
private static EditorNotificationPanel decorateStubFile(final VirtualFile file, final Project project) {
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText("This stub is generated for Groovy class to make Groovy-Java cross-compilation possible");
panel.createActionLabel("Go to the Groovy class", () -> DumbService.getInstance(project).withAlternativeResolveEnabled(() -> {
final PsiClass original = findClassByStub(project, file);
if (original != null) {
original.navigate(true);
}
}));
panel.createActionLabel("Exclude from stub generation", () -> DumbService.getInstance(project).withAlternativeResolveEnabled(() -> {
final PsiClass psiClass = findClassByStub(project, file);
if (psiClass != null) {
ExcludeFromStubGenerationAction.doExcludeFromStubGeneration(psiClass.getContainingFile());
}
}));
return panel;
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class DefaultGroovyFrameworkConfigNotification method createConfigureNotificationPanel.
@Override
public EditorNotificationPanel createConfigureNotificationPanel(@NotNull final Module module) {
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(GroovyBundle.message("groovy.library.is.not.configured.for.module", module.getName()));
panel.createActionLabel(GroovyBundle.message("configure.groovy.library"), () -> AddCustomLibraryDialog.createDialog(new GroovyLibraryDescription(), module, null).show());
return panel;
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class ForcedSoftWrapsNotificationProvider method createNotificationPanel.
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, @NotNull final FileEditor fileEditor) {
if (!(fileEditor instanceof TextEditor))
return null;
final Editor editor = ((TextEditor) fileEditor).getEditor();
final Project project = editor.getProject();
if (project == null || !Boolean.TRUE.equals(editor.getUserData(EditorImpl.FORCED_SOFT_WRAPS)) || PropertiesComponent.getInstance().isTrueValue(DISABLED_NOTIFICATION_KEY))
return null;
final EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(EditorBundle.message("forced.soft.wrap.message"));
panel.createActionLabel(EditorBundle.message("forced.soft.wrap.hide.message"), () -> {
editor.putUserData(EditorImpl.FORCED_SOFT_WRAPS, null);
EditorNotifications.getInstance(project).updateNotifications(file);
});
panel.createActionLabel(EditorBundle.message("forced.soft.wrap.dont.show.again.message"), () -> {
PropertiesComponent.getInstance().setValue(DISABLED_NOTIFICATION_KEY, "true");
EditorNotifications.getInstance(project).updateAllNotifications();
});
return panel;
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class PluginAdvertiserEditorNotificationProvider method createNotificationPanel.
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
if (file.getFileType() != PlainTextFileType.INSTANCE && !(file.getFileType() instanceof AbstractFileType))
return null;
final String extension = file.getExtension();
final String fileName = file.getName();
if (extension != null && isIgnored("*." + extension) || isIgnored(fileName))
return null;
final PluginsAdvertiser.KnownExtensions knownExtensions = PluginsAdvertiser.loadExtensions();
if (knownExtensions != null) {
final EditorNotificationPanel panel = extension != null ? createPanel("*." + extension, knownExtensions) : null;
if (panel != null) {
return panel;
}
return createPanel(fileName, knownExtensions);
}
return null;
}
use of com.intellij.ui.EditorNotificationPanel in project intellij-community by JetBrains.
the class LineStatusTracker method installNotification.
@Override
@CalledInAwt
protected void installNotification(@NotNull String text) {
final FileEditor[] editors = myFileEditorManager.getAllEditors(myVirtualFile);
for (FileEditor editor : editors) {
JPanel panel = editor.getUserData(PANEL_KEY);
if (panel == null) {
final JPanel newPanel = new EditorNotificationPanel().text(text);
editor.putUserData(PANEL_KEY, newPanel);
myFileEditorManager.addTopComponent(editor, newPanel);
}
}
}
Aggregations