當前位置: 首頁>>代碼示例>>Java>>正文


Java NotifyDescriptor.Confirmation方法代碼示例

本文整理匯總了Java中org.openide.NotifyDescriptor.Confirmation方法的典型用法代碼示例。如果您正苦於以下問題:Java NotifyDescriptor.Confirmation方法的具體用法?Java NotifyDescriptor.Confirmation怎麽用?Java NotifyDescriptor.Confirmation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.NotifyDescriptor的用法示例。


在下文中一共展示了NotifyDescriptor.Confirmation方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: saveAs

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:SQLEditorSupport.java

示例2: save

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@Override
public void save() throws IOException {
    FileChooserBuilder fchb = new FileChooserBuilder(ScreenshotComponent.class);
    String[] writerFileSuffixes = ImageIO.getWriterFileSuffixes();
    fchb.setFileFilter(new FileNameExtensionFilter(Bundle.CTL_ImageFiles(), writerFileSuffixes));
    File file = fchb.showSaveDialog();
    if (file != null) {
        if (file.exists()) {
            NotifyDescriptor nd = new NotifyDescriptor.Confirmation(Bundle.MSG_Overwrite(file.getName()), toString());
            Object doOverwrite = DialogDisplayer.getDefault().notify(nd);
            if (!NotifyDescriptor.YES_OPTION.equals(doOverwrite)) {
                return ;
            }
        }
        canvas.save(file);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:ScreenshotComponent.java

示例3: selectAll

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:AbstractOutputPane.java

示例4: performAction

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@Override
protected void performAction(Node[] activatedNodes) {
    EmulatorControlSupport emulatorControl = activatedNodes[0].getLookup().lookup(EmulatorControlSupport.class);
    if (emulatorControl != null) {
        SmsPanel smsPanel = new SmsPanel();
        NotifyDescriptor nd = new NotifyDescriptor.Confirmation(smsPanel, "Incoming SMS", NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
        Object notify = DialogDisplayer.getDefault().notify(nd);
        if (NotifyDescriptor.OK_OPTION.equals(notify)) {
            String ok = emulatorControl.getConsole().sendSms(smsPanel.getPhoneNumber(), smsPanel.getText().replace("\\", "\\\\").replace("\n", "\n"));
            if (ok != null) {
                NotifyDescriptor nd1 = new NotifyDescriptor.Message(ok, NotifyDescriptor.ERROR_MESSAGE);
                DialogDisplayer.getDefault().notifyLater(nd1);
            }
        }
    }
}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:17,代碼來源:IncomingSmsAction.java

示例5: destroy

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@NbBundle.Messages({
    "# {0} - Database name",
    "MSG_Confirm_DB_Delete=Really delete database {0}?",
    "MSG_Confirm_DB_Delete_Title=Delete Database"})
@Override
public void destroy() {
    NotifyDescriptor d =
            new NotifyDescriptor.Confirmation(
            Bundle.MSG_Confirm_DB_Delete(model.getDbName()),
            Bundle.MSG_Confirm_DB_Delete_Title(),
            NotifyDescriptor.YES_NO_OPTION);
    Object result = DialogDisplayer.getDefault().notify(d);
    if (!NotifyDescriptor.OK_OPTION.equals(result)) {
        return;
    }
    DatabaseServer server = model.getServer();
    String dbname = model.getDbName();

    server.dropDatabase(dbname);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:DatabaseNode.java

示例6: waitStart

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:39,代碼來源:RegisterDerby.java

示例7: addFilterSetting

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
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();
    }
}
 
開發者ID:arodchen,項目名稱:MaxSim,代碼行數:37,代碼來源:FilterTopComponent.java

示例8: confirm

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
/**
 * Display confirmation message box with message
 * @param text message that will be displayed
    * @return True if user confirmed. 
 */
public static boolean confirm(String text) {
	NotifyDescriptor.Confirmation desc = new NotifyDescriptor.Confirmation(text);
	DialogDisplayer.getDefault().notify(desc);
       
       return desc.getValue() == NotifyDescriptor.YES_OPTION;
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:12,代碼來源:PGSupport.java

示例9: canRewriteTarget

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:ImportImageWizard.java

示例10: changeFolderActionPerformed

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
private void changeFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeFolderActionPerformed
    SDKVisualPanelSelect visualPanelSelect = new SDKVisualPanelSelect();
    visualPanelSelect.setSdkName(platform.getDisplayName());
    NotifyDescriptor nd = new NotifyDescriptor.Confirmation(visualPanelSelect, "Select New Android SDK location", NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
    Object notify = DialogDisplayer.getDefault().notify(nd);
    if (NotifyDescriptor.OK_OPTION.equals(notify)) {
        String sdkPath = visualPanelSelect.getSdkPath();
        platform.setSdkRootFolder(sdkPath);
        listener.sdkValid();
    }
}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:12,代碼來源:BrokenPlatformCustomizer.java

示例11: doConfirm

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@Messages({
    "# {0} - name", "MSG_ConfirmDeleteObject=Are you sure you want to delete {0}?",
    "MSG_ConfirmDeleteObjectTitle=Confirm Object Deletion",
    "# {0} - number of objects", "MSG_ConfirmDeleteObjects=Are you sure you want to delete these {0} items?",
    "MSG_ConfirmDeleteObjectsTitle=Confirm Multiple Object Deletion"
})
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 = MSG_ConfirmDeleteObject(
                sel[0].getDisplayName()
            );
        title = MSG_ConfirmDeleteObjectTitle();
    } else {
        message = MSG_ConfirmDeleteObjects(
                Integer.valueOf(sel.length)
            );
        title = MSG_ConfirmDeleteObjectsTitle();
    }

    NotifyDescriptor desc = new NotifyDescriptor.Confirmation(message, title, NotifyDescriptor.YES_NO_OPTION);

    return NotifyDescriptor.YES_OPTION.equals(DialogDisplayer.getDefault().notify(desc));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:40,代碼來源:ExplorerActionsImpl.java

示例12: checkReload

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
/** Handles the actual reload of document.
* @param doReload false if we should first ask the user
*/
private void checkReload(JEditorPane[] openedPanes, boolean doReload) {
    StyledDocument d;

    synchronized (getLock()) {
        d = getDoc(); // Hold reference to document being reloaded
    }

    if (!doReload && !reloadDialogOpened) {
        String msg = NbBundle.getMessage(
                CloneableEditorSupport.class, "FMT_External_change", // NOI18N
                d.getProperty(javax.swing.text.Document.TitleProperty)
            );

        NotifyDescriptor nd = new NotifyDescriptor.Confirmation(msg, NotifyDescriptor.YES_NO_OPTION);

        reloadDialogOpened = true;

        try {
            Object ret = DialogDisplayer.getDefault().notify(nd);

            if (NotifyDescriptor.YES_OPTION.equals(ret)) {
                doReload = true;
            }
        } finally {
            reloadDialogOpened = false;
        }
    }

    if (doReload) {
        openClose.reload(openedPanes);

        // Call just for compatibility but this has no effect since the code will not wait
        // for the returned task anyway
        reloadDocument();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:40,代碼來源:CloneableEditorSupport.java

示例13: removeAllButtonActionPerformed

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@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());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:ManageGroupsPanel.java

示例14: destroy

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
@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);
                }
            }
        }
    );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:ConnectionNode.java

示例15: downloadSdkActionPerformed

import org.openide.NotifyDescriptor; //導入方法依賴的package包/類
private void downloadSdkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadSdkActionPerformed
    PanelDownloadToBrokenSDK panelDownloadToBrokenSDK = new PanelDownloadToBrokenSDK(platform);
    NotifyDescriptor nd = new NotifyDescriptor.Confirmation(panelDownloadToBrokenSDK, "Install Android SDK to broken folder", NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
    Object notify = DialogDisplayer.getDefault().notify(nd);
    if (NotifyDescriptor.OK_OPTION.equals(notify)) {
        platform.setSdkRootFolder(platform.getSdkPath());
        listener.sdkValid();
    }
}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:10,代碼來源:BrokenPlatformCustomizer.java


注:本文中的org.openide.NotifyDescriptor.Confirmation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。