本文整理匯總了Java中org.openide.NotifyDescriptor.YES_NO_CANCEL_OPTION屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.YES_NO_CANCEL_OPTION屬性的具體用法?Java NotifyDescriptor.YES_NO_CANCEL_OPTION怎麽用?Java NotifyDescriptor.YES_NO_CANCEL_OPTION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openide.NotifyDescriptor
的用法示例。
在下文中一共展示了NotifyDescriptor.YES_NO_CANCEL_OPTION屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: importIntoExisting
/**
* Checks if the target folder already exists in the repository.
* If it does exist, user will be asked to confirm the import into the existing folder.
* @param client
* @param repositoryFileUrl
* @return true if the target does not exist or user wishes to import anyway.
*/
private boolean importIntoExisting(SvnClient client, SVNUrl repositoryFileUrl) {
try {
ISVNInfo info = client.getInfo(repositoryFileUrl);
if (info != null) {
// target folder exists, ask user for confirmation
final boolean flags[] = {true};
NotifyDescriptor nd = new NotifyDescriptor(NbBundle.getMessage(ImportStep.class, "MSG_ImportIntoExisting", SvnUtils.decodeToString(repositoryFileUrl)), //NOI18N
NbBundle.getMessage(ImportStep.class, "CTL_TargetFolderExists"), NotifyDescriptor.YES_NO_CANCEL_OPTION, //NOI18N
NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.YES_OPTION);
if (DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.YES_OPTION) {
flags[0] = false;
}
return flags[0];
}
} catch (SVNClientException ex) {
// ignore
}
return true;
}
示例2: onRefresh
@NbBundle.Messages({"MSG_Changed=The query was changed and has to be saved before refresh.",
"LBL_Save=Save",
"LBL_Discard=Discard"})
public void onRefresh() {
if(query.isSaved() && isChanged()) {
NotifyDescriptor desc = new NotifyDescriptor.Confirmation(
Bundle.MSG_Changed(), NotifyDescriptor.YES_NO_CANCEL_OPTION
);
Object[] choose = { Bundle.LBL_Save(), Bundle.LBL_Discard(), NotifyDescriptor.CANCEL_OPTION };
desc.setOptions(choose);
Object ret = DialogDisplayer.getDefault().notify(desc);
if(ret == choose[0]) {
saveQuery(); // persist the parameters
} else if (ret == choose[1]) {
onCancelChanges();
return;
} else {
return;
}
}
refresh(false, false);
}
示例3: searchClassFiles
private void searchClassFiles(File[] folders) throws WizardValidationException {
List<File> classFiles = new ArrayList<File>();
for (File folder : folders) {
findClassFiles(folder, classFiles);
}
if (!classFiles.isEmpty()) {
JButton DELETE_OPTION = new JButton(NbBundle.getMessage(PanelSourceFolders.class, "TXT_DeleteOption")); // NOI18N
JButton KEEP_OPTION = new JButton(NbBundle.getMessage(PanelSourceFolders.class, "TXT_KeepOption")); // NOI18N
JButton CANCEL_OPTION = new JButton(NbBundle.getMessage(PanelSourceFolders.class, "TXT_CancelOption")); // NOI18N
KEEP_OPTION.setMnemonic(NbBundle.getMessage(PanelSourceFolders.class, "MNE_KeepOption").charAt(0)); // NOI18N
DELETE_OPTION.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PanelSourceFolders.class, "AD_DeleteOption")); // NOI18N
KEEP_OPTION.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PanelSourceFolders.class, "AD_KeepOption")); // NOI18N
CANCEL_OPTION.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PanelSourceFolders.class, "AD_CancelOption")); // NOI18N
NotifyDescriptor desc = new NotifyDescriptor(
NbBundle.getMessage(PanelSourceFolders.class, "MSG_FoundClassFiles"), // NOI18N
NbBundle.getMessage(PanelSourceFolders.class, "MSG_FoundClassFiles_Title"), // NOI18N
NotifyDescriptor.YES_NO_CANCEL_OPTION,
NotifyDescriptor.QUESTION_MESSAGE,
new Object[]{DELETE_OPTION, KEEP_OPTION, CANCEL_OPTION},
DELETE_OPTION);
Object result = DialogDisplayer.getDefault().notify(desc);
if (DELETE_OPTION.equals(result)) {
for (File f : classFiles) {
f.delete(); // ignore if fails
}
} else if (!KEEP_OPTION.equals(result)) {
// cancel, back to wizard
throw new WizardValidationException(this.sourcePanel, "", ""); // NOI18N
}
}
}
示例4: canCloseImpl
/** @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;
}
}
示例5: displayServerRunning
private boolean displayServerRunning() {
JButton cancelButton = new JButton();
Mnemonics.setLocalizedText(cancelButton, NbBundle.getMessage(StopManager.class, "StopManager.CancelButton")); // NOI18N
cancelButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(StopManager.class, "StopManager.CancelButtonA11yDesc")); //NOI18N
JButton keepWaitingButton = new JButton();
Mnemonics.setLocalizedText(keepWaitingButton, NbBundle.getMessage(StopManager.class, "StopManager.KeepWaitingButton")); // NOI18N
keepWaitingButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(StopManager.class, "StopManager.KeepWaitingButtonA11yDesc")); //NOI18N
JButton propsButton = new JButton();
Mnemonics.setLocalizedText(propsButton, NbBundle.getMessage(StopManager.class, "StopManager.PropsButton")); // NOI18N
propsButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(StopManager.class, "StopManager.PropsButtonA11yDesc")); //NOI18N
String message = NbBundle.getMessage(StopManager.class, "MSG_ServerStillRunning");
final NotifyDescriptor ndesc = new NotifyDescriptor(message,
NbBundle.getMessage(StopManager.class, "StopManager.ServerStillRunningTitle"),
NotifyDescriptor.YES_NO_CANCEL_OPTION,
NotifyDescriptor.QUESTION_MESSAGE,
new Object[] {keepWaitingButton, propsButton, cancelButton},
NotifyDescriptor.CANCEL_OPTION); //NOI18N
Object ret = Mutex.EVENT.readAccess(new Action<Object>() {
@Override
public Object run() {
return DialogDisplayer.getDefault().notify(ndesc);
}
});
if (cancelButton.equals(ret)) {
stopRequested.set(false);
return false;
} else if (keepWaitingButton.equals(ret)) {
return true;
} else {
displayAdminProperties(server);
return false;
}
}
示例6: showChangeEncodingDialog
private Object showChangeEncodingDialog(String encoding) {
String message = NbBundle.getMessage(Utils.class, "TEXT_CHANGE_DECLARED_ENCODING", encoding,
encodingHelper.getEncoding());
NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(message, getPrimaryFile().getPath(),
NotifyDescriptor.YES_NO_CANCEL_OPTION);
return 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: resolveCloseOperation
@Override
public boolean resolveCloseOperation(CloseOperationState[] elements) {
for (int i = 0; i < elements.length; i++) {
CloseOperationState element = elements[i];
if (ToolBarDesignEditor.PROPERTY_FLUSH_DATA.equals(element.getCloseWarningID())) {
return false;
}
}
if (dObj.isModified()) {
XmlMultiViewEditorSupport support = dObj.getEditorSupport();
String msg = support.messageSave();
java.util.ResourceBundle bundle =
org.openide.util.NbBundle.getBundle(org.openide.text.CloneableEditorSupport.class);
javax.swing.JButton saveOption = new javax.swing.JButton(bundle.getString("CTL_Save")); // NOI18N
saveOption.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_CTL_Save")); // NOI18N
saveOption.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_CTL_Save")); // NOI18N
javax.swing.JButton discardOption = new javax.swing.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 = org.openide.DialogDisplayer.getDefault().notify(nd);
if (NotifyDescriptor.CANCEL_OPTION.equals(ret) || NotifyDescriptor.CLOSED_OPTION.equals(ret)) {
return false;
}
if (saveOption.equals(ret)) {
try {
if (dObj.acceptEncoding() && dObj.verifyDocumentBeforeClose() ) {
dObj.getEditorSupport().onCloseSave();
} else {
return false;
}
} catch (java.io.IOException e) {
org.openide.ErrorManager.getDefault().notify(e);
return false;
}
} else if (discardOption.equals(ret)) {
dObj.getEditorSupport().onCloseDiscard();
}
}
return true;
}