本文整理汇总了Java中org.openide.DialogDescriptor.CLOSED_OPTION属性的典型用法代码示例。如果您正苦于以下问题:Java DialogDescriptor.CLOSED_OPTION属性的具体用法?Java DialogDescriptor.CLOSED_OPTION怎么用?Java DialogDescriptor.CLOSED_OPTION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.openide.DialogDescriptor
的用法示例。
在下文中一共展示了DialogDescriptor.CLOSED_OPTION属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
@Override
public void actionPerformed(ActionEvent e) {
if (ignoreActionEvents) {
return;
}
Object source = e.getSource();
if (source == cbProfile) {
String profile = (String) cbProfile.getSelectedItem();
if (profile != null)
getMutableModel().setCurrentProfile(profile);
getModel().update();
} else if (source == manageButton) {
//remember previous profile state, in case user will cancel dialog
Map<String, Map<ShortcutAction, Set<String>>> modifiedProfiles = getMutableModel().getModifiedProfiles();
Set<String> deletedProfiles = getMutableModel().getDeletedProfiles();
//show manage profiles dialog
final ProfilesPanel profilesPanel = new ProfilesPanel(this);
DialogDescriptor dd = new DialogDescriptor(
profilesPanel,
NbBundle.getMessage(KeymapPanel.class, "CTL_Manage_Keymap_Profiles"),
true, new Object[] { DialogDescriptor.CLOSED_OPTION }, DialogDescriptor.CLOSED_OPTION,
DialogDescriptor.BOTTOM_ALIGN,
new HelpCtx("org.netbeans.modules.options.keymap.ProfilesPanel"),
null
);
DialogDisplayer.getDefault().notify(dd);
final String selectedProfile = profilesPanel.getSelectedProfile();
getMutableModel().setCurrentProfile(selectedProfile);
refreshProfileCombo();
keymapModel.update();
}
return;
}
示例2: testBinaryFilesQuestionContainsOpenActions
public void testBinaryFilesQuestionContainsOpenActions() throws Exception {
EditorCookie c = tryToOpen("\u0003\u0001\u0000");
assertNull(c);
DD.toReturn = DialogDescriptor.CLOSED_OPTION;
OpenCookie open = obj.getCookie(OpenCookie.class);
open.open();
assertNotNull("There was a query", DD.options);
assertEquals("Two options", 2, DD.options.length);
assertEquals(DialogDescriptor.OK_OPTION, DD.options[0]);
assertEquals(DialogDescriptor.CANCEL_OPTION, DD.options[1]);
DD.options = null;
DD.toReturn = DialogDescriptor.OK_OPTION;
open.open();
assertNotNull("There was a query", DD.options);
assertEquals("Still 2 options", 2, DD.options.length);
assertEquals(DialogDescriptor.OK_OPTION, DD.options[0]);
assertEquals(DialogDescriptor.CANCEL_OPTION, DD.options[1]);
c = obj.getCookie(EditorCookie.class);
assertNotNull("Editor cookie created", c);
doRegularCheck(c);
}
示例3: showTestDialog
/** Opens modal dialog with OK, Cancel, Yes, No, Close and Help buttons.
* @param testDialogTitle title of test dialog
*/
protected void showTestDialog(String testDialogTitle) {
Object[] options = new Object[]{
DialogDescriptor.OK_OPTION,
DialogDescriptor.CANCEL_OPTION,
DialogDescriptor.YES_OPTION,
DialogDescriptor.NO_OPTION,
DialogDescriptor.CLOSED_OPTION
};
label = new TestLabel(TEST_DIALOG_LABEL);
DialogDescriptor dd = new DialogDescriptor(label, testDialogTitle, false,
options, null, DialogDescriptor.BOTTOM_ALIGN, null, label);
dd.setHelpCtx(new HelpCtx("org.netbeans.api.javahelp.MASTER_ID"));
DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
}
示例4: actionPerformed
@SuppressWarnings("unchecked")
public void actionPerformed (ActionEvent e) {
// // listener is called twice ...
if (e.getSource () == bOK) {
log.fine("Options Dialog - Ok pressed."); //NOI18N
saveOptionsOffEDT(true);
if (isOpen()) { //WORKARROUND for some bug in NbPresenter
dialog.dispose();
dialog = null;
}
} else if (e.getSource () == bAPPLY) {
log.fine("Options Dialog - Apply pressed."); //NOI18N
saveOptionsOffEDT(false);
bAPPLY.setEnabled(false);
} else
if (e.getSource () == DialogDescriptor.CANCEL_OPTION ||
e.getSource () == DialogDescriptor.CLOSED_OPTION
) {
log.fine("Options Dialog - Cancel pressed."); //NOI18N
optionsPanel.cancel ();
bOK.setEnabled(true);
bAPPLY.setEnabled(false);
if (isOpen()) { //WORKARROUND for some bug in NbPresenter
dialog.dispose();
dialog = null;
}
}
}
示例5: showReport
public static void showReport(String title, List<String> problems) {
if (problems.size() == 0) {
return;
}
ImportProblemsPanel p = new ImportProblemsPanel(problems);
DialogDescriptor dd = new DialogDescriptor (p, title,
true, new Object[]{DialogDescriptor.CLOSED_OPTION}, null,
DialogDescriptor.DEFAULT_ALIGN, null, null);
Dialog dlg = DialogDisplayer.getDefault().createDialog (dd);
dlg.setVisible(true);
}
示例6: showPendingTasks
/** Shows dialog which waits for finishing of pending tasks,
* (currently actions only) and offers to user to leave IDE
* immediatelly interrupting those tasks.
* @return <code>true</code> if to continue with the action
* <code>false</code> if the action to cancel
*/
private static boolean showPendingTasks() {
// Avoid showing the tasks in the dialog when either running internal tests
if (Boolean.getBoolean("netbeans.full.hack") // NOI18N
// or there are no pending tasks.
|| getPendingTasks().isEmpty()) {
return true;
}
EM panel = new EM();
Dialog[] dialog = new Dialog[1];
Node root = new AbstractNode(new PendingChildren());
JButton exitOption = new JButton();
Mnemonics.setLocalizedText(exitOption, NbBundle.getMessage(Install.class, "LAB_EndTasks"));
// No default button.
// exitOption.setDefaultCapable(false);
exitOption.getAccessibleContext().setAccessibleDescription(
NbBundle.getMessage(Install.class, "ACSD_EndTasks"));
PendingDialogCloser closer = new PendingDialogCloser(dialog, exitOption);
panel.getExplorerManager().setRootContext(root);
// closer will autoclose the dialog if all pending tasks finish
panel.getExplorerManager().addPropertyChangeListener(closer);
DialogDescriptor dd = new DialogDescriptor(
panel,
NbBundle.getMessage(Install.class, "CTL_PendingTitle"),
true, // modal
new Object[] {
exitOption,
DialogDescriptor.CANCEL_OPTION
},
exitOption,
DialogDescriptor.DEFAULT_ALIGN,
null,
closer
);
// #33135 - no Help button for this dialog
dd.setHelpCtx(null);
if(!getPendingTasks().isEmpty()) {
root.addNodeListener(closer);
dialog[0] = DialogDisplayer.getDefault().createDialog(dd);
dialog[0].addWindowListener(closer);
dialog[0].setVisible(true);
dialog[0].dispose();
if(dd.getValue() == DialogDescriptor.CANCEL_OPTION
|| dd.getValue() == DialogDescriptor.CLOSED_OPTION) {
return false;
}
}
return true;
}