本文整理匯總了Java中org.openide.NotifyDescriptor.YES_NO_OPTION屬性的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.YES_NO_OPTION屬性的具體用法?Java NotifyDescriptor.YES_NO_OPTION怎麽用?Java NotifyDescriptor.YES_NO_OPTION使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openide.NotifyDescriptor
的用法示例。
在下文中一共展示了NotifyDescriptor.YES_NO_OPTION屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: destroy
@Override
@NbBundle.Messages({
"# {0} - Database name",
"MSG_Confirm_DB_Delete=Really delete database {0}?",
"MSG_Confirm_DB_Delete_Title=Delete Database"})
public void destroy() {
NotifyDescriptor d =
new NotifyDescriptor.Confirmation(
Bundle.MSG_Confirm_DB_Delete(database),
Bundle.MSG_Confirm_DB_Delete_Title(),
NotifyDescriptor.YES_NO_OPTION);
Object result = DialogDisplayer.getDefault().notify(d);
if (NotifyDescriptor.OK_OPTION.equals(result)) {
server.dropDatabase(database);
}
}
示例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: reload
/** Ask and reload/close image views. */
private void reload(FileEvent evt) {
// ask if reload?
// XXX the following is a resource path in NB 3.x and a URL after build system
// merge; better to produce something nicer (e.g. FileUtil.toFile):
String msg = NbBundle.getMessage(ImageOpenSupport.class, "MSG_ExternalChange", entry.getFile() );
NotifyDescriptor nd = new NotifyDescriptor.Confirmation(msg, NotifyDescriptor.YES_NO_OPTION);
Object ret = DialogDisplayer.getDefault().notify(nd);
if (NotifyDescriptor.YES_OPTION.equals(ret)) {
// due to compiler 1.2 bug only
final ImageDataObject imageObj = (ImageDataObject)entry.getDataObject();
final CloneableTopComponent.Ref editors = allEditors;
Enumeration e = editors.getComponents();
while(e.hasMoreElements()) {
final Object pane = e.nextElement();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
((ImageViewer)pane).updateView(imageObj);
}
});
}
}
}
示例4: saveAs
@Override
public void saveAs(FileObject folder, String fileName) throws IOException {
String fn = FileUtil.getFileDisplayName(folder) + File.separator + fileName;
File existingFile = FileUtil.normalizeFile(new File(fn));
if (existingFile.exists()) {
NotifyDescriptor confirm = new NotifyDescriptor.Confirmation(
NbBundle.getMessage(SQLEditorSupport.class,
"MSG_ConfirmReplace", fileName),
NbBundle.getMessage(SQLEditorSupport.class,
"MSG_ConfirmReplaceFileTitle"),
NotifyDescriptor.YES_NO_OPTION);
DialogDisplayer.getDefault().notify(confirm);
if (!confirm.getValue().equals(NotifyDescriptor.YES_OPTION)) {
return;
}
}
if (isConsole()) {
// #166370 - if console, need to save document before copying
saveDocument();
}
super.saveAs(folder, fileName);
}
示例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: displayConfirmation
@Override
public Boolean displayConfirmation(String message, String caption, boolean cancellable) {
NotifyDescriptor nd = new NotifyDescriptor.Confirmation(message,
cancellable ? NotifyDescriptor.YES_NO_CANCEL_OPTION : NotifyDescriptor.YES_NO_OPTION);
if (caption != null) nd.setTitle(caption);
Object ret = DialogDisplayer.getDefault().notify(nd);
if (ret == NotifyDescriptor.YES_OPTION) return Boolean.TRUE;
if (ret == NotifyDescriptor.NO_OPTION) return Boolean.FALSE;
return null;
}
示例7: 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;
}
示例8: canRewriteTarget
private boolean canRewriteTarget(File source, FileObject targetFO) {
FileObject sourceFO = FileUtil.toFileObject(source);
if (sourceFO != null && sourceFO.equals(targetFO)) {
return false;
}
NotifyDescriptor d = new NotifyDescriptor.Confirmation(
MessageFormat.format(NbBundle.getMessage(ImportImageWizard.class, "FMT_ReplaceExistingFileQuestion"), // NOI18N
source.getName()),
NbBundle.getMessage(ImportImageWizard.class, "TITLE_FileAlreadyExists"), // NOI18N
NotifyDescriptor.YES_NO_OPTION);
return DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.YES_OPTION;
}
示例9: doConfirm
private boolean doConfirm(Node[] sel) {
String message;
String title;
boolean customDelete = true;
for (int i = 0; i < sel.length; i++) {
if (!Boolean.TRUE.equals(sel[i].getValue("customDelete"))) { // NOI18N
customDelete = false;
break;
}
}
if (customDelete) {
return true;
}
if (sel.length == 1) {
message = NbBundle.getMessage(SafeDeleteAction.class, "MSG_ConfirmDeleteObject", sel[0].getDisplayName() //NOI18N
);
title = NbBundle.getMessage(SafeDeleteAction.class, "MSG_ConfirmDeleteObjectTitle"); //NOI18N
} else {
message = NbBundle.getMessage(SafeDeleteAction.class, "MSG_ConfirmDeleteObjects", Integer.valueOf(sel.length) //NOI18N
);
title = NbBundle.getMessage(SafeDeleteAction.class, "MSG_ConfirmDeleteObjectsTitle"); //NOI18N
}
NotifyDescriptor desc = new NotifyDescriptor.Confirmation(message, title, NotifyDescriptor.YES_NO_OPTION);
return NotifyDescriptor.YES_OPTION.equals(DialogDisplayer.getDefault().notify(desc));
}
示例10: performAction
private void performAction(Savable sc, Node n) {
UserQuestionException userEx = null;
for (;;) {
try {
if (userEx == null) {
sc.save();
} else {
userEx.confirmed();
}
StatusDisplayer.getDefault().setStatusText(
NbBundle.getMessage(SaveAction.class, "MSG_saved", getSaveMessage(sc, n))
);
} catch (UserQuestionException ex) {
NotifyDescriptor nd = new NotifyDescriptor.Confirmation(ex.getLocalizedMessage(),
NotifyDescriptor.YES_NO_OPTION);
Object res = DialogDisplayer.getDefault().notify(nd);
if (NotifyDescriptor.OK_OPTION.equals(res)) {
userEx = ex;
continue;
}
} catch (IOException e) {
Exceptions.attachLocalizedMessage(e,
NbBundle.getMessage(SaveAction.class,
"EXC_notsaved",
getSaveMessage(sc, n),
e.getLocalizedMessage ()));
Logger.getLogger (getClass ().getName ()).log (Level.SEVERE, null, e);
}
break;
}
}
示例11: destroy
@NbBundle.Messages({
"# {0} - Connection name",
"MSG_Confirm_Connection_Delete=Really delete connection {0}?",
"MSG_Confirm_Connection_Delete_Title=Delete Connection"})
@Override
public void destroy() {
NotifyDescriptor d =
new NotifyDescriptor.Confirmation(
Bundle.MSG_Confirm_Connection_Delete(connection.getName()),
Bundle.MSG_Confirm_Connection_Delete_Title(),
NotifyDescriptor.YES_NO_OPTION);
Object result = DialogDisplayer.getDefault().notify(d);
if (!NotifyDescriptor.OK_OPTION.equals(result)) {
return;
}
RP.post(
new Runnable() {
@Override
public void run() {
try {
ConnectionList.getDefault().remove(connection);
} catch (DatabaseException e) {
Exceptions.printStackTrace(e);
}
}
}
);
}
示例12: removeButtonActionPerformed
@Messages({"ManageGroupsPanel.wrn_remove_selected_groups_msg=Are you sure to remove selected groups?",
"ManageGroupsPanel.wrn_remove_selected_groups_title=Confirm remove groups"})
private void removeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeButtonActionPerformed
NotifyDescriptor d = new NotifyDescriptor.Confirmation(Bundle.ManageGroupsPanel_wrn_remove_selected_groups_msg(), Bundle.ManageGroupsPanel_wrn_remove_selected_groups_title(), NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.YES_OPTION) {
removeGroups(Arrays.asList(getSelectedGroups()));
}
}
示例13: perform
@NbBundle.Messages({
"# {0} - image name",
"MSG_PushQuestion=Do you really want to push the image {0} to the registry?"
})
private void perform(final DockerTag tag) {
NotifyDescriptor desc = new NotifyDescriptor.Confirmation(
Bundle.MSG_PushQuestion(tag.getTag()), NotifyDescriptor.YES_NO_OPTION);
if (DialogDisplayer.getDefault().notify(desc) != NotifyDescriptor.YES_OPTION) {
return;
}
RequestProcessor.getDefault().post(new Push(tag));
}
示例14: 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;
}
示例15: actionPerformed
@Messages("MSG_Remove_Module=Do you want to remove the module from the parent POM?")
@Override public void actionPerformed(ActionEvent e) {
NotifyDescriptor nd = new NotifyDescriptor.Confirmation(MSG_Remove_Module(), NotifyDescriptor.YES_NO_OPTION);
Object ret = DialogDisplayer.getDefault().notify(nd);
if (ret == NotifyDescriptor.YES_OPTION) {
FileObject fo = FileUtil.toFileObject(parent.getPOMFile());
ModelOperation<POMModel> operation = new ModelOperation<POMModel>() {
@Override
public void performOperation(POMModel model) {
List<String> modules = model.getProject().getModules();
if (modules != null) {
for (String path : modules) {
File rel = new File(parent.getPOMFile().getParent(), path);
File norm = FileUtil.normalizeFile(rel);
FileObject folder = FileUtil.toFileObject(norm);
if (folder != null && folder.equals(project.getProjectDirectory())) {
model.getProject().removeModule(path);
break;
}
}
}
}
};
org.netbeans.modules.maven.model.Utilities.performPOMModelOperations(fo, Collections.singletonList(operation));
//TODO is the manual reload necessary if pom.xml file is being saved?
NbMavenProject.fireMavenProjectReload(project);
}
}