本文整理匯總了Java中org.openide.NotifyDescriptor.NO_OPTION屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.NO_OPTION屬性的具體用法?Java NotifyDescriptor.NO_OPTION怎麽用?Java NotifyDescriptor.NO_OPTION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openide.NotifyDescriptor
的用法示例。
在下文中一共展示了NotifyDescriptor.NO_OPTION屬性的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testExceptionThrownWhenDocumentIsBeingReadNo
public void testExceptionThrownWhenDocumentIsBeingReadNo () throws Exception {
MyEx my = new MyEx();
toThrow = my;
DD.options = null;
DD.toReturn = NotifyDescriptor.NO_OPTION;
support.open ();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JEditorPane[] panes = support.getOpenedPanes();
assertNull(panes);
}
});
}
示例2: tearDown
@Override
protected void tearDown() throws Exception {
waitForAWT();
DD.disableTest = true;
super.tearDown();
if (obj != null) {
CloseCookie cc;
cc = obj.getCookie(CloseCookie.class);
if (cc != null) {
DD.toReturn = NotifyDescriptor.NO_OPTION;
cc.close();
}
}
waitForAWT();
}
示例3: tearDown
protected void tearDown() throws Exception {
waitForAWT();
DD.disableTest = true;
super.tearDown();
if (obj != null) {
CloseCookie cc;
cc = obj.getCookie(CloseCookie.class);
if (cc != null) {
DD.toReturn = NotifyDescriptor.NO_OPTION;
cc.close();
}
}
Repository.getDefault().removeFileSystem(lfs);
waitForAWT();
}
示例4: stringToNDOption
private static Object stringToNDOption(String string) {
if (string == null) {
return null;
}
if (string.equals("CANCEL_OPTION")) { //NOI18N
return NotifyDescriptor.CANCEL_OPTION;
} else if (string.equals("CLOSED_OPTION")) { //NOI18N
return NotifyDescriptor.CLOSED_OPTION;
} else if (string.equals("NO_OPTION")) { //NOI18N
return NotifyDescriptor.NO_OPTION;
} else if (string.equals("OK_OPTION")) { //NOI18N
return NotifyDescriptor.OK_OPTION;
} else if (string.equals("YES_OPTION")) { //NOI18N
return NotifyDescriptor.YES_OPTION;
}
return null;
}
示例5: selectPatch
@NbBundle.Messages({
"LBL_FetchAction.appliedPatches.title=Mercurial Patches applied",
"MSG_FetchAction.appliedPatches.text=You have applied patches from the active Mercurial queue.\n\n"
+ "Do you want to pop them first before the operation\nstarts and apply them right after it finishes?"
})
static QPatch selectPatch (File root) throws HgException {
QPatch[] patches = HgCommand.qListSeries(root);
QPatch topPatch = null;
for (QPatch patch : patches) {
if (patch.isApplied()) {
topPatch = patch;
}
}
if (topPatch != null) {
Object conf = DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation(
Bundle.MSG_FetchAction_appliedPatches_text(),
Bundle.LBL_FetchAction_appliedPatches_title(),
NotifyDescriptor.YES_NO_CANCEL_OPTION, NotifyDescriptor.WARNING_MESSAGE));
if (conf == NotifyDescriptor.CANCEL_OPTION) {
throw new HgException.HgCommandCanceledException("Canceled"); //NOI18N
} else if (conf == NotifyDescriptor.NO_OPTION) {
topPatch = null;
}
}
return topPatch;
}
示例6: confirm
private boolean confirm (String title, String message) {
NotifyHtmlPanel p = new NotifyHtmlPanel();
p.setText(message);
NotifyDescriptor descriptor = new NotifyDescriptor(
p,
title,
NotifyDescriptor.OK_CANCEL_OPTION,
NotifyDescriptor.QUESTION_MESSAGE,
new Object [] { NotifyDescriptor.YES_OPTION, NotifyDescriptor.NO_OPTION },
NotifyDescriptor.YES_OPTION);
return NotifyDescriptor.YES_OPTION == DialogDisplayer.getDefault().notify(descriptor);
}
示例7: displayConfirmation
@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;
}
示例8: displayConfirmationDNSA
@Override
public Boolean displayConfirmationDNSA(String message, String caption, String dnsaMessage, boolean cancellable, String key, boolean dnsaDefault) {
ProfilerDialogs.DNSAConfirmation dnsa = new ProfilerDialogs.DNSAConfirmation(
key, message, cancellable ? NotifyDescriptor.YES_NO_CANCEL_OPTION : NotifyDescriptor.YES_NO_OPTION);
if (caption != null) dnsa.setTitle(caption);
if (dnsaMessage != null) dnsa.setDNSAMessage(dnsaMessage);
dnsa.setDNSADefault(dnsaDefault);
Object ret = ProfilerDialogs.notify(dnsa);
if (ret == NotifyDescriptor.YES_OPTION) return Boolean.TRUE;
if (ret == NotifyDescriptor.NO_OPTION) return Boolean.FALSE;
return null;
}
示例9: ndOptionToString
private static String ndOptionToString(Object option) {
if (option == NotifyDescriptor.CANCEL_OPTION) {
return "CANCEL_OPTION"; // NOI18N
} else if (option == NotifyDescriptor.CLOSED_OPTION) {
return "CLOSED_OPTION"; // NOI18N
} else if (option == NotifyDescriptor.NO_OPTION) {
return "NO_OPTION"; // NOI18N
} else if (option == NotifyDescriptor.OK_OPTION) {
return "OK_OPTION"; // NOI18N
} else if (option == NotifyDescriptor.YES_OPTION) {
return "YES_OPTION"; // NOI18N
}
return null;
}
示例10: doExceptionThrownWhenDocumentIsBeingRead1Start
private void doExceptionThrownWhenDocumentIsBeingRead1Start (MyEx my) throws Exception {
toThrow = my;
DD.toReturn = NotifyDescriptor.NO_OPTION;
support.open();
}
示例11: doExceptionThrownWhenDocumentIsBeingRead
private void doExceptionThrownWhenDocumentIsBeingRead () throws Exception {
class MyEx extends UserQuestionException {
private int confirmed;
public @Override String getLocalizedMessage() {
return "locmsg";
}
public @Override String getMessage() {
return "msg";
}
public void confirmed () {
confirmed++;
toThrow = null;
}
}
MyEx my = new MyEx ();
toThrow = my;
DD.toReturn = NotifyDescriptor.NO_OPTION;
support.open ();
if (!SwingUtilities.isEventDispatchThread ()) {
javax.swing.SwingUtilities.invokeAndWait (new Runnable () { public void run () {} });
}
assertNotNull ("Some otions", DD.options);
assertEquals ("Two options", 2, DD.options.length);
assertEquals ("Yes", NotifyDescriptor.YES_OPTION, DD.options[0]);
assertEquals ("No", NotifyDescriptor.NO_OPTION, DD.options[1]);
assertEquals ("confirmed not called", 0, my.confirmed);
assertNull ("Still no document", support.getDocument ());
DD.options = null;
DD.toReturn = NotifyDescriptor.YES_OPTION;
support.open ();
if (!SwingUtilities.isEventDispatchThread ()) {
javax.swing.SwingUtilities.invokeAndWait (new Runnable () { public void run () {} });
}
assertEquals ("confirmed called", 1, my.confirmed);
assertNotNull ("Some otions", DD.options);
assertEquals ("Two options", 2, DD.options.length);
assertEquals ("Yes", NotifyDescriptor.YES_OPTION, DD.options[0]);
assertEquals ("No", NotifyDescriptor.NO_OPTION, DD.options[1]);
DD.options = null;
assertNotNull ("Document opened", support.getDocument ());
}
示例12: allowAccess
/** Requests access for address addr. If necessary asks the user. Returns true it the access
* has been granted. */
boolean allowAccess(InetAddress addr, String requestPath) {
if (accessAllowedNow(addr, requestPath))
return true;
Thread askThread = null;
synchronized (whoAsking) {
// one more test in the synchronized block
if (accessAllowedNow(addr, requestPath))
return true;
askThread = (Thread)whoAsking.get(addr);
if (askThread == null) {
askThread = Thread.currentThread();
whoAsking.put(addr, askThread);
}
}
// now ask the user
synchronized (HttpServerSettings.class) {
if (askThread != Thread.currentThread()) {
return accessAllowedNow(addr, requestPath);
}
try {
if (!isShowGrantAccessDialog ())
return false;
String msg = NbBundle.getMessage (HttpServerSettings.class, "MSG_AddAddress", addr.getHostAddress ());
final GrantAccessPanel panel = new GrantAccessPanel (msg);
DialogDescriptor descriptor = new DialogDescriptor (
panel,
NbBundle.getMessage (HttpServerSettings.class, "CTL_GrantAccessTitle"),
true,
NotifyDescriptor.YES_NO_OPTION,
NotifyDescriptor.NO_OPTION,
null
);
descriptor.setMessageType (NotifyDescriptor.QUESTION_MESSAGE);
// descriptor.setOptionsAlign (DialogDescriptor.BOTTOM_ALIGN);
final Dialog d = DialogDisplayer.getDefault ().createDialog (descriptor);
d.setSize (580, 180);
d.setVisible(true);
setShowGrantAccessDialog (panel.getShowDialog ());
if (NotifyDescriptor.YES_OPTION.equals(descriptor.getValue ())) {
appendAddressToGranted(addr.getHostAddress());
return true;
}
else
return false;
}
finally {
whoAsking.remove(addr);
}
} // end synchronized
}
示例13: showYesAllDialog
private static Object showYesAllDialog(Object msg, String title) {
NotifyDescriptor nd = new NotifyDescriptor(msg, title, NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.NO_OPTION);
DialogDisplayer.getDefault().notify(nd);
return nd.getValue();
}