本文整理匯總了Java中org.openide.NotifyDescriptor.CANCEL_OPTION屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.CANCEL_OPTION屬性的具體用法?Java NotifyDescriptor.CANCEL_OPTION怎麽用?Java NotifyDescriptor.CANCEL_OPTION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openide.NotifyDescriptor
的用法示例。
在下文中一共展示了NotifyDescriptor.CANCEL_OPTION屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testDefaultOptionWithStandardOk
public void testDefaultOptionWithStandardOk () {
JButton testButton = new JButton ("for-test-only");
DialogDescriptor dd = new DialogDescriptor (
"Hello", // innerPane
"title", // title
false, // isModal
new Object[] { NotifyDescriptor.CANCEL_OPTION, NotifyDescriptor.OK_OPTION }, // options
NotifyDescriptor.OK_OPTION, // initialValue
DialogDescriptor.DEFAULT_ALIGN, // optionsAlign
HelpCtx.DEFAULT_HELP, // help
null); // action listener
dd.setAdditionalOptions (new JButton[] {testButton});
Dialog dlg = DialogDisplayer.getDefault ().createDialog (dd);
//dlg.setVisible (true);
assertEquals ("OK_OPTION is the default value.", NotifyDescriptor.OK_OPTION, dd.getDefaultValue ());
assertEquals ("OK_OPTION is the default button on dialog",
NbBundle.getBundle (NbPresenter.class).getString ("OK_OPTION_CAPTION"),
testButton.getRootPane ().getDefaultButton ().getText ());
//dlg.dispose ();
}
示例2: testDefaultOptionWithStandardCancel
public void testDefaultOptionWithStandardCancel () {
JButton testButton = new JButton ("for-test-only");
DialogDescriptor dd = new DialogDescriptor (
"Hello", // innerPane
"title", // title
false, // isModal
new Object[] { NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION }, // options
NotifyDescriptor.CANCEL_OPTION, // initialValue
DialogDescriptor.DEFAULT_ALIGN, // optionsAlign
HelpCtx.DEFAULT_HELP, // help
null); // action listener
dd.setAdditionalOptions (new JButton[] {testButton});
Dialog dlg = DialogDisplayer.getDefault ().createDialog (dd);
//dlg.setVisible (true);
assertEquals ("CANCEL_OPTION is the default value.", NotifyDescriptor.CANCEL_OPTION, dd.getDefaultValue ());
assertEquals ("CANCEL_OPTION is the default button on dialog",
NbBundle.getBundle (NbPresenter.class).getString ("CANCEL_OPTION_CAPTION"),
testButton.getRootPane ().getDefaultButton ().getText ());
//dlg.dispose ();
}
示例3: 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;
}
示例4: showAddDialog
/**
* Displays Add Cluster dialog and lets user select path to external cluster.
*
* @param prj Project into which the path will be stored. Returned path is relative to the project dir if possible.
* @return Info for newly added cluster or null if user cancelled the dialog.
*/
static ClusterInfo showAddDialog(Project prj) {
EditClusterPanel panel = new EditClusterPanel();
panel.prjDir = FileUtil.toFile(prj.getProjectDirectory());
panel.prj = prj;
SourceRootsSupport srs = new SourceRootsSupport(new URL[0], null);
panel.sourcesPanel.setSourceRootsProvider(srs);
JavadocRootsSupport jrs = new JavadocRootsSupport(new URL[0], null);
panel.javadocPanel.setJavadocRootsProvider(jrs);
DialogDescriptor descriptor = new DialogDescriptor(
panel,
NbBundle.getMessage(EditClusterPanel.class, "CTL_AddCluster_Title"), // NOI18N
true,
new Object[] { panel.okButton, NotifyDescriptor.CANCEL_OPTION },
panel.okButton,
DialogDescriptor.DEFAULT_ALIGN,
new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditClusterPanel"),
null);
descriptor.setClosingOptions(null);
Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
panel.updateDialog();
dlg.setVisible(true);
ClusterInfo retVal = null;
if (descriptor.getValue() == panel.okButton) {
retVal = ClusterInfo.createExternal(panel.getAbsoluteClusterPath(),
srs.getSourceRoots(), jrs.getJavadocRoots(), true);
}
dlg.dispose();
return retVal;
}
示例5: showEditDialog
/**
* Shows Edit Cluster dialog for existing external cluster.
* Browse button is disabled, user can only change src and javadoc.
*
* @param ci Original cluster info
* @return Updated cluster info or null if user cancelled the dialog
*/
static ClusterInfo showEditDialog(ClusterInfo ci, Project prj) {
EditClusterPanel panel = new EditClusterPanel();
panel.prjDir = FileUtil.toFile(prj.getProjectDirectory());
panel.prj = prj;
SourceRootsSupport srs = new SourceRootsSupport(
ci.getSourceRoots() == null ? new URL[0] : ci.getSourceRoots(), null);
panel.sourcesPanel.setSourceRootsProvider(srs);
JavadocRootsSupport jrs = new JavadocRootsSupport(
ci.getJavadocRoots() == null ? new URL[0] : ci.getJavadocRoots(), null);
panel.javadocPanel.setJavadocRootsProvider(jrs);
DialogDescriptor descriptor = new DialogDescriptor(
panel,
NbBundle.getMessage(EditClusterPanel.class, "CTL_EditCluster_Title"), // NOI18N
true,
new Object[] { panel.okButton, NotifyDescriptor.CANCEL_OPTION },
panel.okButton,
DialogDescriptor.DEFAULT_ALIGN,
new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditClusterPanel"),
null);
descriptor.setClosingOptions(null);
Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
panel.clusterDirText.setText(ci.getClusterDir().toString());
panel.updateDialog();
panel.browseButton.setEnabled(false);
dlg.setVisible(true);
ClusterInfo retVal = null;
if (descriptor.getValue() == panel.okButton) {
retVal = ClusterInfo.createExternal(panel.getAbsoluteClusterPath(),
srs.getSourceRoots(), jrs.getJavadocRoots(), true);
}
dlg.dispose();
return retVal;
}
示例6: 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);
}
}
示例7: 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;
}
}
示例8: storeSettings
@Override
public void storeSettings(WizardDescriptor wd) {
Object value = wd.getValue();
if ( NotifyDescriptor.CANCEL_OPTION != value &&
NotifyDescriptor.CLOSED_OPTION != value ) {
try {
Project newProject = gui.getProject ();
project = newProject;
wd.putProperty(ProjectChooserFactory.WIZARD_KEY_PROJECT, newProject);
if (gui.getTemplate () == null) {
return ;
}
if (wd instanceof TemplateWizard) {
((TemplateWizard)wd).setTemplate( DataObject.find( gui.getTemplate() ) );
} else {
wd.putProperty( ProjectChooserFactory.WIZARD_KEY_TEMPLATE, gui.getTemplate () );
}
}
catch( DataObjectNotFoundException e ) {
ErrorManager.getDefault().notify (e);
}
}
}
示例9: 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;
}
}
示例10: uninitialize
@Override
public void uninitialize(TemplateWizard wiz) {
if (wiz.getValue() == NotifyDescriptor.CANCEL_OPTION) {
((DBSchemaTablesPanel) panels[2].getComponent()).uninit();
}
panels = null;
myData = null;
guiInitialized = false;
}
示例11: AddQueryParameterDlg
/** Creates new form AddQueryParameterDlg */
public AddQueryParameterDlg(boolean modal, String columnName) {
initComponents();
// try to make it so that the default information in the field is pre-selected so that the user
// can simply type over it without having to select it.
valueTxtField.setSelectionEnd(valueTxtField.getText().length());
parmTxtField.setSelectionStart(0);
parmTxtField.setSelectionEnd(parmTxtField.getText().length());
ActionListener listener = new ActionListener () {
public void actionPerformed (ActionEvent evt) {
Object o = evt.getSource();
if (o == NotifyDescriptor.CANCEL_OPTION) {
returnStatus = RET_CANCEL;
} else if (o == NotifyDescriptor.OK_OPTION) {
// do something useful
returnStatus = RET_OK;
} // else if HELP ...
}
};
// Note - we may want to use the version that also has help (check with Jeff)
DialogDescriptor dlg =
new DialogDescriptor(this,
NbBundle.getMessage(AddQueryParameterDlg.class,
"ADD_QUERY_CRITERIA_TITLE"), // NOI18N
modal, listener);
dlg.setHelpCtx (
new HelpCtx( "projrave_ui_elements_dialogs_add_query_criteria" ) ); // NOI18N
setColumnName(columnName);
dialog = DialogDisplayer.getDefault().createDialog(dlg);
dialog.setVisible(true);
}
示例12: run
@NbBundle.Messages({ "TTL_AfterRestartReport=Unexpected Exception on Last Run",
"MSG_AfterRestartReportQuestion=There was an error during the last run of NetBeans IDE.\nCan you please report the problem?",
"BTN_ReviewAndReport=&Review and Report Problem" })
@Override
public void run() {
final Set<LogRecord> records = afterRestartRecords;
String msg = Bundle.MSG_AfterRestartReportQuestion();
String title = Bundle.TTL_AfterRestartReport();
int optionType = NotifyDescriptor.QUESTION_MESSAGE;
JButton reportOption = new JButton();
Mnemonics.setLocalizedText(reportOption, Bundle.BTN_ReviewAndReport());
NotifyDescriptor confMessage = new NotifyDescriptor(msg, title, optionType,
NotifyDescriptor.QUESTION_MESSAGE,
new Object[] { reportOption, NotifyDescriptor.CANCEL_OPTION },
reportOption);
Object ret = DialogDisplayer.getDefault().notify(confMessage);
if (ret == reportOption) {
Installer.RP.post(new Runnable() {
@Override
public void run() {
Installer.displaySummary("ERROR_URL", true, false, true,
Installer.DataType.DATA_UIGESTURE,
new ArrayList<>(records), null, true);
Installer.setSelectedExcParams(null);
afterRestartRecords = null;
}
});
}
}
示例13: notifyHtmlMessage
private static boolean notifyHtmlMessage(String html, BugzillaRepository repository, boolean htmlTextIsAllYouGot) throws MissingResourceException {
if (html != null && !html.trim().equals("")) { // NOI18N
html = parseHtmlMessage(html, htmlTextIsAllYouGot);
if(html == null) {
return false;
}
final HtmlPanel p = new HtmlPanel();
String label = NbBundle.getMessage(
BugzillaExecutor.class,
"MSG_ServerResponse", // NOI18N
new Object[] { repository.getDisplayName() }
);
p.setHtml(repository.getUrl(), html, label);
DialogDescriptor dialogDescriptor =
new DialogDescriptor(
p,
NbBundle.getMessage(BugzillaExecutor.class, "CTL_ServerResponse"), // NOI18N
true,
new Object[] { NotifyDescriptor.CANCEL_OPTION },
NotifyDescriptor.CANCEL_OPTION,
DialogDescriptor.DEFAULT_ALIGN,
new HelpCtx(p.getClass()),
null
);
DialogDisplayer.getDefault().notify(dialogDescriptor);
return true;
}
return false;
}
示例14: innerShowDialog
/** Opens the ExitDialog for activated nodes or for
* whole repository.
*/
private static boolean innerShowDialog (Set<DataObject> openedFiles) {
if (!openedFiles.isEmpty()) {
if (SAVE_ALL_UNCONDITIONALLY) {
//this section should be invoked only by tests!
for (DataObject d: openedFiles) {
doSave(d);
}
return true;
}
// XXX(-ttran) caching this dialog is fatal. If the user
// cancels the Exit action, modifies some more files and tries to
// Exit again the list of modified DataObject's is not updated,
// changes made by the user after the first aborted Exit will be
// lost.
exitDialog = null;
if (exitDialog == null) {
ResourceBundle bundle = NbBundle.getBundle(ExitDialog.class);
JButton buttonSave = new JButton();
buttonSave.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Save"));
JButton buttonSaveAll = new JButton();
buttonSaveAll.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_SaveAll"));
JButton buttonDiscardAll = new JButton();
buttonDiscardAll.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_DiscardAll"));
Mnemonics.setLocalizedText(buttonSave, bundle.getString("CTL_Save"));
Mnemonics.setLocalizedText(buttonSaveAll, bundle.getString ("CTL_SaveAll"));
Mnemonics.setLocalizedText(buttonDiscardAll, bundle.getString ("CTL_DiscardAll"));
exitOptions = new Object[] {
buttonSave,
buttonSaveAll,
buttonDiscardAll,
};
ExitDialog exitComponent = null;
exitComponent = new ExitDialog (openedFiles);
DialogDescriptor exitDlgDescriptor = new DialogDescriptor (
exitComponent, // inside component
bundle.getString("CTL_ExitTitle"), // title
true, // modal
exitOptions, // options
NotifyDescriptor.CANCEL_OPTION, // initial value
DialogDescriptor.RIGHT_ALIGN, // option align
null, // no help
exitComponent // Action Listener
);
exitDlgDescriptor.setAdditionalOptions (new Object[] {NotifyDescriptor.CANCEL_OPTION});
exitDialog = DialogDisplayer.getDefault ().createDialog (exitDlgDescriptor);
}
result = false;
exitDialog.setVisible (true); // Show the modal Save dialog
return result;
}
else
return true;
}
示例15: innerShowDialog
/**
* Opens the ExitDialog.
*/
private static boolean innerShowDialog() {
Collection<? extends Savable> set = Savable.REGISTRY.lookupAll(Savable.class);
if (!set.isEmpty()) {
// XXX(-ttran) caching this dialog is fatal. If the user
// cancels the Exit action, modifies some more files and tries to
// Exit again the list of modified DataObject's is not updated,
// changes made by the user after the first aborted Exit will be
// lost.
exitDialog = null;
if (exitDialog == null) {
ResourceBundle bundle = NbBundle.getBundle(ExitDialog.class);
JButton buttonSave = new JButton();
buttonSave.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Save"));
JButton buttonSaveAll = new JButton();
buttonSaveAll.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_SaveAll"));
JButton buttonDiscardAll = new JButton();
buttonDiscardAll.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_DiscardAll"));
// special handling to handle a button title with mnemonic
// and to allow enable/disable control of the option
Mnemonics.setLocalizedText(buttonSave, bundle.getString("CTL_Save"));
Mnemonics.setLocalizedText(buttonSaveAll, bundle.getString("CTL_SaveAll"));
Mnemonics.setLocalizedText(buttonDiscardAll, bundle.getString("CTL_DiscardAll"));
exitOptions = new Object[] {
buttonSave,
buttonSaveAll,
buttonDiscardAll,
};
ExitDialog exitComponent = new ExitDialog ();
DialogDescriptor exitDlgDescriptor = new DialogDescriptor (
exitComponent, // inside component
bundle.getString("CTL_ExitTitle"), // title
true, // modal
exitOptions, // options
NotifyDescriptor.CANCEL_OPTION, // initial value
DialogDescriptor.RIGHT_ALIGN, // option align
null, // HelpCtx
exitComponent // Action Listener
);
exitDlgDescriptor.setHelpCtx( new HelpCtx( "help_on_exit_dialog" ) ); //NOI18N
exitDlgDescriptor.setAdditionalOptions (new Object[] {NotifyDescriptor.CANCEL_OPTION});
exitDialog = org.openide.DialogDisplayer.getDefault ().createDialog (exitDlgDescriptor);
}
result = false;
exitDialog.setVisible(true); // Show the modal Save dialog
return result;
}
else
return true;
}