private void notifyBadInput(String msg) { Object[] options = {NotifyDescriptor.OK_OPTION}; NotifyDescriptor badInputDialog = new NotifyDescriptor(msg, NbBundle.getMessage(TableRowDialog.class, "MSG_invalid_input"), NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.ERROR_MESSAGE, options, options[0]); DialogDisplayer.getDefault().notify(badInputDialog); } }
private static boolean showModifiedMessage (String title) { String message = NbBundle.getMessage(AppClientProjectProperties.class,"TXT_Regenerate"); JButton regenerateButton = new JButton (NbBundle.getMessage(AppClientProjectProperties.class,"CTL_RegenerateButton")); regenerateButton.setDefaultCapable(true); regenerateButton.getAccessibleContext().setAccessibleDescription (NbBundle.getMessage(AppClientProjectProperties.class,"AD_RegenerateButton")); NotifyDescriptor d = new NotifyDescriptor.Message (message, NotifyDescriptor.WARNING_MESSAGE); d.setTitle(title); d.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION); d.setOptions(new Object[] {regenerateButton, NotifyDescriptor.CANCEL_OPTION}); return DialogDisplayer.getDefault().notify(d) == regenerateButton; }
public static void quickSearchTask(RepositoryImpl repositoryImpl) { JButton open = new JButton(NbBundle.getMessage(DashboardTopComponent.class, "OPTION_Open")); open.setEnabled(false); JButton cancel = new JButton(NbBundle.getMessage(DashboardTopComponent.class, "OPTION_Cancel")); QuickSearchPanel quickSearchPanel = new QuickSearchPanel(repositoryImpl); NotifyDescriptor quickSearchDialog = new NotifyDescriptor( quickSearchPanel, NbBundle.getMessage(DashboardTopComponent.class, "LBL_QuickTitle", repositoryImpl.getDisplayName()), //NOI18N NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE, new Object[]{open, cancel}, open); quickSearchDialog.setValid(false); QuickSearchListener quickSearchListener = new QuickSearchListener(quickSearchPanel, open); quickSearchPanel.addQuickSearchListener(quickSearchListener); Object result = DialogDisplayer.getDefault().notify(quickSearchDialog); if (result == open) { IssueImpl issueImpl = quickSearchPanel.getSelectedTask(); IssueAction.openIssue(issueImpl.getRepositoryImpl(), issueImpl.getID()); Category selectedCategory = quickSearchPanel.getSelectedCategory(); if (selectedCategory != null) { DashboardViewer.getInstance().addTaskToCategory(selectedCategory, new TaskNode(issueImpl, null)); } } quickSearchPanel.removeQuickSearchListener(quickSearchListener); }
/** @return 0 => cannot close, -1 can close and do not save, 1 can close and save */ private int canCloseImpl() { String msg = messageSave(); ResourceBundle bundle = NbBundle.getBundle(CloneableEditorSupport.class); JButton saveOption = new JButton(bundle.getString("CTL_Save")); // NOI18N saveOption.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_CTL_Save")); // NOI18N saveOption.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_CTL_Save")); // NOI18N JButton discardOption = new JButton(bundle.getString("CTL_Discard")); // NOI18N discardOption.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_CTL_Discard")); // NOI18N discardOption.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_CTL_Discard")); // NOI18N discardOption.setMnemonic(bundle.getString("CTL_Discard_Mnemonic").charAt(0)); // NOI18N NotifyDescriptor nd = new NotifyDescriptor( msg, bundle.getString("LBL_SaveFile_Title"), NotifyDescriptor.YES_NO_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE, new Object[] { saveOption, discardOption, NotifyDescriptor.CANCEL_OPTION }, saveOption ); Object ret = DialogDisplayer.getDefault().notify(nd); if (NotifyDescriptor.CANCEL_OPTION.equals(ret) || NotifyDescriptor.CLOSED_OPTION.equals(ret)) { return 0; } if (saveOption.equals(ret)) { return 1; } else { return -1; } }
final JButton ok = new JButton(NbBundle.getMessage(MasterPasswordPanel.class, "MasterPasswordPanel.ok")); ok.setDefaultCapable(true); NotifyDescriptor d = new NotifyDescriptor(this, NbBundle.getMessage(MasterPasswordPanel.class, "MasterPasswordPanel.enter_master_password"), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE, new Object[] {ok, NotifyDescriptor.CANCEL_OPTION}, ok); final NotificationLineSupport notification = d.createNotificationLineSupport(); setNewBox.setEnabled(!fresh); final Runnable update = new Runnable() { if (DialogDisplayer.getDefault().notify(d) != ok) { return null;
NotifyDescriptor nd = new NotifyDescriptor.Confirmation( NbBundle.getMessage( ServerInstance.class, "MSG_AnotherServerRunning", NotifyDescriptor.QUESTION_MESSAGE ); nd.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION); JButton yes = new JButton(NbBundle.getMessage(ServerInstance.class, "MSG_AnotherServerStopYes")); JButton no = new JButton(NbBundle.getMessage(ServerInstance.class, "MSG_AnotherServerStopNo")); yes.setDefaultCapable(true); nd.setOptions(new Object[] { yes, no }); Object option = DialogDisplayer.getDefault().notify(nd); if (option != yes) { //user pressed No String msg = NbBundle.getMessage(ServerInstance.class, "MSG_ServerStartupCancelled", getDisplayName());
Callable<Library> download = definer.missingLibrary(version); if (download != null) { NotifyDescriptor nd = new NotifyDescriptor.Confirmation(junitlib_confirm_text(), junitlib_confirm_title()); JButton accept = new JButton(junitlib_confirm_accept()); accept.setDefaultCapable(true); nd.setOptions(new Object[] {accept, NotifyDescriptor.CANCEL_OPTION}); if (DialogDisplayer.getDefault().notify(nd) == accept) { try { download.call();
public void run() { String message = NbBundle.getMessage(XmlMultiViewDataObject.class, "TXT_OverwriteUnparsableDocument", getPrimaryFile().getNameExt()); NotifyDescriptor desc = new NotifyDescriptor.Confirmation(message, NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(desc); overwriteUnparseable = Boolean.valueOf(desc.getValue() == NotifyDescriptor.YES_OPTION); handleUnparseableTimeout = new Date().getTime() + HANDLE_UNPARSABLE_TIMEOUT; } });
private static boolean commitAfterMerge (boolean locallyModifiedExcluded, File repository) { // XXX consider usage of repository to determine if there are any non-included files which have to be committed, too // and thus removing the option HgModuleConfig.getDefault().getConfirmCommitAfterMerge() if (locallyModifiedExcluded || HgModuleConfig.getDefault().getConfirmCommitAfterMerge()) { // ask before commit? NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_AFTER_MERGE_QUERY")); // NOI18N descriptor.setTitle(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_AFTER_MERGE_TITLE")); // NOI18N descriptor.setMessageType(JOptionPane.WARNING_MESSAGE); descriptor.setOptionType(NotifyDescriptor.YES_NO_OPTION); Object res = DialogDisplayer.getDefault().notify(descriptor); return res == NotifyDescriptor.YES_OPTION; } return true; }
@Override public Boolean displayConfirmation(String message, String caption, boolean cancellable) { NotifyDescriptor nd = new NotifyDescriptor.Confirmation(message, cancellable ? NotifyDescriptor.YES_NO_CANCEL_OPTION : NotifyDescriptor.YES_NO_OPTION); if (caption != null) nd.setTitle(caption); Object ret = DialogDisplayer.getDefault().notify(nd); if (ret == NotifyDescriptor.YES_OPTION) return Boolean.TRUE; if (ret == NotifyDescriptor.NO_OPTION) return Boolean.FALSE; return null; }
@Override public boolean notifyAndIgnore(String title, String msg) { NotifyDescriptor nd = new NotifyDescriptor(msg, title, NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.YES_OPTION); Object ret = DialogDisplayer.getDefault().notify(nd); return ret == NotifyDescriptor.YES_OPTION; }
public void run() { NotifyDescriptor nd = new NotifyDescriptor.Confirmation( ex.getLocalizedMessage(), NotifyDescriptor.YES_NO_OPTION ); nd.setOptions(new Object[] { NotifyDescriptor.YES_OPTION, NotifyDescriptor.NO_OPTION }); isModalDialog = true; Object res = DialogDisplayer.getDefault().notify(nd); isModalDialog = false; if (NotifyDescriptor.OK_OPTION.equals(res)) { isConfirmed = true; } else { isConfirmed = false; } } }
JCheckBox dontShowCheckBox = new JCheckBox(Bundle.LBL_DoNotShowThisMessage(), false); panel.add(dontShowCheckBox, BorderLayout.SOUTH); NotifyDescriptor d = new NotifyDescriptor(panel, title, JOptionPane.DEFAULT_OPTION, messageType, null, null); DialogDisplayer.getDefault().notify(d); if (d.getValue() != NotifyDescriptor.CANCEL_OPTION) { boolean storeResult = dontShowCheckBox.isSelected(); if (storeResult) { NotifyDescriptor d = new NotifyDescriptor(message, title, JOptionPane.DEFAULT_OPTION, messageType, null, null); DialogDisplayer.getDefault().notify(d);
private static void warnUser(String title, String message) { DialogDisplayer.getDefault().notifyLater(new NotifyDescriptor( message, title, NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.WARNING_MESSAGE, new Object[] {NotifyDescriptor.OK_OPTION}, NotifyDescriptor.OK_OPTION)); }
public void windowClosing(WindowEvent ev) { if (!haveFinalValue) { StandardDialog.this.nd.setValue(NotifyDescriptor.CLOSED_OPTION); } } }
private void displayMessage(String message, String caption, String details, int type) { Object msg = message; Object det = details; if (isHtmlString(message)) msg = new NBHTMLLabel(message); if (isHtmlString(details)) det = new NBHTMLLabel(message); NotifyDescriptor nd = det == null ? new NotifyDescriptor.Message(msg, type) : new ProfilerDialogs.MessageWithDetails(msg, det, type, false); if (caption != null) nd.setTitle(caption); ProfilerDialogs.notify(nd); }
String msg = messageSave (); ResourceBundle bundle = NbBundle.getBundle(CloneableEditorSupport.class); JButton saveOption = new JButton (bundle.getString("CTL_Save")); // NOI18N saveOption.getAccessibleContext ().setAccessibleDescription (bundle.getString("ACSD_CTL_Save")); // NOI18N saveOption.getAccessibleContext ().setAccessibleName (bundle.getString("ACSN_CTL_Save")); // NOI18N JButton discardOption = new JButton (bundle.getString("CTL_Discard")); // NOI18N discardOption.getAccessibleContext ().setAccessibleDescription (bundle.getString("ACSD_CTL_Discard")); // NOI18N discardOption.setMnemonic (bundle.getString ("CTL_Discard_Mnemonic").charAt (0)); // NOI18N NotifyDescriptor nd = new NotifyDescriptor( msg, bundle.getString("LBL_SaveFile_Title"), ); Object ret = DialogDisplayer.getDefault().notify(nd);
panel.jScrollPane2.setVisible (model.size () > 0); NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation (panel, NotifyDescriptor.YES_NO_OPTION); descriptor.setTitle (NbBundle.getMessage (ConfirmDeletionPanel.class, "TITLE_DeleteDialog")); // NOI18N DialogDisplayer.getDefault ().notify (descriptor); return NotifyDescriptor.YES_OPTION.equals (descriptor.getValue ());
offeredFileNames = "\n" + repository.getName(); //NOI18N NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(NbBundle.getMessage(CreateRefreshAction.class, "MSG_LONG_COMMAND_QUERY." + bundleKeyPostfix, offeredFileNames)); //NOI18N descriptor.setTitle(NbBundle.getMessage(CreateRefreshAction.class, "MSG_LONG_COMMAND_TITLE")); //NOI18N descriptor.setMessageType(JOptionPane.WARNING_MESSAGE); descriptor.setOptionType(NotifyDescriptor.YES_NO_OPTION); Object res = DialogDisplayer.getDefault().notify(descriptor); if (res == NotifyDescriptor.NO_OPTION) { return; NbBundle.getMessage(CreateRefreshAction.class, "MSG_PATCH_REFRESH_SEP_ONE." + bundleKeyPostfix, patchId)); //NOI18N } else if (!candidates.isEmpty()) {