本文整理匯總了Java中org.openide.NotifyDescriptor.DEFAULT_OPTION屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.DEFAULT_OPTION屬性的具體用法?Java NotifyDescriptor.DEFAULT_OPTION怎麽用?Java NotifyDescriptor.DEFAULT_OPTION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openide.NotifyDescriptor
的用法示例。
在下文中一共展示了NotifyDescriptor.DEFAULT_OPTION屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFileContentsAsByteArray
private static byte[] getFileContentsAsByteArray (File file) throws IOException {
long length = file.length();
if(length > 1024 * 10) {
NotifyDescriptor nd =
new NotifyDescriptor(
NbBundle.getMessage(TemplateSelector.class, "MSG_FileTooBig"),
NbBundle.getMessage(TemplateSelector.class, "LBL_FileTooBig"), // NOI18N
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.WARNING_MESSAGE,
new Object[] {NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION},
NotifyDescriptor.OK_OPTION);
if(DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.OK_OPTION) {
return null;
}
}
return FileUtils.getFileContentsAsByteArray(file);
}
示例2: open
/** Either opens the in text editor or asks user questions.
*/
public void open() {
EditorCookie ic = getCookie(EditorCookie.class);
if (ic != null) {
ic.open();
} else {
// ask a query
List<Object> options = new ArrayList<Object>();
options.add (NotifyDescriptor.OK_OPTION);
options.add (NotifyDescriptor.CANCEL_OPTION);
NotifyDescriptor nd = new NotifyDescriptor (
NbBundle.getMessage (DefaultDataObject.class, "MSG_BinaryFileQuestion"),
NbBundle.getMessage (DefaultDataObject.class, "MSG_BinaryFileWarning"),
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.QUESTION_MESSAGE,
options.toArray(), null
);
Object ret = DialogDisplayer.getDefault().notify (nd);
if (ret != NotifyDescriptor.OK_OPTION) {
return;
}
EditorCookie c = getCookie(EditorCookie.class, true);
c.open ();
}
}
示例3: saveAs
/**
* Invokes a file dialog and if a file is chosen, saves the output to that file.
*/
void saveAs() {
OutWriter out = getOut();
if (out == null) {
return;
}
File f = showFileChooser(this);
if (f != null) {
try {
synchronized (out) {
out.getLines().saveAs(f.getPath());
}
} catch (IOException ioe) {
NotifyDescriptor notifyDesc = new NotifyDescriptor(
NbBundle.getMessage(OutputTab.class, "MSG_SaveAsFailed", f.getPath()),
NbBundle.getMessage(OutputTab.class, "LBL_SaveAsFailedTitle"),
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.ERROR_MESSAGE,
new Object[]{NotifyDescriptor.OK_OPTION},
NotifyDescriptor.OK_OPTION);
DialogDisplayer.getDefault().notify(notifyDesc);
}
}
}
示例4: notifyError
public static void notifyError (String errorLabel, String errorMessage) {
NotifyDescriptor nd = new NotifyDescriptor(
errorMessage,
errorLabel,
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.ERROR_MESSAGE,
new Object[]{NotifyDescriptor.OK_OPTION},
NotifyDescriptor.OK_OPTION);
DialogDisplayer.getDefault().notify(nd);
}
示例5: annotate
public static void annotate (String msg) {
CommandReport report = new CommandReport(NbBundle.getMessage(GitClientExceptionHandler.class, "MSG_SubversionCommandError"), msg); //NOI18N
JButton ok = new JButton(NbBundle.getMessage(GitClientExceptionHandler.class, "CTL_CommandReport_OK")); //NOI18N
NotifyDescriptor descriptor = new NotifyDescriptor(
report,
NbBundle.getMessage(GitClientExceptionHandler.class, "MSG_CommandFailed_Title"), //NOI18N
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.ERROR_MESSAGE,
new Object [] { ok },
ok);
DialogDisplayer.getDefault().notify(descriptor);
}
示例6: notifyImportImpossible
private void notifyImportImpossible(String msg) {
NotifyDescriptor nd =
new NotifyDescriptor(
msg,
NbBundle.getMessage(InitAction.class, "MSG_ImportNotAllowed"), // NOI18N
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.WARNING_MESSAGE,
new Object[] {NotifyDescriptor.OK_OPTION},
NotifyDescriptor.OK_OPTION);
DialogDisplayer.getDefault().notify(nd);
}
示例7: displayErrorMessage
public static void displayErrorMessage(String message) {
NotifyDescriptor ndesc = new NotifyDescriptor(
message,
Utils.getBundle().getString("MSG_ErrorDialogTitle"),
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.ERROR_MESSAGE,
new Object[] { NotifyDescriptor.OK_OPTION },
NotifyDescriptor.OK_OPTION);
DialogDisplayer.getDefault().notify(ndesc);
}
示例8: annotate
public static void annotate(String msg) {
CommandReport report = new CommandReport(NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_SubversionCommandError"), msg);
JButton ok = new JButton(NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_CommandReport_OK"));
NotifyDescriptor descriptor = new NotifyDescriptor(
report,
NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_CommandFailed_Title"),
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.ERROR_MESSAGE,
new Object [] { ok },
ok);
DialogDisplayer.getDefault().notify(descriptor);
}
示例9: notifyImportImpossible
private void notifyImportImpossible(String msg) {
LOG.log(Level.FINE, "Import impossible: {0}", msg);
NotifyDescriptor nd =
new NotifyDescriptor(
msg,
NbBundle.getMessage(ImportAction.class, "MSG_ImportNotAllowed"), // NOI18N
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.WARNING_MESSAGE,
new Object[] {NotifyDescriptor.OK_OPTION},
NotifyDescriptor.OK_OPTION);
DialogDisplayer.getDefault().notify(nd);
}
示例10: notifyErrorMessage
static void notifyErrorMessage(String msg) {
if("true".equals(System.getProperty("netbeans.t9y.throwOnClientError", "false"))) { // NOI18N
Bugzilla.LOG.info(msg);
throw new AssertionError(msg);
}
NotifyDescriptor nd =
new NotifyDescriptor(
msg,
NbBundle.getMessage(BugzillaExecutor.class, "LBLError"), // NOI18N
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.ERROR_MESSAGE,
new Object[] {NotifyDescriptor.OK_OPTION},
NotifyDescriptor.OK_OPTION);
DialogDisplayer.getDefault().notify(nd);
}
示例11: cancelledAction
private void cancelledAction() {
JButton ok = new JButton(NbBundle.getMessage(ExceptionHandler.class, "CTL_Action_OK")); // NOI18N
NotifyDescriptor descriptor = new NotifyDescriptor(
ACTION_CANCELED_BY_USER,
NbBundle.getMessage(ExceptionHandler.class, "CTL_ActionCanceled_Title"), // NOI18N
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.WARNING_MESSAGE,
new Object [] { ok },
ok);
DialogDisplayer.getDefault().notify(descriptor);
return;
}
示例12: notifyParsingError
/**
* Notifies user of parsing error.
*/
public static void notifyParsingError() {
NotifyDescriptor nd = new NotifyDescriptor(
NbBundle.getMessage(HgModuleConfig.class, "MSG_ParsingError"), // NOI18N
NbBundle.getMessage(HgModuleConfig.class, "LBL_ParsingError"), // NOI18N
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.ERROR_MESSAGE,
new Object[]{NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION},
NotifyDescriptor.OK_OPTION);
if (EventQueue.isDispatchThread()) {
DialogDisplayer.getDefault().notify(nd);
} else {
DialogDisplayer.getDefault().notifyLater(nd);
}
}
示例13: notifyImportImpossible
private void notifyImportImpossible(String msg) {
NotifyDescriptor nd =
new NotifyDescriptor(
msg,
NbBundle.getMessage(CreateAction.class, "MSG_ImportNotAllowed"), // NOI18N
NotifyDescriptor.DEFAULT_OPTION,
NotifyDescriptor.WARNING_MESSAGE,
new Object[] {NotifyDescriptor.OK_OPTION},
NotifyDescriptor.OK_OPTION);
DialogDisplayer.getDefault().notify(nd);
}
示例14: notifyError
public static void notifyError (final String title, final String message) {
NotifyDescriptor nd = new NotifyDescriptor(message, title, NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.ERROR_MESSAGE, new Object[] {NotifyDescriptor.OK_OPTION}, NotifyDescriptor.OK_OPTION);
DialogDisplayer.getDefault().notifyLater(nd);
}
示例15: notifyError
private static void notifyError (final String title, final String message) {
NotifyDescriptor nd = new NotifyDescriptor(message, title, NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.ERROR_MESSAGE, new Object[] {NotifyDescriptor.OK_OPTION}, NotifyDescriptor.OK_OPTION);
DialogDisplayer.getDefault().notifyLater(nd);
}