/** * Create and show new notification with the default priority. * @param title Notification title. Html is not supported, any html tags will * be escaped. * @param icon Notification icon * @param detailsText Detailed description of the notification. If detailsAction * is non-null then this text will be presented as a clickable link. Html is * not supported, any html tags will be escaped. * @param detailsAction Action to invoke when user click details text or null. * @return New notification. */ public Notification notify( String title, Icon icon, String detailsText, ActionListener detailsAction ) { return notify( title, icon, detailsText, detailsAction, Priority.NORMAL); }
@Override public void notify (final @Nonnull String string) { log.info(string); final Notification notification = NotificationDisplayer.getDefault().notify("", new ImageIcon(), string, null); RequestProcessor.getDefault().post(new Runnable() { @Override public void run() { notification.clear(); } }, 5000); } }
@Override public void showErrorNotification(String title, String shortText, String longText) { ImageIcon icon = ImageUtilities.loadImageIcon("org/netbeans/modules/nativeexecution/impl/error.png", false); //NOI18N longText = "<html>" + longText + "</html>"; // NOI18N NotificationDisplayer.getDefault().notify(title, icon, new JLabel(shortText), new JLabel(longText), NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.ERROR); }
/** * Show message with the specified type and action listener */ public static void show(String title, String message, MessageType type, ActionListener actionListener) { NotificationDisplayer.getDefault().notify(title, type.getIcon(), message, actionListener); }
@Override public void notify(Level level, String title, String message) { NotificationDisplayer.getDefault().notify(title, Icons.forLevel(level), message, null); }
@Override public void preferenceChange(PreferenceChangeEvent evt) { NotificationDisplayer.getDefault().notify( "Restart IDE", ImageUtilities.loadImageIcon("com/revivius/nb/darcula/options/restart.png", true), "Click here to restart IDE and apply new settings.", new ActionListener() { @Override public void actionPerformed(ActionEvent e) { LifecycleManager.getDefault().markForRestart(); LifecycleManager.getDefault().exit(); } } ); } };
private static synchronized ExceptionFlasher notify(String summary, ImageIcon icon) { if (flash != null) { flash.timer.restart(); } else { flash = new ExceptionFlasher(); flash.note = NotificationDisplayer.getDefault().notify( NbBundle.getMessage(NotifyExcPanel.class, "NTF_ExceptionalExceptionTitle"), icon, summary, flash, NotificationDisplayer.Priority.SILENT); } return flash; } Notification note;
.notify("Restart Required", TangoIcons.status_software_update_urgent(TangoIcons.Res.R16), String.format("Some environment settings have been modified by module '%s'.\n" +
public static void showNotification(final Map<Tool, List<List<String>>> needReset, final CompilerSetManager csm) { final String title = NbBundle.getMessage(FixCodeAssistancePanel.class, "FixCodeAssistancePanel.title.text"); // NOI18N ActionListener onClickAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JButton btnOk = new JButton( NbBundle.getMessage(FixCodeAssistancePanel.class, "FixCodeAssistancePanel.action.OK")); // NOI18N JButton btnCancel = new JButton( NbBundle.getMessage(FixCodeAssistancePanel.class, "FixCodeAssistancePanel.action.CANCEL")); // NOI18N FixCodeAssistancePanel panel = new FixCodeAssistancePanel(needReset); DialogDescriptor descriptor = new DialogDescriptor(panel, title, true, new Object[]{btnOk,btnCancel}, DialogDescriptor.CLOSED_OPTION, DialogDescriptor.DEFAULT_ALIGN, null, null); if (DialogDisplayer.getDefault().notify(descriptor) == btnOk) { ToolchainUtilities.fixCSM(needReset, csm); } } }; ImageIcon icon = ImageUtilities.loadImageIcon("org/netbeans/modules/cnd/toolchain/compilerset/exclamation.gif", false); // NOI18N NotificationDisplayer.getDefault().notify(title, icon, NbBundle.getMessage(FixCodeAssistancePanel.class, "FixCodeAssistancePanel.action.text"), // NOI18N onClickAction, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.WARNING); // NOI18N }
Notification notification = (Notification) NotificationDisplayer.getDefault().notify(dateSb.toString(), new ImageIcon(), clickable, new ActionListener() {
public static void showNotification(final Map<Tool, List<List<String>>> needReset, final CompilerSetManagerImpl csm) { final String title = NbBundle.getMessage(FixCodeAssistancePanel.class, "FixCodeAssistancePanel.title.text"); // NOI18N ActionListener onClickAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JButton btnOk = new JButton( NbBundle.getMessage(FixCodeAssistancePanel.class, "FixCodeAssistancePanel.action.OK")); // NOI18N JButton btnCancel = new JButton( NbBundle.getMessage(FixCodeAssistancePanel.class, "FixCodeAssistancePanel.action.CANCEL")); // NOI18N FixCodeAssistancePanel panel = new FixCodeAssistancePanel(needReset); DialogDescriptor descriptor = new DialogDescriptor(panel, title, true, new Object[]{btnOk,btnCancel}, DialogDescriptor.CLOSED_OPTION, DialogDescriptor.DEFAULT_ALIGN, null, null); if (DialogDisplayer.getDefault().notify(descriptor) == btnOk) { ToolchainValidator.INSTANCE.applyChanges(needReset, csm); } } }; ImageIcon icon = ImageUtilities.loadImageIcon("org/netbeans/modules/cnd/toolchain/compilerset/exclamation.gif", false); // NOI18N NotificationDisplayer.getDefault().notify(title, icon, NbBundle.getMessage(FixCodeAssistancePanel.class, "FixCodeAssistancePanel.action.text"), // NOI18N onClickAction, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.WARNING); // NOI18N }
/** * Handles an error. * * @param message An error message. * @param t An exception or {@code null}. */ public void handleError(String message, Throwable t) { if (t != null) { t.printStackTrace(); } Dialogs.showError("Error", message); getLogger().log(Level.SEVERE, message, t); ImageIcon icon = TangoIcons.status_dialog_error(TangoIcons.Res.R16); JLabel balloonDetails = new JLabel(message); JButton popupDetails = new JButton("Report"); popupDetails.addActionListener(e -> { try { Desktop.getDesktop().browse(new URI("http://forum.step.esa.int/")); } catch (URISyntaxException | IOException e1) { getLogger().log(Level.SEVERE, message, e1); } }); NotificationDisplayer.getDefault().notify("Error", icon, balloonDetails, popupDetails, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.ERROR); }
@Override public void run() { updateDefaultConfigs(); FileObject readmeFO = updateJfxImpl(); if(readmeFO != null && isEnabledJFXUpdateNotification()) { final String headerTemplate = NbBundle.getMessage(JFXProjectUtils.class, "TXT_UPDATED_README_FILE_CONTENT_HEADER"); //NOI18N final String header = MessageFormat.format(headerTemplate, new Object[] {ProjectUtils.getInformation(prj).getDisplayName()}); final String content = NbBundle.getMessage(JFXProjectUtils.class, "TXT_UPDATED_NOTIFICATION_CONTENT"); //NOI18N Notification noteUpdate = NotificationDisplayer.getDefault().notify( header, ImageUtilities.loadImageIcon("org/netbeans/modules/javafx2/project/ui/resources/jfx_project.png", true), //NOI18N content, null, NotificationDisplayer.Priority.LOW, NotificationDisplayer.Category.INFO); addNotification(prj, noteUpdate); } } } : null;
@Override public void showInfoNotification(String title, String shortMessage, String longMesage) { final Icon icon = ImageUtilities.loadImageIcon("org/netbeans/modules/nativeexecution/impl/exclamation.gif", false); // NOI18N // final String titleAndBriefMessage = NbBundle.getMessage(RemoteUserInfo.class, "TITLE_Message_Ex", // env.getDisplayName(), getBriefMessage(message)); final JComponent baloonComponent = createMessageComponent(longMesage); final JComponent popupDetails = createMessageComponent(longMesage); // createPopupDetails(titleAndBriefMessage, message, icon); NotificationDisplayer.getDefault().notify(title, icon, baloonComponent, popupDetails, NotificationDisplayer.Priority.NORMAL, NotificationDisplayer.Category.INFO); }
synchronized void addPrivateMessage(final Message msg) { assert SwingUtilities.isEventDispatchThread(); final String name = StringUtils.parseBareAddress(msg.getFrom()); Notification n = privateNotifications.get(name); if (n != null) { n.clear(); privateNotifications.remove(name); } increasePrivateMessagesCount(name); String title; int count = getPrivateMessagesCount(name); if (count==1) { title = NbBundle.getMessage(ChatTopComponent.class, "LBL_ChatNotification", new Object[]{name, count}); // NOI18N } else { title = NbBundle.getMessage(ChatTopComponent.class, "LBL_ChatNotifications", new Object[]{name, count}); // NOI18N } String description = NbBundle.getMessage(ChatTopComponent.class, "LBL_ReadIt"); // NOI18N n = NotificationDisplayer.getDefault().notify(title, getIcon(), description, new ActionListener() { public void actionPerformed(ActionEvent e) { ChatTopComponent tc = ChatTopComponent.findInstance(); tc.open(); tc.setActivePrivate(name); } }, Priority.NORMAL); privateNotifications.put(name, n); ChatTopComponent.refreshContactList(); DashboardImpl.getInstance().getComponent().repaint(); }
synchronized void addGroupMessage(final Message msg) { assert SwingUtilities.isEventDispatchThread(); KenaiProject prj = KenaiConnection.getKenaiProject(StringUtils.parseBareAddress(msg.getFrom())); final MessagingHandleImpl r = getMessagingHandle(prj); r.notifyMessageReceived(msg); String title = null; int count = r.getMessageCount(); if (count==1) { title = NbBundle.getMessage(ChatTopComponent.class, "LBL_ChatNotification", new Object[]{prj.getDisplayName(), count}); } else { title = NbBundle.getMessage(ChatTopComponent.class, "LBL_ChatNotifications", new Object[]{prj.getDisplayName(), count}); } final String description = NbBundle.getMessage(ChatTopComponent.class, "LBL_ReadIt"); final ActionListener l = new ActionListener() { public void actionPerformed(ActionEvent arg0) { final ChatTopComponent chatTc = ChatTopComponent.findInstance(); ChatTopComponent.openAction(chatTc, "", "", false).actionPerformed(arg0); // NOI18N chatTc.setActiveGroup(StringUtils.parseBareAddress(msg.getFrom())); } }; if (r.getMessageCount()>0) { Notification n = NotificationDisplayer.getDefault().notify(title, getIcon(), description, l, Priority.NORMAL); r.updateNotification(n); } ChatTopComponent.refreshContactList(); }
private void createScheduleNotification() { if (scheduleNotification != null) { scheduleNotification.clear(); } removeListener(); IssueScheduleInfo todayInfo = DashboardUtils.getToday(); IssueImpl[] scheduledTasks = schedulingManager.getScheduledTasks(todayInfo, dashboardViewer.getRepositories(true).toArray(new RepositoryImpl[0])); addListener(); List<IssueImpl> tasks = Arrays.asList(scheduledTasks); if (!scheduleChanged(oldTasks, tasks) && isNotFirstToday() || tasks.isEmpty()) { return; } NotificationDisplayer.Priority priority = NotificationDisplayer.Priority.NORMAL; if (isNotFirstToday()) { priority = NotificationDisplayer.Priority.SILENT; } oldTasks = tasks; lastNotification = Calendar.getInstance(); TaskNotificationPanel bubblePanel = new TaskNotificationPanel(tasks, new SelectTodayCategory()); TaskNotificationPanel notificationPanel = new TaskNotificationPanel(tasks, new SelectTodayCategory()); String title = NbBundle.getMessage(NotificationManager.class, "LBL_ScheduleTitle", tasks.size()); scheduleNotification = NotificationDisplayer.getDefault().notify( title, DASHBOARD_ICON, bubblePanel, notificationPanel, priority, NotificationDisplayer.Category.INFO ); updateSchedule.schedule(DashboardUtils.getMillisToTomorrow()); }
final String header = MessageFormat.format(headerTemplate, new Object[] {ProjectUtils.getInformation(project).getDisplayName()}); final String content = NbBundle.getMessage(JFXProjectUtils.class, "TXT_UPDATED_DEFAULT_PLATFORM_CONTENT"); //NOI18N Notification notePlatformChange = NotificationDisplayer.getDefault().notify( header, ImageUtilities.loadImageIcon("org/netbeans/modules/javafx2/project/ui/resources/jfx_project.png", true), //NOI18N
final String header = MessageFormat.format(headerTemplate, new Object[] {ProjectUtils.getInformation(project).getDisplayName()}); final String content = NbBundle.getMessage(JFXProjectUtils.class, "TXT_SWITCHED_SE_TO_FX_CONTENT"); //NOI18N Notification notePlatformChange = NotificationDisplayer.getDefault().notify( header, ImageUtilities.loadImageIcon("org/netbeans/modules/javafx2/project/ui/resources/jfx_project.png", true), //NOI18N
@Override public void run() { final ResultWindow window = ResultWindow.getInstance(); Mode mode = WindowManager.getDefault().findMode(window); boolean isInSlidingMode = mode != null && mode.getName().contains("SlidingSide"); //NOI18N if (window.isOpened() && !isInSlidingMode) { window.promote(); } else if (!window.isOpened() || (window.isOpened() && !window.isShowing() && isInSlidingMode)) { Icon icon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/gsf/testrunner/ui/resources/testResults.png")); //NOI18N String projectname = ProjectUtils.getInformation(session.getProject()).getDisplayName(); int total = displayHandler.getTotalTests(); String title = total == 0 ? Bundle.LBL_NotificationDisplayer_NoTestsExecuted_title(projectname) : Bundle.LBL_NotificationDisplayer_title(total, projectname); if(bubbleTask.cancel()) { bubbleTask.schedule(0); } bubbleNotification = NotificationDisplayer.getDefault().notify(title, icon, Bundle.LBL_NotificationDisplayer_detailsText(), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { window.promote(); bubbleTask.cancel(); } }); bubbleTask.schedule(15000); } } });