本文整理汇总了Java中org.openide.DialogDescriptor.CANCEL_OPTION属性的典型用法代码示例。如果您正苦于以下问题:Java DialogDescriptor.CANCEL_OPTION属性的具体用法?Java DialogDescriptor.CANCEL_OPTION怎么用?Java DialogDescriptor.CANCEL_OPTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openide.DialogDescriptor
的用法示例。
在下文中一共展示了DialogDescriptor.CANCEL_OPTION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectPatchName
public boolean selectPatchName () {
Mnemonics.setLocalizedText(unshelveButton, NbBundle.getMessage(UnshelveChangesAction.class, "CTL_UnshelveChangesPanel.unshelveButton.text")); //NOI18N
Mnemonics.setLocalizedText(removeButton, NbBundle.getMessage(UnshelveChangesAction.class, "CTL_UnshelveChangesPanel.removeButton.text")); //NOI18N
DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(UnshelveChangesAction.class, "LBL_UnshelveChangesPanel.title"), //NOI18N
true, new Object[] { unshelveButton, removeButton, DialogDescriptor.CANCEL_OPTION }, unshelveButton, DialogDescriptor.DEFAULT_ALIGN,
new HelpCtx("org.netbeans.modules.versioning.shelve.impl.UnshelveChangesAction"), null); //NOI18N
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
dialog.setVisible(true);
patchName = panel.cmbPatches.getSelectedItem() instanceof Patch ? ((Patch) panel.cmbPatches.getSelectedItem()).getPatchName().trim() : null;
removePatchFile = !panel.cbKeepPatchFile.isSelected();
if (patchName == null) {
return false;
} else if (dd.getValue() == unshelveButton) {
return true;
} else if (dd.getValue() == removeButton) {
Utils.post(new Runnable() {
@Override
public void run () {
PatchStorage.getInstance().removePatch(patchName, removePatchFile);
}
});
}
return false;
}
示例2: getResult
static String getResult(String selection, String dlgTitle, String comboLabel, String buttonText) {
final FindDialogPanel findPanel = getPanel();
Mnemonics.setLocalizedText(findPanel.acceptButton, NbBundle.getMessage(FindDialogPanel.class, buttonText));
Mnemonics.setLocalizedText(findPanel.findWhatLabel, NbBundle.getMessage(FindDialogPanel.class, comboLabel));
if (selection != null) {
findPanel.setFindText(selection);
}
findPanel.selectText();
DialogDescriptor dd = new DialogDescriptor(findPanel, NbBundle.getMessage(FindDialogPanel.class, dlgTitle),
true, new Object[] {findPanel.acceptButton, DialogDescriptor.CANCEL_OPTION}, findPanel.acceptButton,
DialogDescriptor.RIGHT_ALIGN, null, null);
Object res = DialogDisplayer.getDefault().notify(dd);
if (res.equals(findPanel.acceptButton)) {
findPanel.updateHistory();
regExp = findPanel.chbRegExp.getModel().isSelected();
matchCase = findPanel.chbMatchCase.getModel().isSelected();
NbPreferences.forModule(FindDialogPanel.class).putBoolean(KEY_REGEXP, regExp);
NbPreferences.forModule(FindDialogPanel.class).putBoolean(KEY_MATCHCASE, matchCase);
result = findPanel.getPattern();
return result;
} else {
result = null;
return null;
}
}
示例3: show
boolean show() {
okButton = new JButton(NbBundle.getMessage(CreateTag.class, "LBL_CreateTag.OKButton.text")); //NOI18N
org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
dd = new DialogDescriptor(panel, NbBundle.getMessage(CreateTag.class, "LBL_CreateTag.title"), true, //NOI18N
new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(CreateTag.class), null);
validate();
revisionPicker.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange (PropertyChangeEvent evt) {
if (evt.getPropertyName() == RevisionDialogController.PROP_VALID) {
setRevisionValid(Boolean.TRUE.equals(evt.getNewValue()));
}
}
});
panel.tagNameField.getDocument().addDocumentListener(this);
panel.tagMessageField.getDocument().addDocumentListener(this);
panel.cbForceUpdate.addActionListener(this);
Dialog d = DialogDisplayer.getDefault().createDialog(dd);
d.setVisible(true);
return okButton == dd.getValue();
}
示例4: open
public boolean open () {
dd = new DialogDescriptor(panel, NbBundle.getMessage(RevisionPicker.class, "LBL_RevisionPickerDialog.title"), //NOI18N
true, new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("org.netbeans.modules.git.ui.repository.RevisionPickerDialog"), null); //NOI18N
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
updateDialogState();
browserPanel.addPropertyChangeListener(this);
Preferences prefs = GitModuleConfig.getDefault().getPreferences();
WindowListener windowListener = new DialogBoundsPreserver(prefs, this.getClass().getName());
dialog.addWindowListener(windowListener);
windowListener.windowOpened(new WindowEvent(dialog, WindowEvent.WINDOW_OPENED));
dialog.pack();
updateSliders(prefs);
dialog.setVisible(true);
persistSliders(prefs);
browserPanel.removePropertyChangeListener(this);
return dd.getValue() == okButton;
}
示例5: selectFeature
private static ProfilerFeature selectFeature(Set<ProfilerFeature> features, String actionName) {
UI ui = UI.selectFeature(features);
HelpCtx helpCtx = new HelpCtx("SelectFeatureDialog.HelpCtx"); // NOI18N // TODO: should have a special one?
String caption = actionName == null ? Bundle.ProfilerSessions_selectFeature() : actionName;
DialogDescriptor dd = new DialogDescriptor(ui, caption, true, new Object[]
{ DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION },
DialogDescriptor.OK_OPTION, DialogDescriptor.BOTTOM_ALIGN,
helpCtx, null);
Dialog d = DialogDisplayer.getDefault().createDialog(dd);
d.setVisible(true);
ProfilerFeature ret = dd.getValue() == DialogDescriptor.OK_OPTION ? ui.selectedFeature() : null;
dd.setMessage(null); // Do not leak because of WindowsPopupMenuUI.mnemonicListener
return ret;
}
示例6: show
boolean show() {
JButton okButton = new JButton(NbBundle.getMessage(RevertChanges.class, "LBL_RevertChanges.OKButton.text")); //NOI18N
org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
String label;
if (roots.length != 1) {
label = NbBundle.getMessage(RevertChanges.class, "CTL_RevertChanges.title.files", roots.length); //NOI18N
} else if (Git.getInstance().getFileStatusCache().getStatus(roots[0]).isDirectory()) {
label = NbBundle.getMessage(RevertChanges.class, "CTL_RevertChanges.title.dir", roots[0].getName()); //NOI18N
} else {
label = NbBundle.getMessage(RevertChanges.class, "CTL_RevertChanges.title.file", roots[0].getName()); //NOI18N
}
DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(RevertChanges.class, "CTL_RevertChanges.title", label), true, //NOI18N
new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(RevertChanges.class), null);
Dialog d = DialogDisplayer.getDefault().createDialog(dd);
d.setVisible(true);
return okButton == dd.getValue();
}
示例7: resolve
@Override
@NonNull
@NbBundle.Messages({
"TXT_FixBrokenPlatform=Resolve Broken Platform",
"LBL_OK=&OK"
})
public Future<ProjectProblemsProvider.Result> resolve() {
final JButton ok = new JButton();
Mnemonics.setLocalizedText(ok, LBL_OK());
final FixPlatform fixPlatform = new FixPlatform(
propertyName,
id,
platformType,
eval,
helper,
callback,
ok);
final DialogDescriptor dd = new DialogDescriptor(
fixPlatform,
TXT_FixBrokenPlatform(),
true,
new Object[] {
ok,
DialogDescriptor.CANCEL_OPTION
},
ok,
DialogDescriptor.DEFAULT_ALIGN,
null,
null);
if (DialogDisplayer.getDefault().notify(dd) == ok) {
return fixPlatform.resolve();
} else {
return new Done(ProjectProblemsProvider.Result.create(ProjectProblemsProvider.Status.UNRESOLVED));
}
}
示例8: showShortcutsDialog
@Override
public String showShortcutsDialog() {
final ShortcutsDialog d = new ShortcutsDialog ();
d.init(this);
final DialogDescriptor descriptor = new DialogDescriptor (
d,
loc ("Add_Shortcut_Dialog"),
true,
new Object[] {
DialogDescriptor.OK_OPTION,
DialogDescriptor.CANCEL_OPTION
},
DialogDescriptor.OK_OPTION,
DialogDescriptor.DEFAULT_ALIGN,
null,
d.getListener()
);
descriptor.setClosingOptions (new Object[] {
DialogDescriptor.OK_OPTION,
DialogDescriptor.CANCEL_OPTION
});
descriptor.setAdditionalOptions (new Object [] {
d.getBClear(), d.getBTab()
});
descriptor.setValid(d.isShortcutValid());
d.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName() == null || ShortcutsDialog.PROP_SHORTCUT_VALID.equals(evt.getPropertyName())) {
descriptor.setValid(d.isShortcutValid());
}
}
});
DialogDisplayer.getDefault ().notify (descriptor);
if (descriptor.getValue () == DialogDescriptor.OK_OPTION)
return d.getTfShortcut().getText ();
return null;
}
示例9: stopCellEditing
@Override
public boolean stopCellEditing() {
String s = cell.toString();
Window ancestorWindow = (Window)SwingUtilities.getRoot(cell);
// #236458: options are now saved asynchronously. If the dialog was to
if (ancestorWindow == null) {
return true;
}
// HACK: if this Editor creates a dialog, it will lose the focus and Swing
// will remove the editor, calling JTable.cancelEditing. Any re-selections performed
// by the JTable will occur BEFORE the dialog is finished, so we need to
// reestablish the column selection later from here.
// This binds the BCEditor to the KeymapTable layout / internals.
JTable parent = (JTable)cell.getParent();
ShortcutAction sca = (ShortcutAction) action;
Set<ShortcutAction> conflictingAction = model.getMutableModel().findActionForShortcutPrefix(s);
conflictingAction.remove(sca); //remove the original action
Collection<ShortcutAction> sameScopeActions = model.getMutableModel().filterSameScope(conflictingAction, sca);
if (!conflictingAction.isEmpty()) {
if (!SwingUtilities.isEventDispatchThread()) {
// #236458: options are now saved asynchronously, off EDT. If we display dialog, the IDE will lock up.
cell.getTextField().setText(orig);
fireEditingCanceled();
return true;
}
//there is a conflicting action, show err dialog
Object overrride = overrride(conflictingAction, sameScopeActions);
// bring the focus back
ancestorWindow.toFront();
parent.requestFocus();
if (overrride.equals(DialogDescriptor.YES_OPTION)) {
for (ShortcutAction sa : conflictingAction) {
removeConflictingShortcut(sa, s); //remove all conflicting shortcuts
}
//proceed with override
} else if (overrride == DialogDescriptor.CANCEL_OPTION) {
cell.getTextField().setText(orig);
fireEditingCanceled();
setBorderEmpty();
return true;
}
// NO_OPTION fallls through and adds additional shortcut.
}
cell.getTextField().removeActionListener(delegate);
cell.getTextField().removeKeyListener(escapeAdapter);
model.getMutableModel().removeShortcut((ShortcutAction) action, orig);
if (!(s.length() == 0)) // do not add empty shortcuts
model.getMutableModel().addShortcut((ShortcutAction) action, s);
fireEditingStopped();
setBorderEmpty();
model.update();
return true;
}
示例10: showInWindow
public static URL showInWindow() {
JButton openBtn = new JButton();
Mnemonics.setLocalizedText(openBtn, NbBundle.getMessage(ReferencesPanel.class, "ReferencesPanel.ok.text"));
openBtn.getAccessibleContext().setAccessibleDescription(openBtn.getText());
openBtn.setEnabled(false);
final Object[] buttons = new Object[] { openBtn, DialogDescriptor.CANCEL_OPTION };
ReferencesPanel panel = new ReferencesPanel(openBtn);
DialogDescriptor desc = new DialogDescriptor(
panel,
NbBundle.getMessage(ReferencesPanel.class, "ReferencesPanel.title"),
true,
buttons,
openBtn,
DialogDescriptor.DEFAULT_ALIGN,
HelpCtx.DEFAULT_HELP,
null);
desc.setClosingOptions(buttons);
Dialog dialog = DialogDisplayer.getDefault().createDialog(desc);
dialog.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ReferencesPanel.class, "AN_ReferencesDialog"));
dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ReferencesPanel.class, "AD_ReferencesDialog"));
// schedule computing indices
RP.post(panel);
dialog.setVisible(true);
dialog.dispose();
return desc.getValue() == openBtn
? panel.getSelectedItem()
: null;
}
示例11: compareExternalSnapshots
private void compareExternalSnapshots() {
DialogDescriptor desc = new DialogDescriptor(getExternalSnapshotsSelector(), Bundle.CompareSnapshotsAction_SelectSnapshotsDialogCaption(), true,
new Object[] {
getExternalSnapshotsSelector().getOKButton(),
DialogDescriptor.CANCEL_OPTION
}, DialogDescriptor.OK_OPTION, 0, EXTERNAL_SNAPSHOT_HELP_CTX, null);
Object res = DialogDisplayer.getDefault().notify(desc);
if (res.equals(getExternalSnapshotsSelector().getOKButton())) {
ResultsManager.getDefault()
.compareSnapshots(FileUtil.toFileObject(new File(getExternalSnapshotsSelector().getSnapshot1Filename())),
FileUtil.toFileObject(new File(getExternalSnapshotsSelector().getSnapshot2Filename())));
}
}
示例12: getIssueString
public String getIssueString() {
final DialogDescriptor dd = new DialogDescriptor(this, Bundle.IssueNumberDialog_DialogCaption(), true,
new Object[]{okButton, DialogDescriptor.CANCEL_OPTION},
okButton, DialogDescriptor.BOTTOM_ALIGN, null, null);
final Dialog d = DialogDisplayer.getDefault().createDialog(dd);
d.setVisible(true);
if (dd.getValue() == okButton) {
return Integer.toString(Integer.parseInt(issueField.getText().trim()));
} else {
return null;
}
}
示例13: askPassword
@Override
public boolean askPassword(ExecutionEnvironment execEnv, String prompt) {
tfUser.setText(execEnv.getUser());
String hostName = execEnv.getHost();
if (execEnv.getSSHPort() != 22) {
hostName += ":" + execEnv.getSSHPort(); //NOI18N
}
tfHost.setText(hostName); // NOI18N
cbRememberPwd.setSelected(PasswordManager.getInstance().isRememberPassword(execEnv));
DialogDescriptor dd = new DialogDescriptor(this,
loc("TITLE_Password"), true, // NOI18N
new Object[]{
DialogDescriptor.OK_OPTION,
DialogDescriptor.CANCEL_OPTION},
DialogDescriptor.OK_OPTION,
DialogDescriptor.DEFAULT_ALIGN, null, null);
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
dialog.setResizable(false);
try {
dialog.setVisible(true);
} catch (Throwable th) {
if (!(th.getCause() instanceof InterruptedException)) {
throw new RuntimeException(th);
}
dd.setValue(DialogDescriptor.CANCEL_OPTION);
} finally {
dialog.dispose();
}
return dd.getValue() == DialogDescriptor.OK_OPTION;
}
示例14: open
@NbBundle.Messages({
"BranchSelector.okButton.text=&OK",
"BranchSelector.title=Select Branch"
})
public boolean open () {
okButton = new JButton();
org.openide.awt.Mnemonics.setLocalizedText(okButton, Bundle.BranchSelector_okButton_text());
dd = new DialogDescriptor(panel, Bundle.BranchSelector_title(), true,
new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton,
DialogDescriptor.DEFAULT_ALIGN, null, null);
revisionPicker.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange (PropertyChangeEvent evt) {
if (evt.getPropertyName() == RevisionDialogController.PROP_VALID) {
setRevisionValid(Boolean.TRUE.equals(evt.getNewValue()));
} else if (evt.getPropertyName() == RevisionDialogController.PROP_REVISION_ACCEPTED) {
if (dd.isValid()) {
okButton.doClick();
}
}
}
});
Dialog d = DialogDisplayer.getDefault().createDialog(dd);
okButton.setEnabled(false);
d.setVisible(true);
return okButton == dd.getValue();
}
示例15: showDialog
void showDialog () {
DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(CreateTag.class, "LBL_TagManagerPanel.title", repository.getName()), //NOI18N
true, new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION },
DialogDescriptor.OK_OPTION, DialogDescriptor.DEFAULT_ALIGN,
new HelpCtx("org.netbeans.modules.mercurial.ui.tag.TagManagerPanel"), null); //NOI18N
dialog = DialogDisplayer.getDefault().createDialog(dd);
loadRevisions();
dialog.setVisible(true);
HgProgressSupport supp = backgroundSupport;
if (supp != null) {
supp.cancel();
}
}