Search in sources :

Example 31 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoFileIgnoredByBuildToolNotificationProvider method createMismatchedTargetPanel.

@NotNull
private static EditorNotificationPanel createMismatchedTargetPanel(@NotNull Module module, @NotNull VirtualFile file) {
    EditorNotificationPanel panel = new EditorNotificationPanel();
    panel.setText("'" + file.getName() + "' doesn't match to target system. File will be ignored by build tool");
    panel.createActionLabel("Edit Go project settings", () -> GoModuleSettings.showModulesConfigurable(module));
    return panel;
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) NotNull(org.jetbrains.annotations.NotNull)

Example 32 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project go-lang-idea-plugin by go-lang-plugin-org.

the class WrongSdkConfigurationNotificationProvider method createEmptyGoPathPanel.

@NotNull
private static EditorNotificationPanel createEmptyGoPathPanel(@NotNull Project project) {
    EditorNotificationPanel panel = new EditorNotificationPanel();
    panel.setText("GOPATH is empty");
    panel.createActionLabel("Configure Go Libraries", () -> GoLibrariesConfigurableProvider.showModulesConfigurable(project));
    panel.createActionLabel("Do not show again", () -> {
        PropertiesComponent.getInstance().setValue(DO_NOT_SHOW_NOTIFICATION_ABOUT_EMPTY_GOPATH, true);
        EditorNotifications.getInstance(project).updateAllNotifications();
    });
    return panel;
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) NotNull(org.jetbrains.annotations.NotNull)

Example 33 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project android by JetBrains.

the class ProjectSyncStatusNotificationProvider method createNotificationPanel.

@Override
@Nullable
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
    NotificationPanel oldPanel = (NotificationPanel) fileEditor.getUserData(getKey());
    NotificationPanel.Type newPanelType = notificationPanelType();
    return (oldPanel != null && oldPanel.type == newPanelType) ? oldPanel : newPanelType.create(myProject);
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) Nullable(org.jetbrains.annotations.Nullable)

Example 34 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project android by JetBrains.

the class AndroidProjectStructureConfigurable method syncStarted.

@Override
public void syncStarted(@NotNull Project project) {
    if (myUiInitialized) {
        myNotificationPanel.removeAll();
        EditorNotificationPanel notification = new EditorNotificationPanel();
        notification.setText("Gradle project sync in progress...");
        myNotificationPanel.add(notification);
        revalidateAndRepaint(myNotificationPanel);
    }
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel)

Example 35 with EditorNotificationPanel

use of com.intellij.ui.EditorNotificationPanel in project android by JetBrains.

the class AttachAndroidSdkSourcesNotificationProvider method createNotificationPanel.

@Override
@Nullable
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
    if (file.getFileType() != JavaClassFileType.INSTANCE) {
        return null;
    }
    // Locate the java source of the class file, if not found, then it might come from a SDK.
    if (JavaEditorFileSwapper.findSourceFile(myProject, file) == null) {
        JdkOrderEntry jdkOrderEntry = findAndroidSdkEntryForFile(file);
        if (jdkOrderEntry == null) {
            return null;
        }
        Sdk sdk = jdkOrderEntry.getJdk();
        String sdkHome = sdk.getHomePath();
        if (sdkHome == null) {
            return null;
        }
        if (sdk.getRootProvider().getFiles(OrderRootType.SOURCES).length > 0) {
            return null;
        }
        AndroidPlatform platform = AndroidPlatform.getInstance(sdk);
        if (platform == null) {
            return null;
        }
        EditorNotificationPanel panel = new EditorNotificationPanel();
        panel.setText("Sources for '" + jdkOrderEntry.getJdkName() + "' not found.");
        panel.createActionLabel("Download", () -> {
            List<String> requested = Lists.newArrayList();
            requested.add(DetailsTypes.getSourcesPath(platform.getApiVersion()));
            ModelWizardDialog dialog = SdkQuickfixUtils.createDialogForPaths(myProject, requested);
            if (dialog != null && dialog.showAndGet()) {
                updateSdkSourceRoot(sdk);
            }
        });
        panel.createActionLabel("Refresh (if already downloaded)", () -> updateSdkSourceRoot(sdk));
        return panel;
    }
    return null;
}
Also used : EditorNotificationPanel(com.intellij.ui.EditorNotificationPanel) AndroidPlatform(org.jetbrains.android.sdk.AndroidPlatform) Sdk(com.intellij.openapi.projectRoots.Sdk) ModelWizardDialog(com.android.tools.idea.wizard.model.ModelWizardDialog) Nullable(org.jetbrains.annotations.Nullable)

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