use of com.intellij.ui.EditorNotificationPanel in project ballerina by ballerina-lang.
the class WrongModuleTypeNotificationProvider method createPanel.
@NotNull
private static EditorNotificationPanel createPanel(@NotNull Project project, @NotNull Module module) {
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText("'" + module.getName() + "' is not a Ballerina Module, some code insight might not work here");
return panel;
}
use of com.intellij.ui.EditorNotificationPanel in project Perl5-IDEA by Camelcade.
the class PerlInterpreterEditorNotification method createNotificationPanel.
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile virtualFile, @NotNull FileEditor fileEditor) {
if (virtualFile.getFileType() instanceof PerlFileType && !(virtualFile instanceof LightVirtualFile)) {
final PerlLocalSettings perlLocalSettings = PerlLocalSettings.getInstance(myProject);
if (perlLocalSettings.DISABLE_NO_INTERPRETER_WARNING) {
return null;
}
EditorNotificationPanel panel;
String sdkPath = PerlProjectManager.getSdkPath(myProject, virtualFile);
if (sdkPath != null && VfsUtil.findFileByIoFile(new File(sdkPath), true) != null) {
return null;
}
panel = new EditorNotificationPanel();
panel.setText(PerlBundle.message("perl.notification.sdk.not.configured"));
panel.createActionLabel(PerlBundle.message("perl.notification.configure"), () -> Perl5SettingsConfigurable.open(myProject));
panel.createActionLabel(PerlBundle.message("perl.notification.disable.notification"), () -> {
perlLocalSettings.DISABLE_NO_INTERPRETER_WARNING = true;
EditorNotifications.getInstance(myProject).updateAllNotifications();
});
return panel;
}
return null;
}
use of com.intellij.ui.EditorNotificationPanel in project intellij by bazelbuild.
the class ExternalFileProjectManagementHelper method createNotificationPanel.
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(VirtualFile vf, FileEditor fileEditor) {
if (!enabled.getValue()) {
return null;
}
if (!BlazeUserSettings.getInstance().getShowAddFileToProjectNotification() || suppressedFiles.contains(new File(vf.getPath()))) {
return null;
}
File file = new File(vf.getPath());
if (!supportedFileType(file)) {
return null;
}
LocationContext context = AddSourceToProjectHelper.getContext(project, file);
if (context == null) {
return null;
}
ListenableFuture<List<TargetInfo>> targetsFuture = AddSourceToProjectHelper.getTargetsBuildingSource(context);
if (targetsFuture == null) {
return null;
}
boolean inProjectDirectories = AddSourceToProjectHelper.sourceInProjectDirectories(context);
EditorNotificationPanel panel = new EditorNotificationPanel();
// starts off not visible until we get the query results
panel.setVisible(false);
panel.setText("Do you want to add this file to your project sources?");
panel.createActionLabel("Add file to project", () -> {
AddSourceToProjectHelper.addSourceToProject(project, context.workspacePath, inProjectDirectories, targetsFuture);
EditorNotifications.getInstance(project).updateNotifications(vf);
});
panel.createActionLabel("Hide notification", () -> {
// suppressed for this file until the editor is restarted
suppressedFiles.add(file);
EditorNotifications.getInstance(project).updateNotifications(vf);
});
panel.createActionLabel("Don't show again", () -> {
// disables the notification permanently, and focuses the relevant setting, so users know
// how to turn it back on
BlazeUserSettings.getInstance().setShowAddFileToProjectNotification(false);
ShowSettingsUtilImpl.showSettingsDialog(project, BlazeUserSettingsConfigurable.ID, BlazeUserSettingsConfigurable.SHOW_ADD_FILE_TO_PROJECT_LABEL_TEXT);
});
targetsFuture.addListener(() -> {
try {
List<TargetInfo> targets = targetsFuture.get();
if (!targets.isEmpty() || !inProjectDirectories) {
panel.setVisible(true);
}
} catch (InterruptedException | ExecutionException e) {
// ignore
}
}, MoreExecutors.directExecutor());
return panel;
}
use of com.intellij.ui.EditorNotificationPanel in project go-lang-idea-plugin by go-lang-plugin-org.
the class WrongSdkConfigurationNotificationProvider method createMissingSdkPanel.
@NotNull
private static EditorNotificationPanel createMissingSdkPanel(@NotNull Project project, @Nullable Module module) {
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText(ProjectBundle.message("project.sdk.not.defined"));
panel.createActionLabel(ProjectBundle.message("project.sdk.setup"), () -> GoSdkService.getInstance(project).chooseAndSetSdk(module));
return panel;
}
use of com.intellij.ui.EditorNotificationPanel in project go-lang-idea-plugin by go-lang-plugin-org.
the class WrongModuleTypeNotificationProvider method createPanel.
@NotNull
private static EditorNotificationPanel createPanel(@NotNull Project project, @NotNull Module module) {
EditorNotificationPanel panel = new EditorNotificationPanel();
panel.setText("'" + module.getName() + "' is not Go Module, some code insight might not work here");
panel.createActionLabel("Change module type to Go and reload project", () -> {
int message = Messages.showOkCancelDialog(project, "Updating module type requires project reload. Proceed?", "Update Module Type", "Reload project", "Cancel", null);
if (message == Messages.YES) {
module.setOption(Module.ELEMENT_TYPE, GoModuleType.getInstance().getId());
project.save();
EditorNotifications.getInstance(project).updateAllNotifications();
ProjectManager.getInstance().reloadProject(project);
}
});
panel.createActionLabel("Don't show again for this module", () -> {
Set<String> ignoredModules = getIgnoredModules(project);
ignoredModules.add(module.getName());
PropertiesComponent.getInstance(project).setValue(DONT_ASK_TO_CHANGE_MODULE_TYPE_KEY, StringUtil.join(ignoredModules, ","));
EditorNotifications.getInstance(project).updateAllNotifications();
});
return panel;
}
Aggregations