本文整理匯總了Java中org.openide.NotifyDescriptor.YES_OPTION屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.YES_OPTION屬性的具體用法?Java NotifyDescriptor.YES_OPTION怎麽用?Java NotifyDescriptor.YES_OPTION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openide.NotifyDescriptor
的用法示例。
在下文中一共展示了NotifyDescriptor.YES_OPTION屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: clearCategories
public void clearCategories() {
NotifyDescriptor nd = new NotifyDescriptor(
NbBundle.getMessage(DashboardViewer.class, "LBL_ClearCatQuestion"), //NOI18N
NbBundle.getMessage(DashboardViewer.class, "LBL_ClearCatTitle"), //NOI18N
NotifyDescriptor.YES_NO_OPTION,
NotifyDescriptor.QUESTION_MESSAGE,
null,
NotifyDescriptor.YES_OPTION);
if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.YES_OPTION) {
List<TaskNode> finished = new ArrayList<TaskNode>();
for (CategoryNode categoryNode : categoryNodes) {
if (!categoryNode.isOpened() || !categoryNode.getCategory().persist()) {
continue;
}
for (TaskNode taskNode : categoryNode.getTaskNodes()) {
if (taskNode.getTask().isFinished()) {
finished.add(taskNode);
}
}
}
removeTask(finished.toArray(new TaskNode[finished.size()]));
}
}
示例2: importIntoExisting
/**
* Checks if the target folder already exists in the repository.
* If it does exist, user will be asked to confirm the import into the existing folder.
* @param client
* @param repositoryFileUrl
* @return true if the target does not exist or user wishes to import anyway.
*/
private boolean importIntoExisting(SvnClient client, SVNUrl repositoryFileUrl) {
try {
ISVNInfo info = client.getInfo(repositoryFileUrl);
if (info != null) {
// target folder exists, ask user for confirmation
final boolean flags[] = {true};
NotifyDescriptor nd = new NotifyDescriptor(NbBundle.getMessage(ImportStep.class, "MSG_ImportIntoExisting", SvnUtils.decodeToString(repositoryFileUrl)), //NOI18N
NbBundle.getMessage(ImportStep.class, "CTL_TargetFolderExists"), NotifyDescriptor.YES_NO_CANCEL_OPTION, //NOI18N
NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.YES_OPTION);
if (DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.YES_OPTION) {
flags[0] = false;
}
return flags[0];
}
} catch (SVNClientException ex) {
// ignore
}
return true;
}
示例3: selectAll
@NbBundle.Messages({
"MSG_TooMuchTextSelected=Selecting large parts of text can cause "
+ "Out-Of-Memory errors. Do you want to continue?"
})
public void selectAll() {
unlockScroll();
getCaret().setVisible(true);
int start = 0;
int end = getLength();
if (end - start > 20000000 && !copyingOfLargeParts) { // 40 MB
NotifyDescriptor nd = new NotifyDescriptor.Confirmation(
Bundle.MSG_TooMuchTextSelected(),
NotifyDescriptor.YES_NO_OPTION);
Object result = DialogDisplayer.getDefault().notify(nd);
if (result == NotifyDescriptor.YES_OPTION) {
copyingOfLargeParts = true;
} else {
return;
}
}
textView.setSelectionStart(start);
textView.setSelectionEnd(end);
}
示例4: 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;
}
示例5: displayCreateFailure
private static void displayCreateFailure(DatabaseServer server,
DatabaseException ex, String dbname, boolean dbCreated) {
LOGGER.log(Level.INFO, null, ex);
Utils.displayError(NbBundle.getMessage(CreateDatabasePanel.class,
"CreateNewDatabasePanel.MSG_CreateFailed"), ex);
if ( dbCreated ) {
NotifyDescriptor ndesc = new NotifyDescriptor.Confirmation(
NbBundle.getMessage(CreateDatabasePanel.class,
"CreateNewDatabasePanel.MSG_DeleteCreatedDatabase",
dbname),
NbBundle.getMessage(CreateDatabasePanel.class,
"CreateNewDatabasePanel.STR_DeleteCreatedDatabaseTitle"),
NotifyDescriptor.YES_NO_OPTION);
Object response = DialogDisplayer.getDefault().notify(ndesc);
if ( response == NotifyDescriptor.YES_OPTION ) {
server.dropDatabase(dbname);
}
}
}
示例6: waitStart
private boolean waitStart(final ExecSupport execSupport, int waitTime) {
boolean started = false;
final Holder<Boolean> forceExit = new Holder<>(false);
String waitMessage = NbBundle.getMessage(RegisterDerby.class, "MSG_StartingDerby");
ProgressHandle progress = ProgressHandleFactory.createHandle(waitMessage, new Cancellable() {
@Override
public boolean cancel() {
forceExit.value = true;
return execSupport.interruptWaiting();
}
});
progress.start();
try {
while (!started) {
started = execSupport.waitForMessage(waitTime * 1000);
if (!started) {
if (waitTime > 0 && (!forceExit.value)) {
String title = NbBundle.getMessage(RegisterDerby.class, "LBL_DerbyDatabase");
String message = NbBundle.getMessage(RegisterDerby.class, "MSG_WaitStart", waitTime);
NotifyDescriptor waitConfirmation = new NotifyDescriptor.Confirmation(message, title, NotifyDescriptor.YES_NO_OPTION);
if (DialogDisplayer.getDefault().notify(waitConfirmation)
!= NotifyDescriptor.YES_OPTION) {
break;
}
} else {
break;
}
}
}
if (!started) {
execSupport.terminate();
LOGGER.log(Level.WARNING, "Derby server failed to start"); // NOI18N
}
} finally {
progress.finish();
}
return started;
}
示例7: shouldReplaceDuplicate
static boolean shouldReplaceDuplicate(final Document doc, final int startOff, final int endOff) {
introduceBag(doc).clear();
introduceBag(doc).addHighlight(startOff, endOff, DUPE);
SwingUtilities.invokeLater(new Runnable() {
@Override public void run() {
JTextComponent c = EditorRegistry.lastFocusedComponent();
if (c != null && c.getDocument() == doc) {
try {
Rectangle start = c.modelToView(startOff);
Rectangle end = c.modelToView(endOff);
int sx = Math.min(start.x, end.x);
int dx = Math.max(start.x + start.width, end.x + end.width);
int sy = Math.min(start.y, end.y);
int dy = Math.max(start.y + start.height, end.y + end.height);
c.scrollRectToVisible(new Rectangle(sx, sy, dx - sx, dy - sy));
} catch (BadLocationException ex) {
Exceptions.printStackTrace(ex);
}
}
}
});
String title = NbBundle.getMessage(IntroduceHint.class, "TTL_DuplicateMethodPiece");
String message = NbBundle.getMessage(IntroduceHint.class, "MSG_DuplicateMethodPiece");
NotifyDescriptor nd = new NotifyDescriptor.Confirmation(message, title, NotifyDescriptor.YES_NO_OPTION);
return DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.YES_OPTION;
}
示例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: actionPerformed
public @Override void actionPerformed(ActionEvent actionEvent) {
InternalHandle hndl = handle;
if (hndl !=null && hndl.getState() == InternalHandle.STATE_RUNNING) {
String message = NbBundle.getMessage(StatusLineComponent.class, "Cancel_Question", handle.getDisplayName());
String title = NbBundle.getMessage(StatusLineComponent.class, "Cancel_Question_Title");
NotifyDescriptor dd = new NotifyDescriptor(message, title,
NotifyDescriptor.YES_NO_OPTION,
NotifyDescriptor.QUESTION_MESSAGE, null, null);
Object retType = DialogDisplayer.getDefault().notify(dd);
if (retType == NotifyDescriptor.YES_OPTION && hndl.getState() == InternalHandle.STATE_RUNNING) {
hndl.requestCancel();
}
}
}
示例10: actionPerformed
public void actionPerformed(ActionEvent actionEvent) {
if (handle.getState() == InternalHandle.STATE_RUNNING) {
String message = NbBundle.getMessage(ListComponent.class, "Cancel_Question", handle.getDisplayName());
String title = NbBundle.getMessage(ListComponent.class, "Cancel_Question_Title");
NotifyDescriptor dd = new NotifyDescriptor(message, title,
NotifyDescriptor.YES_NO_OPTION,
NotifyDescriptor.QUESTION_MESSAGE, null, null);
Object retType = DialogDisplayer.getDefault().notify(dd);
if (retType == NotifyDescriptor.YES_OPTION) {
handle.requestCancel();
}
}
}
示例11: commitAfterMerge
private static boolean commitAfterMerge (boolean locallyModifiedExcluded, File repository) {
// XXX consider usage of repository to determine if there are any non-included files which have to be committed, too
// and thus removing the option HgModuleConfig.getDefault().getConfirmCommitAfterMerge()
if (locallyModifiedExcluded || HgModuleConfig.getDefault().getConfirmCommitAfterMerge()) { // ask before commit?
NotifyDescriptor descriptor = new NotifyDescriptor.Confirmation(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_AFTER_MERGE_QUERY")); // NOI18N
descriptor.setTitle(NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_AFTER_MERGE_TITLE")); // NOI18N
descriptor.setMessageType(JOptionPane.WARNING_MESSAGE);
descriptor.setOptionType(NotifyDescriptor.YES_NO_OPTION);
Object res = DialogDisplayer.getDefault().notify(descriptor);
return res == NotifyDescriptor.YES_OPTION;
}
return true;
}
示例12: removeAllButtonActionPerformed
@Messages({"ManageGroupsPanel.wrn_remove_all_groups_msg=Are you sure to remove all groups?",
"ManageGroupsPanel.wrn_remove_all_groups_title=Confirm remove all groups"})
private void removeAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeAllButtonActionPerformed
NotifyDescriptor d = new NotifyDescriptor.Confirmation(Bundle.ManageGroupsPanel_wrn_remove_all_groups_msg(), Bundle.ManageGroupsPanel_wrn_remove_all_groups_title(), NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.YES_OPTION) {
removeGroups(Group.allGroups());
}
}
示例13: preventDelete
private boolean preventDelete(List<String> objects, String type, String title) {
// confirmation
return DialogDisplayer.getDefault().notify(
new NotifyDescriptor.Confirmation(
NbBundle.getMessage(DbExtendedDelete.class, "DbExtendedDelete_ConfirmationMessage_DeleteObjects", type, formatNames(objects)), // msg
NbBundle.getMessage(DbExtendedDelete.class, "DbExtendedDelete_ConfirmationTitle_DeleteObjects", title), // title
NotifyDescriptor.YES_NO_OPTION)) != NotifyDescriptor.YES_OPTION;
}
示例14: notify
public Object notify(NotifyDescriptor descriptor) {
if (descriptor
.getMessage() instanceof String) {
//check that this is the "do replace" dialog
return NotifyDescriptor.YES_OPTION;
}
IntroduceMethodPanel panel = (IntroduceMethodPanel) descriptor
.getMessage();
if (methodName != null) {
panel
.setMethodName(methodName);
}
if (access != null) {
panel
.setAccess(access);
}
panel
.setReplaceOther(replaceDuplicates);
return ok ? descriptor
.getOptions()[0] : descriptor
.getOptions()[1];
}
示例15: askCopyToCentralStorage
@NbBundle.Messages({
"LBL_LocalTask.copyAttToCentralStorage.title=Copy Attachment",
"# {0} - number of attachments",
"MSG_LocalTask.copyAttToCentralStorage.text=You are trying to add {0} attachments to the local task.\n"
+ "The attachments will be kept in their original locations and linked from the task\n\n"
+ "Do you want to copy the files to a central storage to make sure they will be accessible "
+ "even after their original location is deleted?"
})
private boolean askCopyToCentralStorage (int attachmentCount) {
NotifyDescriptor nd = new NotifyDescriptor.Confirmation(
Bundle.MSG_LocalTask_copyAttToCentralStorage_text(attachmentCount),
Bundle.LBL_LocalTask_copyAttToCentralStorage_title(),
NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
return DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.YES_OPTION;
}