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


Java NotifyDescriptor.DEFAULT_OPTION屬性代碼示例

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


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

示例1: getFileContentsAsByteArray

private static byte[] getFileContentsAsByteArray (File file) throws IOException {
    long length = file.length();
    if(length > 1024 * 10) {
        NotifyDescriptor nd =
            new NotifyDescriptor(
                NbBundle.getMessage(TemplateSelector.class, "MSG_FileTooBig"),
                NbBundle.getMessage(TemplateSelector.class, "LBL_FileTooBig"),    // NOI18N
                NotifyDescriptor.DEFAULT_OPTION,
                NotifyDescriptor.WARNING_MESSAGE,
                new Object[] {NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION},
                NotifyDescriptor.OK_OPTION);
        if(DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.OK_OPTION) {
            return null;
        }
    }

    return FileUtils.getFileContentsAsByteArray(file);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:TemplateSelector.java

示例2: open

/** Either opens the in text editor or asks user questions.
 */
public void open() {
    EditorCookie ic = getCookie(EditorCookie.class);
    if (ic != null) {
        ic.open();
    } else {
        // ask a query 
        List<Object> options = new ArrayList<Object>();
        options.add (NotifyDescriptor.OK_OPTION);
        options.add (NotifyDescriptor.CANCEL_OPTION);
        NotifyDescriptor nd = new NotifyDescriptor (
            NbBundle.getMessage (DefaultDataObject.class, "MSG_BinaryFileQuestion"),
            NbBundle.getMessage (DefaultDataObject.class, "MSG_BinaryFileWarning"),
            NotifyDescriptor.DEFAULT_OPTION,
            NotifyDescriptor.QUESTION_MESSAGE,
            options.toArray(), null
        );
        Object ret = DialogDisplayer.getDefault().notify (nd);
        if (ret != NotifyDescriptor.OK_OPTION) {
            return;
        }
        
        EditorCookie c = getCookie(EditorCookie.class, true);
        c.open ();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:DefaultDataObject.java

示例3: saveAs

/**
 * Invokes a file dialog and if a file is chosen, saves the output to that file.
 */
void saveAs() {
    OutWriter out = getOut();
    if (out == null) {
        return;
    }
    File f = showFileChooser(this);
    if (f != null) {
        try {
            synchronized (out) {
                out.getLines().saveAs(f.getPath());
            }
        } catch (IOException ioe) {
            NotifyDescriptor notifyDesc = new NotifyDescriptor(
                    NbBundle.getMessage(OutputTab.class, "MSG_SaveAsFailed", f.getPath()),
                    NbBundle.getMessage(OutputTab.class, "LBL_SaveAsFailedTitle"),
                    NotifyDescriptor.DEFAULT_OPTION,
                    NotifyDescriptor.ERROR_MESSAGE,
                    new Object[]{NotifyDescriptor.OK_OPTION},
                    NotifyDescriptor.OK_OPTION);

            DialogDisplayer.getDefault().notify(notifyDesc);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:OutputTab.java

示例4: notifyError

public static void notifyError (String errorLabel, String errorMessage) {
    NotifyDescriptor nd = new NotifyDescriptor(
        errorMessage,
        errorLabel,
        NotifyDescriptor.DEFAULT_OPTION,
        NotifyDescriptor.ERROR_MESSAGE,
        new Object[]{NotifyDescriptor.OK_OPTION},
        NotifyDescriptor.OK_OPTION);
    DialogDisplayer.getDefault().notify(nd);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:GitUtils.java

示例5: annotate

public static void annotate (String msg) {
    CommandReport report = new CommandReport(NbBundle.getMessage(GitClientExceptionHandler.class, "MSG_SubversionCommandError"), msg); //NOI18N
    JButton ok = new JButton(NbBundle.getMessage(GitClientExceptionHandler.class, "CTL_CommandReport_OK")); //NOI18N
    NotifyDescriptor descriptor = new NotifyDescriptor(
            report,
            NbBundle.getMessage(GitClientExceptionHandler.class, "MSG_CommandFailed_Title"), //NOI18N
            NotifyDescriptor.DEFAULT_OPTION,
            NotifyDescriptor.ERROR_MESSAGE,
            new Object [] { ok },
            ok);
    DialogDisplayer.getDefault().notify(descriptor);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:GitClientExceptionHandler.java

示例6: notifyImportImpossible

private void notifyImportImpossible(String msg) {
    NotifyDescriptor nd =
        new NotifyDescriptor(
            msg,
            NbBundle.getMessage(InitAction.class, "MSG_ImportNotAllowed"), // NOI18N
            NotifyDescriptor.DEFAULT_OPTION,
            NotifyDescriptor.WARNING_MESSAGE,
            new Object[] {NotifyDescriptor.OK_OPTION},
            NotifyDescriptor.OK_OPTION);
    DialogDisplayer.getDefault().notify(nd);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:InitAction.java

示例7: displayErrorMessage

public static void displayErrorMessage(String message) {
    NotifyDescriptor ndesc = new NotifyDescriptor(
            message, 
            Utils.getBundle().getString("MSG_ErrorDialogTitle"),
            NotifyDescriptor.DEFAULT_OPTION,
            NotifyDescriptor.ERROR_MESSAGE, 
            new Object[] { NotifyDescriptor.OK_OPTION },
            NotifyDescriptor.OK_OPTION);

    DialogDisplayer.getDefault().notify(ndesc);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:Utils.java

示例8: annotate

public static void annotate(String msg) {        
    CommandReport report = new CommandReport(NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_SubversionCommandError"), msg);
    JButton ok = new JButton(NbBundle.getMessage(SvnClientExceptionHandler.class, "CTL_CommandReport_OK"));
    NotifyDescriptor descriptor = new NotifyDescriptor(
            report, 
            NbBundle.getMessage(SvnClientExceptionHandler.class, "MSG_CommandFailed_Title"), 
            NotifyDescriptor.DEFAULT_OPTION,
            NotifyDescriptor.ERROR_MESSAGE,
            new Object [] { ok },
            ok);
    DialogDisplayer.getDefault().notify(descriptor);        
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:SvnClientExceptionHandler.java

示例9: notifyImportImpossible

private void notifyImportImpossible(String msg) {
    LOG.log(Level.FINE, "Import impossible: {0}", msg);
    NotifyDescriptor nd =
        new NotifyDescriptor(
            msg,
            NbBundle.getMessage(ImportAction.class, "MSG_ImportNotAllowed"), // NOI18N
            NotifyDescriptor.DEFAULT_OPTION,
            NotifyDescriptor.WARNING_MESSAGE,
            new Object[] {NotifyDescriptor.OK_OPTION},
            NotifyDescriptor.OK_OPTION);
    DialogDisplayer.getDefault().notify(nd);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ImportAction.java

示例10: notifyErrorMessage

static void notifyErrorMessage(String msg) {
    if("true".equals(System.getProperty("netbeans.t9y.throwOnClientError", "false"))) { // NOI18N
        Bugzilla.LOG.info(msg);
        throw new AssertionError(msg);
    }
    NotifyDescriptor nd =
            new NotifyDescriptor(
                msg,
                NbBundle.getMessage(BugzillaExecutor.class, "LBLError"),    // NOI18N
                NotifyDescriptor.DEFAULT_OPTION,
                NotifyDescriptor.ERROR_MESSAGE,
                new Object[] {NotifyDescriptor.OK_OPTION},
                NotifyDescriptor.OK_OPTION);
    DialogDisplayer.getDefault().notify(nd);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:BugzillaExecutor.java

示例11: cancelledAction

private void cancelledAction() {
    JButton ok = new JButton(NbBundle.getMessage(ExceptionHandler.class, "CTL_Action_OK")); // NOI18N
    NotifyDescriptor descriptor = new NotifyDescriptor(
            ACTION_CANCELED_BY_USER,
            NbBundle.getMessage(ExceptionHandler.class, "CTL_ActionCanceled_Title"), // NOI18N
            NotifyDescriptor.DEFAULT_OPTION,
            NotifyDescriptor.WARNING_MESSAGE,
            new Object [] { ok },
            ok);
    DialogDisplayer.getDefault().notify(descriptor);        
    return;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ExceptionHandler.java

示例12: notifyParsingError

/**
 * Notifies user of parsing error.
 */
public static void notifyParsingError() {
    NotifyDescriptor nd = new NotifyDescriptor(
            NbBundle.getMessage(HgModuleConfig.class, "MSG_ParsingError"), // NOI18N
            NbBundle.getMessage(HgModuleConfig.class, "LBL_ParsingError"), // NOI18N
            NotifyDescriptor.DEFAULT_OPTION,
            NotifyDescriptor.ERROR_MESSAGE,
            new Object[]{NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION},
            NotifyDescriptor.OK_OPTION);
    if (EventQueue.isDispatchThread()) {
        DialogDisplayer.getDefault().notify(nd);
    } else {
        DialogDisplayer.getDefault().notifyLater(nd);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:HgModuleConfig.java

示例13: 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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:CreateAction.java

示例14: notifyError

public static void notifyError (final String title, final String message) {
    NotifyDescriptor nd = new NotifyDescriptor(message, title, NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.ERROR_MESSAGE, new Object[] {NotifyDescriptor.OK_OPTION}, NotifyDescriptor.OK_OPTION);
    DialogDisplayer.getDefault().notifyLater(nd);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:Util.java

示例15: notifyError

private static void notifyError (final String title, final String message) {
    NotifyDescriptor nd = new NotifyDescriptor(message, title, NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.ERROR_MESSAGE, new Object[] {NotifyDescriptor.OK_OPTION}, NotifyDescriptor.OK_OPTION);
    DialogDisplayer.getDefault().notifyLater(nd);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:IDEServicesImpl.java


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