本文整理匯總了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);
}
}