本文整理匯總了Java中org.openide.NotifyDescriptor.WARNING_MESSAGE屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.WARNING_MESSAGE屬性的具體用法?Java NotifyDescriptor.WARNING_MESSAGE怎麽用?Java NotifyDescriptor.WARNING_MESSAGE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openide.NotifyDescriptor
的用法示例。
在下文中一共展示了NotifyDescriptor.WARNING_MESSAGE屬性的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: checkCharsetConversion
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;
}
示例3: setValue
@Override
public void setValue(Object val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
try {
getDataObject().getPrimaryFile().setAttribute(PROPERTY_ENCODING, val);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
PropertiesEditorSupport propertiesEditor = getPropertiesFileEntry().getPropertiesEditor();
propertiesEditor.resetCharset();
if (propertiesEditor.hasOpenedEditorComponent()) {
NotifyDescriptor.Message message = new NotifyDescriptor.Message(
NbBundle.getMessage(PropertiesDataNode.class, "PROP_ENCODING_Warning", PropertiesDataNode.this.getDisplayName()),
NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(message);
propertiesEditor.close();
}
}
示例4: displayErrorOpenImage
private void displayErrorOpenImage(String messageProperty) {
DialogDisplayer dd = DialogDisplayer.getDefault();
String messageMsg = NbBundle.getMessage(BlobFieldTableCellEditor.class,
messageProperty);
String titleMsg = NbBundle.getMessage(BlobFieldTableCellEditor.class,
"openImageError.title"); //NOI18N
NotifyDescriptor nd = new NotifyDescriptor(
messageMsg,
titleMsg,
NotifyDescriptor.OK_CANCEL_OPTION,
NotifyDescriptor.WARNING_MESSAGE,
new Object[]{NotifyDescriptor.CANCEL_OPTION},
NotifyDescriptor.CANCEL_OPTION);
dd.notifyLater(nd);
}
示例5: big
@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);
}
示例6: viewCanBeDisplayed
/**
* Checks whether the preferred view can be displayed and switches to the
* xml view and displays an appropriate warning if not. In case that
* the preferred view is the design view, it
* can be displayed if <ol><li>document is valid (parseable) and</li>
*<li>the target server is attached></li></ol>.
*@return true if the preferred view can be displayed, false otherwise.
*/
public boolean viewCanBeDisplayed() {
boolean switchView = false;
NotifyDescriptor nd = null;
if(FileOwnerQuery.getOwner(getPrimaryFile())==null) {
nd = new org.openide.NotifyDescriptor.Message(
NbBundle.getMessage(PUDataObject.class, "TXT_StandAlonePersistence",
getPrimaryFile().getNameExt()), NotifyDescriptor.WARNING_MESSAGE);
switchView = true;
} else if (!parseDocument() && getSelectedPerspective().preferredID().startsWith(DESIGN_VIEW_ID)) {
nd = new org.openide.NotifyDescriptor.Message(
NbBundle.getMessage(PUDataObject.class, "TXT_DocumentUnparsable",
getPrimaryFile().getNameExt()), NotifyDescriptor.WARNING_MESSAGE);
switchView = true;
} else if (!ProviderUtil.isValidServerInstanceOrNone(FileOwnerQuery.getOwner(getPrimaryFile()))
&& getSelectedPerspective().preferredID().startsWith(DESIGN_VIEW_ID)){
nd = new org.openide.NotifyDescriptor.Message(
NbBundle.getMessage(PUDataObject.class, "TXT_ServerMissing"),
NotifyDescriptor.WARNING_MESSAGE);
switchView = true;
}
if (switchView){
DialogDisplayer.getDefault().notify(nd);
// postpone the "Switch to XML View" action to the end of event dispatching thread
// this enables to finish the current action first (e.g. painting particular view)
// see the issue 67580
SwingUtilities.invokeLater(new Runnable(){
@Override
public void run() {
goToXmlView();
}
});
}
return !switchView;
}
示例7: 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);
}
示例8: 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);
}
示例9: getMessageTypeDescription
private static String getMessageTypeDescription(int messageType) {
switch(messageType) {
case NotifyDescriptor.ERROR_MESSAGE:
return NbBundle.getBundle(NbPresenter.class).getString("ACSD_ErrorMessage"); // NOI18N
case NotifyDescriptor.WARNING_MESSAGE:
return NbBundle.getBundle(NbPresenter.class).getString("ACSD_WarningMessage"); // NOI18N
case NotifyDescriptor.QUESTION_MESSAGE:
return NbBundle.getBundle(NbPresenter.class).getString("ACSD_QuestionMessage"); // NOI18N
case NotifyDescriptor.INFORMATION_MESSAGE:
return NbBundle.getBundle(NbPresenter.class).getString("ACSD_InformationMessage"); // NOI18N
case NotifyDescriptor.PLAIN_MESSAGE:
return NbBundle.getBundle(NbPresenter.class).getString("ACSD_PlainMessage"); // NOI18N
}
return ""; // NOI18N
}
示例10: viewCanBeDisplayed
/**
* Checks whether the preferred view can be displayed and switches to the
* xml view and displays an appropriate warning if not. In case that
* the preferred view is the design view, it
* can be displayed if <ol><li>document is valid (parseable) and</li>
*<li>the target server is attached></li></ol>.
*@return true if the preferred view can be displayed, false otherwise.
*/
public boolean viewCanBeDisplayed() {
boolean switchView = false;
NotifyDescriptor nd = null;
if (!parseDocument() && getSelectedPerspective().preferredID().startsWith(DESIGN_VIEW_ID)) {
nd = new org.openide.NotifyDescriptor.Message(
NbBundle.getMessage(HibernateCfgDataObject.class, "TXT_DocumentUnparsable",
getPrimaryFile().getNameExt()), NotifyDescriptor.WARNING_MESSAGE);
switchView = true;
}
if (switchView){
DialogDisplayer.getDefault().notify(nd);
// postpone the "Switch to XML View" action to the end of event dispatching thread
// this enables to finish the current action first (e.g. painting particular view)
// see the issue 67580
SwingUtilities.invokeLater(new Runnable(){
@Override
public void run() {
goToXmlView();
}
});
}
return !switchView;
}
示例11: showCustomizer
@Override
@NbBundle.Messages("MSG_CustomizerForbidden=The customizer is disabled, using it would revert manual changes done to the nbproject/project.xml file.")
public void showCustomizer() {
AuxiliaryProperties props = project.getLookup().lookup(AuxiliaryProperties.class);
String show = props.get("show.customizer", true);
if (show != null && "false".equals(show)) {
String message = props.get("show.customizer.message", true);
if (message == null) {
message = MSG_CustomizerForbidden();
}
NotifyDescriptor nd = new NotifyDescriptor.Message(message, NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notify(nd);
return;
}
Dialog dialog = project2Dialog.get (project);
if ( dialog != null ) {
dialog.setVisible(true);
}
else {
InstanceContent ic = new InstanceContent();
Lookup context = new AbstractLookup(ic);
ic.add(project);
ic.add(project.getLookup().lookup(ProjectAccessor.class));
ic.add(project.getLookup().lookup(AuxiliaryConfiguration.class));
//TODO replace with generic apis..
ic.add(ic);
OptionListener listener = new OptionListener();
dialog = ProjectCustomizer.createCustomizerDialog(CUSTOMIZER_FOLDER_PATH, context, null, listener, null );
dialog.addWindowListener( listener );
dialog.setTitle( MessageFormat.format(
NbBundle.getMessage( ProjectCustomizerProvider.class, "LBL_Customizer_Title" ), // NOI18N
new Object[] { ProjectUtils.getInformation(project).getDisplayName() } ) );
project2Dialog.put(project, dialog);
dialog.setVisible(true);
}
}
示例12: toNotifyDesctiptor
private static int toNotifyDesctiptor(Descriptor type) {
switch (type) {
case ERROR:
return NotifyDescriptor.ERROR_MESSAGE;
case WARNING:
return NotifyDescriptor.WARNING_MESSAGE;
default:
return NotifyDescriptor.WARNING_MESSAGE;
}
}
示例13: 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;
}
示例14: 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);
}
示例15: ungrabWindow
private boolean ungrabWindow(final ThreadReference tr,
final ObjectReference grabbedWindow,
int timeout,
final TOOLKIT tkt) {
final boolean[] success = new boolean[] { false };
Task task = debugger.getRequestProcessor().create(new Runnable() {
@Override
public void run() {
switch (tkt) {
case AWT:
success[0] = ungrabWindowAWT(tr, grabbedWindow);
break;
case JAVAFX:
ungrabWindowFX(tr);
success[0] = true; // Be always successful in FX.
break;
}
}
});
JPDAThreadImpl thread = debugger.getThread(tr);
try {
thread.notifyMethodInvoking();
task.schedule(0);
task.waitFinished(timeout);
} catch (PropertyVetoException pvex) {
logger.log(Level.INFO, "Method invoke vetoed", pvex);
thread = null;
} catch (InterruptedException ex) {
} finally {
if (thread != null) {
thread.notifyMethodInvokeDone();
}
}
if (!task.isFinished()) {
// Something went wrong during ungrab. Maybe a deadlock?
// We can not do anything but kill the debugger session to resolve the problem.
debugger.finish();
NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(AWTGrabHandler.class, "MSG_GrabNotReleasedDbgKilled"), NotifyDescriptor.WARNING_MESSAGE);
DialogDisplayer.getDefault().notifyLater(nd);
return true; // "success" by terminating the debugger session
}
return success[0];
}