Search in sources :

Example 6 with EditorNotificationPanel

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;
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) PsiClass(com.intellij.psi.PsiClass)

Example 7 with EditorNotificationPanel

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;
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel)

Example 8 with EditorNotificationPanel

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;
}
Also used : Project(com.intellij.openapi.project.Project) TextEditor(com.intellij.openapi.fileEditor.TextEditor) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) Editor(com.intellij.openapi.editor.Editor) FileEditor(com.intellij.openapi.fileEditor.FileEditor) TextEditor(com.intellij.openapi.fileEditor.TextEditor) Nullable(org.jetbrains.annotations.Nullable)

Example 9 with EditorNotificationPanel

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;
}
Also used : AbstractFileType(com.intellij.openapi.fileTypes.impl.AbstractFileType) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) Nullable(org.jetbrains.annotations.Nullable)

Example 10 with EditorNotificationPanel

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);
        }
    }
}
Also used : FileEditor(com.intellij.openapi.fileEditor.FileEditor) EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) CalledInAwt(org.jetbrains.annotations.CalledInAwt)

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