Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,11 @@ public class NbDialogOperatorTest extends JellyTestCase {
"testBtCancel",
"testBtClose",
"testBtHelp",
"testBtNo",
"testBtOK",
"testBtYes",
"testCancel",
"testClose",
"testHelp",
"testNo",
"testOK",
"testYes"
};

/** constructor required by JUnit
Expand Down Expand Up @@ -123,29 +119,6 @@ public void testCancel() {
assertTrue("Cancel not pushed.", getResult().equals(DialogDescriptor.CANCEL_OPTION));
}

/** Test Yes button getter. */
public void testBtYes() {
new NbDialogOperator(TEST_DIALOG_TITLE).btYes().push();
assertTrue("Yes not detected correctly.", getResult().equals(DialogDescriptor.YES_OPTION));
}

/** Test Yes button pushing. */
public void testYes() {
new NbDialogOperator(TEST_DIALOG_TITLE).yes();
assertTrue("Yes not pushed.", getResult().equals(DialogDescriptor.YES_OPTION));
}

/** Test No button getter. */
public void testBtNo() {
new NbDialogOperator(TEST_DIALOG_TITLE).btNo().push();
assertTrue("No not detected correctly.", getResult().equals(DialogDescriptor.NO_OPTION));
}

/** Test No button pushing. */
public void testNo() {
new NbDialogOperator(TEST_DIALOG_TITLE).no();
assertTrue("No not pushed.", getResult().equals(DialogDescriptor.NO_OPTION));
}
private TestLabel label;

/** Opens modal dialog with OK, Cancel, Yes, No, Close and Help buttons.
Expand All @@ -155,8 +128,6 @@ 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,13 +661,16 @@ protected final void initializeButtons() {
}
currentPrimaryButtons = new Component [primaryOptions.length];
for (int i = 0; i < primaryOptions.length; i++) {
if (primaryOptions[i] == NotifyDescriptor.YES_OPTION) {
currentPrimaryButtons[i] = stdYesButton;
if (primaryOptions[i] == NotifyDescriptor.OK_OPTION ||
primaryOptions[i] == NotifyDescriptor.YES_OPTION) {
if (Arrays.asList(primaryOptions).contains(NotifyDescriptor.NO_OPTION)) {
currentPrimaryButtons[i] = stdYesButton;
} else {
currentPrimaryButtons[i] = stdOKButton;
stdOKButton.setEnabled(descriptor.isValid());
}
} else if (primaryOptions[i] == NotifyDescriptor.NO_OPTION) {
currentPrimaryButtons[i] = stdNoButton;
} else if (primaryOptions[i] == NotifyDescriptor.OK_OPTION) {
currentPrimaryButtons[i] = stdOKButton;
stdOKButton.setEnabled(descriptor.isValid());
} else if (primaryOptions[i] == NotifyDescriptor.CANCEL_OPTION) {
currentPrimaryButtons[i] = stdCancelButton;
} else if (primaryOptions[i] == NotifyDescriptor.CLOSED_OPTION) {
Expand Down
10 changes: 5 additions & 5 deletions platform/openide.dialogs/src/org/openide/NotifyDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,19 @@ public class NotifyDescriptor extends Object {
//

/** Return value if YES is chosen. */
public static final Object YES_OPTION = new Integer(JOptionPane.YES_OPTION);
public static final Object YES_OPTION = JOptionPane.YES_OPTION;

/** Return value if NO is chosen. */
public static final Object NO_OPTION = new Integer(JOptionPane.NO_OPTION);
public static final Object NO_OPTION = JOptionPane.NO_OPTION;

/** Return value if CANCEL is chosen. */
public static final Object CANCEL_OPTION = new Integer(JOptionPane.CANCEL_OPTION);
public static final Object CANCEL_OPTION = JOptionPane.CANCEL_OPTION;

/** Return value if OK is chosen. */
public static final Object OK_OPTION = new Integer(JOptionPane.OK_OPTION);
public static final Object OK_OPTION = JOptionPane.OK_OPTION;

/** Return value if user closes the window without pressing any button. */
public static final Object CLOSED_OPTION = new Integer(JOptionPane.CLOSED_OPTION);
public static final Object CLOSED_OPTION = JOptionPane.CLOSED_OPTION;

//
// Option types
Expand Down
Loading