本文整理匯總了Java中org.openide.NotifyDescriptor.OK_OPTION屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.OK_OPTION屬性的具體用法?Java NotifyDescriptor.OK_OPTION怎麽用?Java NotifyDescriptor.OK_OPTION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openide.NotifyDescriptor
的用法示例。
在下文中一共展示了NotifyDescriptor.OK_OPTION屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: promptToDelete
private boolean promptToDelete(Preferences prefs) {
Object result = DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation(
NbBundle.getMessage(FallbackProvider.class, "FallbackProvider.msg_clear_keys"),
NbBundle.getMessage(FallbackProvider.class, "FallbackProvider.title_clear_keys"),
NotifyDescriptor.OK_CANCEL_OPTION));
if (result == NotifyDescriptor.OK_OPTION) {
try {
LOG.log(Level.FINE, "agreed to delete stored passwords: {0}", Arrays.asList(prefs.keys()));
prefs.clear();
return testSampleKey(prefs);
} catch (BackingStoreException x) {
LOG.log(Level.INFO, null, x);
}
} else {
LOG.fine("refused to delete stored passwords");
}
return false;
}
示例2: open
/**
* Opens dialog for adding entities.
* @return fully qualified names of the selected entities' classes.
*/
public static List<String> open(EntityClassScope entityClassScope, Set<String> ignoreClassNames){
AddEntityPanel panel = AddEntityPanel.create(entityClassScope, ignoreClassNames);
final DialogDescriptor nd = new DialogDescriptor(
panel,
NbBundle.getMessage(AddEntityDialog.class, "LBL_AddEntity"),
true,
DialogDescriptor.OK_CANCEL_OPTION,
DialogDescriptor.OK_OPTION,
DialogDescriptor.DEFAULT_ALIGN,
new HelpCtx(AddEntityPanel.class),
null
);
Object button = DialogDisplayer.getDefault().notify(nd);
if (button != NotifyDescriptor.OK_OPTION) {
return Collections.emptyList();
}
return Collections.unmodifiableList(panel.getSelectedEntityClasses());
}
示例3: handleInput
public void handleInput(InputRequest request) throws BuildException {
interestingOutputCallback.run();
// #30196 - for one Ant script containing several <input> tasks there will be created
// just one instance of the NbInputHandler. So it is necessary to cleanup the instance
// used by the previous <input> task first.
combo = null;
input = null;
JPanel panel = createPanel(request);
DialogDescriptor dlg = new DialogDescriptor(panel,
NbBundle.getMessage(NbInputHandler.class, "TITLE_input_handler")); //NOI18N
do {
DialogDisplayer.getDefault().createDialog(dlg).setVisible(true);
if (dlg.getValue() != NotifyDescriptor.OK_OPTION) {
throw new BuildException(NbBundle.getMessage(NbInputHandler.class, "MSG_input_aborted")); //NOI18N
}
String value;
if (combo != null) {
value = (String) combo.getSelectedItem();
} else {
value = input.getText();
}
request.setInput(value);
} while (!request.isInputValid());
}
示例4: addKeyToBranding
private boolean addKeyToBranding (String bundlepath, String codenamebase, String key) {
BrandingSupport.BundleKey bundleKey = getBranding().getGeneralBundleKeyForModification(codenamebase, bundlepath, key);
KeyInput inputLine = new KeyInput(key + ":", bundlepath); // NOI18N
String oldValue = bundleKey.getValue();
inputLine.setInputText(oldValue);
if (DialogDisplayer.getDefault().notify(inputLine)==NotifyDescriptor.OK_OPTION) {
String newValue = inputLine.getInputText();
if (newValue.compareTo(oldValue)!=0) {
bundleKey.setValue(newValue);
getBranding().addModifiedGeneralBundleKey(bundleKey);
setModified();
return true;
}
}
return false;
}
示例5: btnAddActionPerformed
private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-HEADEREND:event_btnAddActionPerformed
NotifyDescriptor.InputLine nd = new NonEmptyInputLine(org.openide.util.NbBundle.getMessage(ActionMappings.class, "TIT_Add_action"), org.openide.util.NbBundle.getMessage(ActionMappings.class, "LBL_AddAction"));
Object ret = DialogDisplayer.getDefault().notify(nd);
if (ret == NotifyDescriptor.OK_OPTION) {
NetbeansActionMapping nam = new NetbeansActionMapping();
nam.setDisplayName(nd.getInputText());
nam.setActionName(CUSTOM_ACTION_PREFIX + nd.getInputText());
getActionMappings().addAction(nam);
if (handle != null) {
handle.markAsModified(getActionMappings());
}
MappingWrapper wr = new MappingWrapper(nam);
wr.setUserDefined(true);
((DefaultListModel)lstMappings.getModel()).addElement(wr);
lstMappings.setSelectedIndex(lstMappings.getModel().getSize() - 1);
lstMappings.ensureIndexIsVisible(lstMappings.getModel().getSize() - 1);
}
}
示例6: removeRemote
public void removeRemote (File repository, final String remoteName) {
if (DialogDisplayer.getDefault().notify(new NotifyDescriptor(NbBundle.getMessage(RemoveRemoteConfig.class, "MSG_RemoveRemoteConfig.confirmation", remoteName), //NOI18N
NbBundle.getMessage(RemoveRemoteConfig.class, "LBL_RemoveRemoteConfig.confirmation"), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE, //NOI18N
new Object[] { NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION }, NotifyDescriptor.OK_OPTION)) == NotifyDescriptor.OK_OPTION) {
GitProgressSupport supp = new GitProgressSupport() {
@Override
protected void perform () {
try {
GitClient client = getClient();
client.removeRemote(remoteName, getProgressMonitor());
} catch (GitException ex) {
GitClientExceptionHandler.notifyException(ex, true);
}
}
};
supp.start(Git.getInstance().getRequestProcessor(repository), repository, NbBundle.getMessage(RemoveRemoteConfig.class, "LBL_RemoveRemoteConfig.progressName")); //NOI18N
}
}
示例7: showCategoryNameDialog
private boolean showCategoryNameDialog(CategoryNamePanel panel, String message) {
categoryNameDialog = new NotifyDescriptor(
panel,
message,
NotifyDescriptor.OK_CANCEL_OPTION,
NotifyDescriptor.PLAIN_MESSAGE,
null,
NotifyDescriptor.OK_OPTION);
categoryNameDialog.setValid(false);
if (categoryNameListener == null) {
categoryNameListener = new CategoryNameDocumentListener();
}
panel.addDocumentListener(categoryNameListener);
boolean confirm = DialogDisplayer.getDefault().notify(categoryNameDialog) == NotifyDescriptor.OK_OPTION;
panel.removeDocumentListener(categoryNameListener);
return confirm;
}
示例8: addFilterSetting
public void addFilterSetting() {
NotifyDescriptor.InputLine l = new NotifyDescriptor.InputLine("Name of the new profile:", "Filter Profile");
if (DialogDisplayer.getDefault().notify(l) == NotifyDescriptor.OK_OPTION) {
String name = l.getInputText();
FilterSetting toRemove = null;
for (FilterSetting s : filterSettings) {
if (s.getName().equals(name)) {
NotifyDescriptor.Confirmation conf = new NotifyDescriptor.Confirmation("Filter profile \"" + name + "\" already exists, do you want to replace it?", "Filter");
if (DialogDisplayer.getDefault().notify(conf) == NotifyDescriptor.YES_OPTION) {
toRemove = s;
break;
} else {
return;
}
}
}
if (toRemove != null) {
filterSettings.remove(toRemove);
}
FilterSetting setting = createFilterSetting(name);
filterSettings.add(setting);
// Sort alphabetically
Collections.sort(filterSettings, new Comparator<FilterSetting>() {
@Override
public int compare(FilterSetting o1, FilterSetting o2) {
return o1.getName().compareTo(o2.getName());
}
});
updateComboBox();
}
}
示例9: ignore
@Messages({
"# {0} - job name",
"# {1} - server name",
"ProblemNotification.ignore.question=Do you wish to cease to receive notifications of failures in {0}? If you change your mind, use Services > Hudson Builders > {1} > {0} > Properties > Watched.",
"# {0} - job name",
"ProblemNotification.ignore.title=Ignore Failures in {0}"
})
void ignore() { // #161601
if (DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation(
Bundle.ProblemNotification_ignore_question(job.getDisplayName(), job.getInstance().getName()),
Bundle.ProblemNotification_ignore_title(job.getDisplayName()),
NotifyDescriptor.OK_CANCEL_OPTION)) == NotifyDescriptor.OK_OPTION) {
job.setSalient(false);
}
}
示例10: actionPerformed
@Messages({
"ProjectAssociationAction.open_some_projects=Open some projects to choose from.",
"ProjectAssociationAction.title_select_project=Select Project",
"ProjectAssociationAction.could_not_associate=Failed to record a Hudson job association.",
"ProjectAssociationAction.could_not_dissociate=Failed to find the Hudson job association to be removed."
})
@Override public void actionPerformed(ActionEvent e) {
if (alreadyAssociatedProject == null) {
SortedSet<Project> projects = new TreeSet<Project>(ProjectRenderer.comparator());
projects.addAll(Arrays.asList(OpenProjects.getDefault().getOpenProjects()));
if (projects.isEmpty()) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ProjectAssociationAction_open_some_projects(), NotifyDescriptor.INFORMATION_MESSAGE));
return;
}
JComboBox box = new JComboBox(new DefaultComboBoxModel(projects.toArray(new Project[projects.size()])));
box.setRenderer(new ProjectRenderer());
if (DialogDisplayer.getDefault().notify(new NotifyDescriptor(box, Bundle.ProjectAssociationAction_title_select_project(), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE, null, null)) != NotifyDescriptor.OK_OPTION) {
return;
}
if (!ProjectHudsonProvider.getDefault().recordAssociation((Project) box.getSelectedItem(), assoc)) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ProjectAssociationAction_could_not_associate(), NotifyDescriptor.WARNING_MESSAGE));
}
} else {
if (!ProjectHudsonProvider.getDefault().recordAssociation(alreadyAssociatedProject, null)) {
DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ProjectAssociationAction_could_not_dissociate(), NotifyDescriptor.WARNING_MESSAGE));
}
}
}
示例11: bConnectionPropertiesActionPerformed
private void bConnectionPropertiesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bConnectionPropertiesActionPerformed
PropertyEditorPanel pep = new PropertyEditorPanel(connectionProperties, true);
DialogDescriptor dd = new DialogDescriptor(
pep,
NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionPanel.dlgConnectionProperties"),
true,
null);
Object result = DialogDisplayer.getDefault().notify(dd);
if(result == NotifyDescriptor.OK_OPTION) {
connectionProperties = pep.getValue();
}
}
示例12: setUserDesignerSize
private void setUserDesignerSize() {
NotifyDescriptor.InputLine input = new NotifyDescriptor.InputLine(
FormUtils.getBundleString("CTL_SetDesignerSize_Label"), // NOI18N
FormUtils.getBundleString("CTL_SetDesignerSize_Title")); // NOI18N
Dimension size = formDesigner.getComponentLayer().getDesignerSize();
input.setInputText(Integer.toString(size.width) + ", " // NOI18N
+ Integer.toString(size.height));
if (DialogDisplayer.getDefault().notify(input) == NotifyDescriptor.OK_OPTION) {
String txt = input.getInputText();
int i = txt.indexOf(',');
if (i > 0) {
int n = txt.length();
try {
int w = Integer.parseInt(txt.substring(0, i));
while (++i < n && txt.charAt(i) == ' ');
int h = Integer.parseInt(txt.substring(i, n));
if (w >= 0 && h >= 0) {
size = new Dimension(w ,h);
formDesigner.setDesignerSize(size, null);
setToolTipText(null);
setCursor(Cursor.getDefaultCursor());
}
}
catch (NumberFormatException ex) {} // silently ignore, do nothing
}
}
}
示例13: create
public void create() throws IOException {
String title = "Create New " + getName();
NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine("New name:", title);
if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.OK_OPTION) {
String name = d.getInputText();
if (dir) {
ph.createContainerPhadhail(name);
} else {
ph.createLeafPhadhail(name);
}
}
}
示例14: actionPerformed
@Override
public void actionPerformed(ActionEvent e) {
String title = dialogTitle;
String text = "Parameters:";
NotifyDescriptor.InputLine input = new NotifyDescriptor.InputLine(text, title);
FormalParameters params = dataNode.getParameters();
input.setInputText("vars(" + params.toString() + ")");
Object result = DialogDisplayer.getDefault().notify(input);
if (result != NotifyDescriptor.OK_OPTION) {
return;
}
String userInput = input.getInputText().trim();
try {
FormalParameters newParams;
if (userInput.isEmpty() || userInput.matches("^vars *\\( *\\)$")) {
newParams = new FormalParameters();
} else {
PoshParser parser = new PoshParser(new StringReader(userInput));
newParams = parser.parameters();
}
dataNode.setParameters(newParams);
} catch (ParseException ex) {
String msg = MessageFormat.format("Unable to parse parameters from:\n{0}\nError message: ", userInput, ex.getMessage());
errorDialog(msg);
}
}
示例15: 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);
}