当前位置: 首页>>代码示例>>Java>>正文


Java DialogDescriptor.CANCEL_OPTION属性代码示例

本文整理汇总了Java中org.openide.DialogDescriptor.CANCEL_OPTION属性的典型用法代码示例。如果您正苦于以下问题:Java DialogDescriptor.CANCEL_OPTION属性的具体用法?Java DialogDescriptor.CANCEL_OPTION怎么用?Java DialogDescriptor.CANCEL_OPTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.openide.DialogDescriptor的用法示例。


在下文中一共展示了DialogDescriptor.CANCEL_OPTION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectPatchName

public boolean selectPatchName () {
    Mnemonics.setLocalizedText(unshelveButton, NbBundle.getMessage(UnshelveChangesAction.class, "CTL_UnshelveChangesPanel.unshelveButton.text")); //NOI18N
    Mnemonics.setLocalizedText(removeButton, NbBundle.getMessage(UnshelveChangesAction.class, "CTL_UnshelveChangesPanel.removeButton.text")); //NOI18N
    DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(UnshelveChangesAction.class, "LBL_UnshelveChangesPanel.title"), //NOI18N
            true, new Object[] { unshelveButton, removeButton, DialogDescriptor.CANCEL_OPTION }, unshelveButton, DialogDescriptor.DEFAULT_ALIGN,
            new HelpCtx("org.netbeans.modules.versioning.shelve.impl.UnshelveChangesAction"), null); //NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    dialog.setVisible(true);
    patchName = panel.cmbPatches.getSelectedItem() instanceof Patch ? ((Patch) panel.cmbPatches.getSelectedItem()).getPatchName().trim() : null;
    removePatchFile = !panel.cbKeepPatchFile.isSelected();
    if (patchName == null) {
        return false;
    } else if (dd.getValue() == unshelveButton) {
        return true;
    } else if (dd.getValue() == removeButton) {
        Utils.post(new Runnable() {
            @Override
            public void run () {
                PatchStorage.getInstance().removePatch(patchName, removePatchFile);
            }
        });
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:UnshelveChangesAction.java

示例2: getResult

static String getResult(String selection, String dlgTitle, String comboLabel, String buttonText) {
    final FindDialogPanel findPanel = getPanel();
    Mnemonics.setLocalizedText(findPanel.acceptButton, NbBundle.getMessage(FindDialogPanel.class, buttonText));
    Mnemonics.setLocalizedText(findPanel.findWhatLabel, NbBundle.getMessage(FindDialogPanel.class, comboLabel));
    if (selection != null) {
        findPanel.setFindText(selection);
    }
    findPanel.selectText();

    DialogDescriptor dd = new DialogDescriptor(findPanel, NbBundle.getMessage(FindDialogPanel.class, dlgTitle),
            true, new Object[] {findPanel.acceptButton, DialogDescriptor.CANCEL_OPTION}, findPanel.acceptButton,
            DialogDescriptor.RIGHT_ALIGN, null, null);
    Object res = DialogDisplayer.getDefault().notify(dd);
    if (res.equals(findPanel.acceptButton)) {
        findPanel.updateHistory();
        regExp = findPanel.chbRegExp.getModel().isSelected();
        matchCase  = findPanel.chbMatchCase.getModel().isSelected();
        NbPreferences.forModule(FindDialogPanel.class).putBoolean(KEY_REGEXP, regExp);
        NbPreferences.forModule(FindDialogPanel.class).putBoolean(KEY_MATCHCASE, matchCase);
        result = findPanel.getPattern();
        return result;
    } else {
        result = null;
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:FindDialogPanel.java

示例3: show

boolean show() {
    okButton = new JButton(NbBundle.getMessage(CreateTag.class, "LBL_CreateTag.OKButton.text")); //NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
    dd = new DialogDescriptor(panel, NbBundle.getMessage(CreateTag.class, "LBL_CreateTag.title"), true,  //NOI18N
            new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(CreateTag.class), null);
    validate();
    revisionPicker.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange (PropertyChangeEvent evt) {
            if (evt.getPropertyName() == RevisionDialogController.PROP_VALID) {
                setRevisionValid(Boolean.TRUE.equals(evt.getNewValue()));
            }
        }
    });
    panel.tagNameField.getDocument().addDocumentListener(this);
    panel.tagMessageField.getDocument().addDocumentListener(this);
    panel.cbForceUpdate.addActionListener(this);
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.setVisible(true);
    return okButton == dd.getValue();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CreateTag.java

示例4: open

public boolean open () {
    dd = new DialogDescriptor(panel, NbBundle.getMessage(RevisionPicker.class, "LBL_RevisionPickerDialog.title"), //NOI18N
            true, new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("org.netbeans.modules.git.ui.repository.RevisionPickerDialog"), null); //NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    updateDialogState();
    browserPanel.addPropertyChangeListener(this);
    Preferences prefs = GitModuleConfig.getDefault().getPreferences();
    WindowListener windowListener = new DialogBoundsPreserver(prefs, this.getClass().getName());
    dialog.addWindowListener(windowListener);
    windowListener.windowOpened(new WindowEvent(dialog, WindowEvent.WINDOW_OPENED));
    dialog.pack();
    updateSliders(prefs);
    dialog.setVisible(true);
    persistSliders(prefs);
    browserPanel.removePropertyChangeListener(this);
    return dd.getValue() == okButton;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:RevisionPicker.java

示例5: selectFeature

private static ProfilerFeature selectFeature(Set<ProfilerFeature> features, String actionName) {
    UI ui = UI.selectFeature(features);

    HelpCtx helpCtx = new HelpCtx("SelectFeatureDialog.HelpCtx"); // NOI18N // TODO: should have a special one?
    String caption = actionName == null ? Bundle.ProfilerSessions_selectFeature() : actionName;
    DialogDescriptor dd = new DialogDescriptor(ui, caption, true, new Object[]
                                             { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION },
                                               DialogDescriptor.OK_OPTION, DialogDescriptor.BOTTOM_ALIGN,
                                               helpCtx, null);
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.setVisible(true);
    
    ProfilerFeature ret = dd.getValue() == DialogDescriptor.OK_OPTION ? ui.selectedFeature() : null;
    
    dd.setMessage(null); // Do not leak because of WindowsPopupMenuUI.mnemonicListener
    
    return ret;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ProfilerSessions.java

示例6: show

boolean show() {        
    JButton okButton = new JButton(NbBundle.getMessage(RevertChanges.class, "LBL_RevertChanges.OKButton.text")); //NOI18N
    org.openide.awt.Mnemonics.setLocalizedText(okButton, okButton.getText());
    String label;
    if (roots.length != 1) {
        label = NbBundle.getMessage(RevertChanges.class, "CTL_RevertChanges.title.files", roots.length); //NOI18N
    } else if (Git.getInstance().getFileStatusCache().getStatus(roots[0]).isDirectory()) {
        label = NbBundle.getMessage(RevertChanges.class, "CTL_RevertChanges.title.dir", roots[0].getName()); //NOI18N
    } else {
        label = NbBundle.getMessage(RevertChanges.class, "CTL_RevertChanges.title.file", roots[0].getName()); //NOI18N
    }
    DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(RevertChanges.class, "CTL_RevertChanges.title", label), true,  //NOI18N
            new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(RevertChanges.class), null);
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    d.setVisible(true);
    return okButton == dd.getValue();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:RevertChanges.java

示例7: resolve

@Override
@NonNull
@NbBundle.Messages({
    "TXT_FixBrokenPlatform=Resolve Broken Platform",
    "LBL_OK=&OK"
})
public Future<ProjectProblemsProvider.Result> resolve() {
    final JButton ok = new JButton();
    Mnemonics.setLocalizedText(ok, LBL_OK());
    final FixPlatform fixPlatform = new FixPlatform(
            propertyName,
            id,
            platformType,
            eval,
            helper,
            callback,
            ok);
    final DialogDescriptor dd = new DialogDescriptor(
            fixPlatform,
            TXT_FixBrokenPlatform(),
            true,
            new Object[] {
                ok,
                DialogDescriptor.CANCEL_OPTION
            },
            ok,
            DialogDescriptor.DEFAULT_ALIGN,
            null,
            null);
    if (DialogDisplayer.getDefault().notify(dd) == ok) {
        return fixPlatform.resolve();
    } else {
        return new Done(ProjectProblemsProvider.Result.create(ProjectProblemsProvider.Status.UNRESOLVED));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:ProjectProblemsProviders.java

示例8: showShortcutsDialog

@Override
public String showShortcutsDialog() {
    final ShortcutsDialog d = new ShortcutsDialog ();
    d.init(this);
    final DialogDescriptor descriptor = new DialogDescriptor (
        d,
        loc ("Add_Shortcut_Dialog"),
        true,
        new Object[] {
            DialogDescriptor.OK_OPTION,
            DialogDescriptor.CANCEL_OPTION
        },
        DialogDescriptor.OK_OPTION,
        DialogDescriptor.DEFAULT_ALIGN,
        null, 
        d.getListener()
    );
    descriptor.setClosingOptions (new Object[] {
        DialogDescriptor.OK_OPTION,
        DialogDescriptor.CANCEL_OPTION
    });
    descriptor.setAdditionalOptions (new Object [] {
        d.getBClear(), d.getBTab()
    });
    descriptor.setValid(d.isShortcutValid());
    d.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName() == null || ShortcutsDialog.PROP_SHORTCUT_VALID.equals(evt.getPropertyName())) {
                descriptor.setValid(d.isShortcutValid());
            }
        }
    });
    
    DialogDisplayer.getDefault ().notify (descriptor);
    if (descriptor.getValue () == DialogDescriptor.OK_OPTION)
        return d.getTfShortcut().getText ();
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:ShortcutsFinderImpl.java

示例9: stopCellEditing

@Override
public boolean stopCellEditing() {
    String s = cell.toString();
    Window ancestorWindow = (Window)SwingUtilities.getRoot(cell);
    // #236458: options are now saved asynchronously. If the dialog was to 
    if (ancestorWindow == null) {
        return true;
    }
    // HACK: if this Editor creates a dialog, it will lose the focus and Swing
    // will remove the editor, calling JTable.cancelEditing. Any re-selections performed
    // by the JTable will occur BEFORE the dialog is finished, so we need to
    // reestablish the column selection later from here.
    // This binds the BCEditor to the KeymapTable layout / internals.
    JTable parent = (JTable)cell.getParent();
    
    ShortcutAction sca = (ShortcutAction) action;
    Set<ShortcutAction> conflictingAction = model.getMutableModel().findActionForShortcutPrefix(s);
    conflictingAction.remove(sca); //remove the original action
    
    Collection<ShortcutAction> sameScopeActions = model.getMutableModel().filterSameScope(conflictingAction, sca);
    
    if (!conflictingAction.isEmpty()) {
         if (!SwingUtilities.isEventDispatchThread()) {
             // #236458: options are now saved asynchronously, off EDT. If we display dialog, the IDE will lock up.
            cell.getTextField().setText(orig);
            fireEditingCanceled();
            return true;
         }
        //there is a conflicting action, show err dialog
        Object overrride = overrride(conflictingAction, sameScopeActions);
        
        // bring the focus back
        ancestorWindow.toFront();
        parent.requestFocus();
        if (overrride.equals(DialogDescriptor.YES_OPTION)) {
            for (ShortcutAction sa : conflictingAction) {
                removeConflictingShortcut(sa, s); //remove all conflicting shortcuts
            }
            //proceed with override
        } else if (overrride == DialogDescriptor.CANCEL_OPTION) {
            cell.getTextField().setText(orig);
            fireEditingCanceled();
            setBorderEmpty();
            return true;
        }
        // NO_OPTION fallls through and adds additional shortcut.
    }
    cell.getTextField().removeActionListener(delegate);
    cell.getTextField().removeKeyListener(escapeAdapter);
    model.getMutableModel().removeShortcut((ShortcutAction) action, orig);
    if (!(s.length() == 0)) // do not add empty shortcuts
        model.getMutableModel().addShortcut((ShortcutAction) action, s);
    fireEditingStopped();
    setBorderEmpty();
    model.update();
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:57,代码来源:ButtonCellEditor.java

示例10: showInWindow

public static URL showInWindow() {
    JButton openBtn = new JButton();
    Mnemonics.setLocalizedText(openBtn, NbBundle.getMessage(ReferencesPanel.class, "ReferencesPanel.ok.text"));
    openBtn.getAccessibleContext().setAccessibleDescription(openBtn.getText());
    openBtn.setEnabled(false);

    final Object[] buttons = new Object[] { openBtn, DialogDescriptor.CANCEL_OPTION };

    ReferencesPanel panel = new ReferencesPanel(openBtn);
    DialogDescriptor desc = new DialogDescriptor(
            panel,
            NbBundle.getMessage(ReferencesPanel.class, "ReferencesPanel.title"),
            true,
            buttons,
            openBtn,
            DialogDescriptor.DEFAULT_ALIGN,
            HelpCtx.DEFAULT_HELP,
            null);
    desc.setClosingOptions(buttons);

    Dialog dialog = DialogDisplayer.getDefault().createDialog(desc);
    dialog.getAccessibleContext().setAccessibleName(NbBundle.getMessage(ReferencesPanel.class, "AN_ReferencesDialog"));
    dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(ReferencesPanel.class, "AD_ReferencesDialog"));

    // schedule computing indices
    RP.post(panel);
    dialog.setVisible(true);
    dialog.dispose();

    return desc.getValue() == openBtn
            ? panel.getSelectedItem()
            : null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:ReferencesPanel.java

示例11: compareExternalSnapshots

private void compareExternalSnapshots() {
    DialogDescriptor desc = new DialogDescriptor(getExternalSnapshotsSelector(), Bundle.CompareSnapshotsAction_SelectSnapshotsDialogCaption(), true,
                                                 new Object[] {
                                                     getExternalSnapshotsSelector().getOKButton(),
                                                     DialogDescriptor.CANCEL_OPTION
                                                 }, DialogDescriptor.OK_OPTION, 0, EXTERNAL_SNAPSHOT_HELP_CTX, null);
    Object res = DialogDisplayer.getDefault().notify(desc);

    if (res.equals(getExternalSnapshotsSelector().getOKButton())) {
        ResultsManager.getDefault()
                      .compareSnapshots(FileUtil.toFileObject(new File(getExternalSnapshotsSelector().getSnapshot1Filename())),
                                        FileUtil.toFileObject(new File(getExternalSnapshotsSelector().getSnapshot2Filename())));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:CompareSnapshotsAction.java

示例12: getIssueString

public String getIssueString() {

            final DialogDescriptor dd = new DialogDescriptor(this, Bundle.IssueNumberDialog_DialogCaption(), true,
                    new Object[]{okButton, DialogDescriptor.CANCEL_OPTION},
                    okButton, DialogDescriptor.BOTTOM_ALIGN, null, null);
            final Dialog d = DialogDisplayer.getDefault().createDialog(dd);
            d.setVisible(true);

            if (dd.getValue() == okButton) {
                return Integer.toString(Integer.parseInt(issueField.getText().trim()));
            } else {
                return null;
            }
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:AttachToBugAction.java

示例13: askPassword

@Override
public boolean askPassword(ExecutionEnvironment execEnv, String prompt) {
    tfUser.setText(execEnv.getUser());
    String hostName = execEnv.getHost();
    if (execEnv.getSSHPort() != 22) {
        hostName += ":" + execEnv.getSSHPort(); //NOI18N
    }
    tfHost.setText(hostName); // NOI18N
    cbRememberPwd.setSelected(PasswordManager.getInstance().isRememberPassword(execEnv));

    DialogDescriptor dd = new DialogDescriptor(this,
            loc("TITLE_Password"), true, // NOI18N
            new Object[]{
                DialogDescriptor.OK_OPTION,
                DialogDescriptor.CANCEL_OPTION},
            DialogDescriptor.OK_OPTION,
            DialogDescriptor.DEFAULT_ALIGN, null, null);

    Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
    dialog.setResizable(false);

    try {
        dialog.setVisible(true);
    } catch (Throwable th) {
        if (!(th.getCause() instanceof InterruptedException)) {
            throw new RuntimeException(th);
        }
        dd.setValue(DialogDescriptor.CANCEL_OPTION);
    } finally {
        dialog.dispose();
    }

    return dd.getValue() == DialogDescriptor.OK_OPTION;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:PasswordDlg.java

示例14: open

@NbBundle.Messages({
    "BranchSelector.okButton.text=&OK",
    "BranchSelector.title=Select Branch"
})
public boolean open () {
    okButton = new JButton();
    org.openide.awt.Mnemonics.setLocalizedText(okButton, Bundle.BranchSelector_okButton_text());
    dd = new DialogDescriptor(panel, Bundle.BranchSelector_title(), true,
            new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton,
            DialogDescriptor.DEFAULT_ALIGN, null, null);
    revisionPicker.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange (PropertyChangeEvent evt) {
            if (evt.getPropertyName() == RevisionDialogController.PROP_VALID) {
                setRevisionValid(Boolean.TRUE.equals(evt.getNewValue()));
            } else if (evt.getPropertyName() == RevisionDialogController.PROP_REVISION_ACCEPTED) {
                if (dd.isValid()) {
                    okButton.doClick();
                }
            }
        }
    });
    Dialog d = DialogDisplayer.getDefault().createDialog(dd);
    okButton.setEnabled(false);
    d.setVisible(true);
    return okButton == dd.getValue();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:BranchSelector.java

示例15: showDialog

void showDialog () {
    DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(CreateTag.class, "LBL_TagManagerPanel.title", repository.getName()), //NOI18N
            true, new Object[] { DialogDescriptor.OK_OPTION, DialogDescriptor.CANCEL_OPTION },
            DialogDescriptor.OK_OPTION, DialogDescriptor.DEFAULT_ALIGN,
            new HelpCtx("org.netbeans.modules.mercurial.ui.tag.TagManagerPanel"), null); //NOI18N
    dialog = DialogDisplayer.getDefault().createDialog(dd);
    loadRevisions();
    dialog.setVisible(true);
    HgProgressSupport supp = backgroundSupport;
    if (supp != null) {
        supp.cancel();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:TagManager.java


注:本文中的org.openide.DialogDescriptor.CANCEL_OPTION属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。