本文整理匯總了Java中org.openide.NotifyDescriptor.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.getValue方法的具體用法?Java NotifyDescriptor.getValue怎麽用?Java NotifyDescriptor.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.NotifyDescriptor
的用法示例。
在下文中一共展示了NotifyDescriptor.getValue方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkCharsetConversion
import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
private boolean checkCharsetConversion(final String encoding) {
boolean value = true;
try {
CharsetEncoder coder = Charset.forName(encoding).newEncoder();
if (!coder.canEncode(getDocument().getText(0, getDocument().getLength()))){
NotifyDescriptor nd = new NotifyDescriptor.Confirmation(
NbBundle.getMessage(XmlMultiViewEditorSupport.class, "MSG_BadCharConversion",
new Object [] { getDataObject().getPrimaryFile().getNameExt(),
encoding}),
NotifyDescriptor.YES_NO_OPTION,
NotifyDescriptor.WARNING_MESSAGE);
nd.setValue(NotifyDescriptor.NO_OPTION);
DialogDisplayer.getDefault().notify(nd);
if(nd.getValue() != NotifyDescriptor.YES_OPTION) {
value = false;
}
}
} catch (BadLocationException e){
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
}
return value;
}
示例2: big
import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@NbBundle.Messages({
"TTL_ContextView_showBigFile=Show Big File?",
"# {0} - file name",
"# {1} - file size in kilobytes",
"MSG_ContextView_showBigFile=File {0} is quite big ({1} kB).\n"
+ "Showing it can cause memory and performance problems.\n"
+ "Do you want to show content of this file?",
"LBL_ContextView_Show=Show",
"LBL_ContextView_Skip=Do Not Show",
"LBL_ContextView_ApplyAll=Apply to all big files"
})
private void approveFetchingOfBigFile(final MatchingObject mo,
final int partIndex) {
FileObject fo = mo.getFileObject();
long fileSize = fo.getSize() / 1024;
JButton showButton = new JButton(Bundle.LBL_ContextView_Show());
JButton skipButton = new JButton(Bundle.LBL_ContextView_Skip());
JCheckBox all = new JCheckBox(Bundle.LBL_ContextView_ApplyAll());
all.setSelected(approveApplyToAllSelected);
JPanel allPanel = new JPanel();
allPanel.add(all); //Add to panel not to be handled as standard button.
NotifyDescriptor nd = new NotifyDescriptor(
Bundle.MSG_ContextView_showBigFile(
fo.getNameExt(), fileSize),
Bundle.TTL_ContextView_showBigFile(),
NotifyDescriptor.YES_NO_OPTION,
NotifyDescriptor.WARNING_MESSAGE,
new Object[]{skipButton, showButton},
lastApproveOption ? showButton : skipButton);
nd.setAdditionalOptions(new Object[]{allPanel});
DialogDisplayer.getDefault().notify(nd);
boolean app = nd.getValue() == showButton;
APPROVED_FILES.put(fo, app);
if (all.isSelected()) {
allApproved = app;
}
approveApplyToAllSelected = all.isSelected();
lastApproveOption = app;
displayFile(mo, partIndex);
}
示例3: printWarning
import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
public static boolean printWarning(String message) {
NotifyDescriptor confirm = new NotifyDescriptor.Confirmation(message, NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(confirm);
return confirm.getValue() == NotifyDescriptor.YES_OPTION;
}
示例4: requestUpdate
import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
private boolean requestUpdate(String id) {
NotifyDescriptor desc = new NotifyDescriptor.Confirmation(
NbBundle.getMessage(UserXMLCatalog.class,"TXT_updateEntry",id),NotifyDescriptor.YES_NO_OPTION);
DialogDisplayer.getDefault().notify(desc);
return (NotifyDescriptor.YES_OPTION==desc.getValue());
}
示例5: showYesAllDialog
import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
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();
}