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


Java NotifyDescriptor.OK_CANCEL_OPTION屬性代碼示例

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


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

示例1: selectPatchContext

private File selectPatchContext() {
    PatchContextChooser chooser = new PatchContextChooser();
    ResourceBundle bundle = NbBundle.getBundle(IDEServicesImpl.class);
    JButton ok = new JButton(bundle.getString("LBL_Apply")); // NOI18N
    JButton cancel = new JButton(bundle.getString("LBL_Cancel")); // NOI18N
    DialogDescriptor descriptor = new DialogDescriptor(
            chooser,
            bundle.getString("LBL_ApplyPatch"), // NOI18N
            true,
            NotifyDescriptor.OK_CANCEL_OPTION,
            ok,
            null);
    descriptor.setOptions(new Object [] {ok, cancel});
    descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.bugtracking.patchContextChooser")); // NOI18N
    File context = null;
    DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
    if (descriptor.getValue() == ok) {
        context = chooser.getSelectedFile();
    }
    return context;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:IDEServicesImpl.java

示例2: performAction

@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,代碼行數:16,代碼來源:IncomingSmsAction.java

示例3: showConfigurationPanel

private AdjustConfigurationPanel showConfigurationPanel(AnalyzerFactory preselectedAnalyzer, String preselected, Configuration configurationToSelect) {
    final NotificationLineSupport[] nls = new NotificationLineSupport[1];
    final DialogDescriptor[] dd = new DialogDescriptor[1];
    ErrorListener errorListener = new ErrorListener() {
        @Override public void setError(String error) {
            nls[0].setErrorMessage(error);
            dd[0].setValid(error == null);
        }
    };
    AdjustConfigurationPanel panel = new AdjustConfigurationPanel(analyzers, preselectedAnalyzer, preselected, configurationToSelect, errorListener);
    DialogDescriptor nd = new DialogDescriptor(panel, Bundle.LBL_Configurations(), true, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.OK_OPTION, null);
    
    nls[0] = nd.createNotificationLineSupport();
    dd[0] = nd;

    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
        return panel;
    }
    
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:RunAnalysisPanel.java

示例4: performAction

@Override
protected void performAction(Node[] activatedNodes) {
    EmulatorControlSupport emulatorControl = activatedNodes[0].getLookup().lookup(EmulatorControlSupport.class);
    if (emulatorControl != null) {
        GpsPanel gpsPanel = new GpsPanel();
        NotifyDescriptor nd = new NotifyDescriptor.Confirmation(gpsPanel, "Set GPS Location", NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
        Object notify = DialogDisplayer.getDefault().notify(nd);
        if (NotifyDescriptor.OK_OPTION.equals(notify)) {
            String ok = emulatorControl.getConsole().sendLocation(gpsPanel.getLo(), gpsPanel.getLa(), gpsPanel.getAl());
            if (ok != null) {
                NotifyDescriptor nd1 = new NotifyDescriptor.Message(ok, NotifyDescriptor.ERROR_MESSAGE);
                DialogDisplayer.getDefault().notifyLater(nd1);
            }
        }
    }
}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:16,代碼來源:SetLocationAction.java

示例5: showModalPanel

/**
 * Basically I18nPanel wrapped by Ok, Cancel and Help buttons shown.
 * Handles OK button.
 */
private void showModalPanel() throws IOException {
    DialogDescriptor dd = new DialogDescriptor(
        createPanel(),
        Util.getString("CTL_InsertI18nDialogTitle"),
        true,
        NotifyDescriptor.OK_CANCEL_OPTION,
        NotifyDescriptor.OK_OPTION,
        DialogDescriptor.DEFAULT_ALIGN,
        new HelpCtx(InsertI18nStringAction.class),
        null
    );
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    dialog.setVisible(true);
    if (dd.getValue() == NotifyDescriptor.OK_OPTION) {
        insertI18nString();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:InsertI18nStringAction.java

示例6: btnAddMimeActionPerformed

private void btnAddMimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddMimeActionPerformed
    List<MimeIdentifier> allMimeItems = loadMimeTypes();
    allMimeItems.removeAll(mimeIdentifiers);
    IdentifierPickerPanel picker = new IdentifierPickerPanel(allMimeItems, extensionIdentifiers);
    final NotifyDescriptor extensionDialog = new NotifyDescriptor(
            picker,
            NbBundle.getMessage(ToDoCustomizer.class, "LBL_PickMime"), //NOI18N
            NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE,
            null,
            NotifyDescriptor.OK_OPTION);
    
    picker.addValidityListener(extensionDialog);
    if (DialogDisplayer.getDefault().notify(extensionDialog) == NotifyDescriptor.OK_OPTION) {
        addSelectedToModel(picker.getSelectedMimeTypes());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:ToDoCustomizer.java

示例7: globalButtonActionPerformed

private void globalButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_globalButtonActionPerformed

    NotifyDescriptor d = new NotifyDescriptor.Confirmation(
            NbBundle.getMessage(FormattingCustomizerPanel.class, "MSG_use_global_settings_confirmation"), //NOI18N
            NbBundle.getMessage(FormattingCustomizerPanel.class, "MSG_use_global_settings_confirmation_title"), //NOI18N
            NotifyDescriptor.OK_CANCEL_OPTION
    );

    if (DialogDisplayer.getDefault().notify(d) == NotifyDescriptor.OK_OPTION) {
        pf.getPreferences("").parent().put(USED_PROFILE, DEFAULT_PROFILE); //NOI18N
        loadButton.setEnabled(false);
        setEnabled(jScrollPane1, false);
    } else {
        projectButton.setSelected(true);
    }

}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:FormattingCustomizerPanel.java

示例8: displayErrorOpenImage

private void displayErrorOpenImage(String messageProperty) {
    DialogDisplayer dd = DialogDisplayer.getDefault();

    String messageMsg = NbBundle.getMessage(BlobFieldTableCellEditor.class,
            messageProperty);
    String titleMsg = NbBundle.getMessage(BlobFieldTableCellEditor.class,
            "openImageError.title");                                //NOI18N

    NotifyDescriptor nd = new NotifyDescriptor(
            messageMsg,
            titleMsg,
            NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.WARNING_MESSAGE,
            new Object[]{NotifyDescriptor.CANCEL_OPTION},
            NotifyDescriptor.CANCEL_OPTION);

    dd.notifyLater(nd);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:BlobFieldTableCellEditor.java

示例9: addURL

private void addURL(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addURL
    final NotifyDescriptor.InputLine nd = new NotifyDescriptor.InputLine(
        NbBundle.getMessage(SelectRootsPanel.class,"TXT_RemoteJavadoc"),
        NbBundle.getMessage(SelectRootsPanel.class,"TXT_RemoteJavadoc_Title"),
        NotifyDescriptor.OK_CANCEL_OPTION,
        NotifyDescriptor.PLAIN_MESSAGE);
    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
        final String inputText = nd.getInputText();
        final DefaultListModel<URI> lm = (DefaultListModel<URI>) sources.getModel();
        final Set<URI> contained = new HashSet<>(Collections.list(lm.elements()));
        int index = sources.getSelectedIndex();
        index = index < 0 ? lm.getSize() : index + 1;
        try {
            URI uri = new URI(inputText);
            if (!contained.contains(uri)) {
                lm.add(index, uri);
                select(Collections.<Integer>singleton(index));
                index++;
            }
        } catch (URISyntaxException ex) {
            DialogDisplayer.getDefault().notify(
                new NotifyDescriptor.Message(
                    NbBundle.getMessage(SelectRootsPanel.class, "TXT_InvalidRoot", inputText),
                    NotifyDescriptor.ERROR_MESSAGE));
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:SelectRootsPanel.java

示例10: renameInvoked

@Override
public void renameInvoked() {
    NotifyDescriptor.InputLine input = new NotifyDescriptor.InputLine(
            NbBundle.getMessage(CodeCustomizer.class, "CTL_RenameLabel"), // NOI18N
            NbBundle.getMessage(CodeCustomizer.class, "CTL_RenameTitle")); // NOI18N
    input.setInputText(customizedComponent.getName());

    if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(input))) {
        // code data must be saved to component before renaming
        retreiveCurrentData();
        CustomCodeData codeData = changedDataMap.get(customizedComponent);
        if (codeData != null) {
            NotifyDescriptor.Confirmation confirm = new NotifyDescriptor.Confirmation(
                    NbBundle.getMessage(CodeCustomizer.class, "CTL_ApplyChangesLabel"), // NOI18N
                    NbBundle.getMessage(CodeCustomizer.class, "CTL_ApplyChangesTitle"), // NOI18N
                    NotifyDescriptor.OK_CANCEL_OPTION);
            if (!NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(confirm)))
                return;

            storeComponent(customizedComponent, codeData, true);
            changedDataMap.remove(customizedComponent);
        }

        try {
            String newName = input.getInputText();
            if (!newName.equals("")) // NOI18N
                customizedComponent.rename(newName);
        }
        catch (IllegalArgumentException e) {
            Exceptions.printStackTrace(e);
            return;
        }

        setupComponentNames();
        codeData = JavaCodeGenerator.getCodeData(customizedComponent);
        codeData.check();
        codeView.setCodeData(customizedComponent.getName(), codeData, getSourceFile(), getSourcePositions());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:39,代碼來源:CodeCustomizer.java

示例11: actionPerformed

@Override
public void actionPerformed (ActionEvent e) {
    NotifyDescriptor nd = new NotifyDescriptor.Confirmation(
            NbBundle.getMessage(VersioningMainMenu.class, "MSG_ConnectAction.confirmation.text", new Object[] { root.getName(), vs.getDisplayName() }), //NOI18N
            NbBundle.getMessage(VersioningMainMenu.class, "LBL_ConnectAction.confirmation.title"), //NOI18N
            NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
    if (DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
        VersioningConfig.getDefault().disconnectRepository(vs, root);
        VersioningManager.getInstance().versionedRootsChanged();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:VersioningMainMenu.java

示例12: actionPerformed

@Override
public void actionPerformed(ActionEvent e) {
    SortPanel panel = new SortPanel();
    NotifyDescriptor categoryNameDialog = new NotifyDescriptor(
            panel,
            NbBundle.getMessage(Actions.class, "MSG_SortDialog"),
            NotifyDescriptor.OK_CANCEL_OPTION,
            NotifyDescriptor.PLAIN_MESSAGE,
            null,
            NotifyDescriptor.OK_OPTION);
    if (DialogDisplayer.getDefault().notify(categoryNameDialog) == NotifyDescriptor.OK_OPTION) {
        panel.saveAttributes();
    }

}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:Actions.java

示例13: onRemove

private void onRemove() {
    NotifyDescriptor nd = new NotifyDescriptor.Confirmation(
        NbBundle.getMessage(QueryController.class, "MSG_RemoveQuery", new Object[] { query.getDisplayName() }), // NOI18N
        NbBundle.getMessage(QueryController.class, "CTL_RemoveQuery"),      // NOI18N
        NotifyDescriptor.OK_CANCEL_OPTION);

    if(DialogDisplayer.getDefault().notify(nd) == NotifyDescriptor.OK_OPTION) {
        Bugzilla.getInstance().getRequestProcessor().post(new Runnable() {
            @Override
            public void run() {
                remove();
            }
        });
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:QueryController.java

示例14: downloadSdkActionPerformed

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,代碼行數:9,代碼來源:BrokenPlatformCustomizer.java

示例15: selectIssue

public static Issue selectIssue(String message, Repository repository, JPanel caller, HelpCtx helpCtx) {
    QuickSearchComboBar bar = new QuickSearchComboBar(caller);
    bar.setRepository(repository);
    bar.setAlignmentX(0f);
    bar.setMaximumSize(new Dimension(Short.MAX_VALUE, bar.getPreferredSize().height));
    JPanel panel = new JPanel();
    BoxLayout layout = new BoxLayout(panel, BoxLayout.PAGE_AXIS);
    panel.setLayout(layout);
    JLabel label = new JLabel();
    Mnemonics.setLocalizedText(label, message);
    panel.add(label);
    label.setLabelFor(bar.getIssueComponent());
    LayoutStyle layoutStyle = LayoutStyle.getInstance();
    int gap = layoutStyle.getPreferredGap(label, bar, LayoutStyle.ComponentPlacement.RELATED, SwingConstants.SOUTH, panel);
    panel.add(Box.createVerticalStrut(gap));
    panel.add(bar);
    panel.add(Box.createVerticalStrut(gap));
    ResourceBundle bundle = NbBundle.getBundle(QuickSearchComboBar.class);
    JLabel hintLabel = new JLabel(bundle.getString("MSG_SelectIssueHint")); // NOI18N
    hintLabel.setEnabled(false);
    panel.add(hintLabel);
    panel.add(Box.createVerticalStrut(80));
    panel.setBorder(BorderFactory.createEmptyBorder(
            layoutStyle.getContainerGap(panel, SwingConstants.NORTH, null),
            layoutStyle.getContainerGap(panel, SwingConstants.WEST, null),
            0,
            layoutStyle.getContainerGap(panel, SwingConstants.EAST, null)));
    panel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_IssueSelector"));
    Issue issue = null;
    JButton ok = new JButton(bundle.getString("LBL_Select")); // NOI18N
    ok.getAccessibleContext().setAccessibleDescription(ok.getText());
    JButton cancel = new JButton(bundle.getString("LBL_Cancel")); // NOI18N
    cancel.getAccessibleContext().setAccessibleDescription(cancel.getText());
    DialogDescriptor descriptor = new DialogDescriptor(
            panel,
            bundle.getString("LBL_Issues"), // NOI18N
            true,
            NotifyDescriptor.OK_CANCEL_OPTION,
            ok,
            null);
    descriptor.setOptions(new Object [] {ok, cancel});
    descriptor.setHelpCtx(helpCtx);
    DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
    if (descriptor.getValue() == ok) {
        issue = bar.getIssue();
    }
    return issue;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:48,代碼來源:QuickSearchComboBar.java


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