本文整理汇总了Java中com.intellij.notification.Notification.notify方法的典型用法代码示例。如果您正苦于以下问题:Java Notification.notify方法的具体用法?Java Notification.notify怎么用?Java Notification.notify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.notification.Notification
的用法示例。
在下文中一共展示了Notification.notify方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showNotification
import com.intellij.notification.Notification; //导入方法依赖的package包/类
private static void showNotification(@NotNull DiffViewerBase viewer, @NotNull Notification notification) {
JComponent component = viewer.getComponent();
Window window = UIUtil.getWindow(component);
if (window instanceof IdeFrame && NotificationsManagerImpl.findWindowForBalloon(viewer.getProject()) == window) {
notification.notify(viewer.getProject());
return;
}
Balloon balloon = NotificationsManagerImpl.createBalloon(component, notification, false, true);
Disposer.register(viewer, balloon);
Dimension componentSize = component.getSize();
Dimension balloonSize = balloon.getPreferredSize();
int width = Math.min(balloonSize.width, componentSize.width);
int height = Math.min(balloonSize.height, componentSize.height);
// top-right corner, 20px to the edges
RelativePoint point = new RelativePoint(component, new Point(componentSize.width - 20 - width / 2, 20 + height / 2));
balloon.show(point, Balloon.Position.above);
}
示例2: showErrorNotification
import com.intellij.notification.Notification; //导入方法依赖的package包/类
private static void showErrorNotification(@NotNull Project project, String message, String responseString) {
final JsonObject details = new JsonParser().parse(responseString).getAsJsonObject();
final String detailString = details.get("detail").getAsString();
final Notification notification =
new Notification("Push.course", message, detailString, NotificationType.ERROR);
notification.notify(project);
}
示例3: showStepicNotification
import com.intellij.notification.Notification; //导入方法依赖的package包/类
private static void showStepicNotification(@NotNull Project project,
@NotNull NotificationType notificationType, @NotNull String failedActionName) {
String text = "Log in to Stepik to " + failedActionName;
Notification notification = new Notification("Stepik", "Failed to " + failedActionName, text, notificationType);
notification.addAction(new AnAction("Log in") {
@Override
public void actionPerformed(AnActionEvent e) {
EduStepicConnector.doAuthorize(() -> showOAuthDialog());
notification.expire();
}
});
notification.notify(project);
}
示例4: printToEventLog
import com.intellij.notification.Notification; //导入方法依赖的package包/类
private void printToEventLog(String message) {
NotificationGroup group = NotificationGroup.logOnlyGroup("typing-delay-stats");
Notification notification = group.createNotification(message, NotificationType.INFORMATION);
notification.setImportant(true);
notification.notify(myEditor.getProject());
notification.hideBalloon();
}
示例5: handleFileTooBigException
import com.intellij.notification.Notification; //导入方法依赖的package包/类
protected void handleFileTooBigException(Logger logger, FilesTooBigForDiffException e, @NotNull PsiFile file) {
logger.info("Error while calculating changed ranges for: " + file.getVirtualFile(), e);
if (!ApplicationManager.getApplication().isUnitTestMode()) {
Notification notification = new Notification(ApplicationBundle.message("reformat.changed.text.file.too.big.notification.groupId"),
ApplicationBundle.message("reformat.changed.text.file.too.big.notification.title"),
ApplicationBundle.message("reformat.changed.text.file.too.big.notification.text", file.getName()),
NotificationType.INFORMATION);
notification.notify(file.getProject());
}
}
示例6: updateCourse
import com.intellij.notification.Notification; //导入方法依赖的package包/类
private void updateCourse() {
final Course course = StudyTaskManager.getInstance(myProject).getCourse();
if (course == null) {
return;
}
final File resourceDirectory = new File(course.getCourseDirectory());
if (!resourceDirectory.exists()) {
return;
}
StudyLanguageManager manager = StudyUtils.getLanguageManager(course);
if (manager == null) {
LOG.info("Study Language Manager is null for " + course.getLanguageById().getDisplayName());
return;
}
final File[] files = resourceDirectory.listFiles();
if (files == null) return;
for (File file : files) {
String testHelper = manager.getTestHelperFileName();
if (file.getName().equals(testHelper)) {
copyFile(file, new File(myProject.getBasePath(), testHelper));
}
if (file.getName().startsWith(EduNames.LESSON)) {
final File[] tasks = file.listFiles();
if (tasks == null) continue;
for (File task : tasks) {
final File taskDescr = new File(task, EduNames.TASK_HTML);
String testFileName = manager.getTestFileName();
final File taskTests = new File(task, testFileName);
copyFile(taskDescr, new File(new File(new File(myProject.getBasePath(), file.getName()), task.getName()), EduNames.TASK_HTML));
copyFile(taskTests, new File(new File(new File(myProject.getBasePath(), file.getName()), task.getName()),
testFileName));
}
}
}
final Notification notification =
new Notification("Update.course", "Course update", "Current course is synchronized", NotificationType.INFORMATION);
notification.notify(myProject);
}
示例7: showBalloon
import com.intellij.notification.Notification; //导入方法依赖的package包/类
public void showBalloon(@NotNull String title,
@NotNull String text,
@NotNull NotificationType type,
@NotNull NotificationGroup group,
@Nullable NotificationListener listener) {
final Notification notification = group.createNotification(title, text, type, listener);
Runnable notificationTask = new Runnable() {
@Override
public void run() {
if (!myProject.isDisposed() && myProject.isOpen()) {
Notification old = myNotification;
if (old != null) {
boolean similar = Objects.equal(notification.getContent(), old.getContent());
if (similar) {
old.expire();
}
}
myNotification = notification;
notification.notify(myProject);
}
}
};
Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
notificationTask.run();
}
else {
application.invokeLater(notificationTask);
}
}
示例8: notifyUser
import com.intellij.notification.Notification; //导入方法依赖的package包/类
private static void notifyUser(DataContext context, MavenProject mavenProject, MavenProject aggregator) {
String aggregatorDescription = " (" + aggregator.getMavenId().getDisplayString() + ')';
Notification notification = new Notification(MavenUtil.MAVEN_NOTIFICATION_GROUP, "Failed to remove project",
"You can not remove " + mavenProject.getName() + " because it's " +
"imported as a module of another project" +
aggregatorDescription
+ ". You can use Ignore action. Only root project can be removed.",
NotificationType.ERROR
);
notification.setImportant(true);
notification.notify(MavenActionUtil.getProject(context));
}
示例9: notifyFailed
import com.intellij.notification.Notification; //导入方法依赖的package包/类
private static void notifyFailed(Project project, String message) {
Notification notification =
NOTIFICATION_GROUP.createNotification(
"Failed to add source file to project",
message,
NotificationType.WARNING,
/* listener */ null);
notification.notify(project);
}
示例10: showStepicNotification
import com.intellij.notification.Notification; //导入方法依赖的package包/类
private static void showStepicNotification(@NotNull NotificationType notificationType, @NotNull String text) {
Notification notification = new Notification("Stepik", "Stepik", text, notificationType);
notification.notify(null);
}
示例11: showNotification
import com.intellij.notification.Notification; //导入方法依赖的package包/类
private static void showNotification(@NotNull Project project, String message) {
final Notification notification =
new Notification("Push.course", message, message, NotificationType.INFORMATION);
notification.notify(project);
}
示例12: notify
import com.intellij.notification.Notification; //导入方法依赖的package包/类
public void notify(String section, String title, String text, NotificationType type) {
Notification notification = new Notification(section, title, text, type);
notification.notify(ProjectManager.getInstance().getDefaultProject());
}
示例13: showMessage
import com.intellij.notification.Notification; //导入方法依赖的package包/类
public Notification showMessage(String message, MessageType messageType, @Nullable NotificationListener listener) {
NotificationGroup notificationGroup = NotificationGroup.balloonGroup(myNotificationDisplayId);
Notification notification = notificationGroup.createNotification("", message, messageType.toNotificationType(), listener);
notification.notify(null);
return notification;
}
示例14: applyNotification
import com.intellij.notification.Notification; //导入方法依赖的package包/类
private void applyNotification(@NotNull final Notification notification) {
if (!myProject.isDisposed() && myProject.isOpen()) {
notification.notify(myProject);
}
}