diff --git a/harness/jellytools.platform/test/qa-functional/src/org/netbeans/jellytools/NbDialogOperatorTest.java b/harness/jellytools.platform/test/qa-functional/src/org/netbeans/jellytools/NbDialogOperatorTest.java index 7890189fb021..324f0d6d1080 100644 --- a/harness/jellytools.platform/test/qa-functional/src/org/netbeans/jellytools/NbDialogOperatorTest.java +++ b/harness/jellytools.platform/test/qa-functional/src/org/netbeans/jellytools/NbDialogOperatorTest.java @@ -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 @@ -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. @@ -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); diff --git a/platform/core.windows/src/org/netbeans/core/windows/services/NbPresenter.java b/platform/core.windows/src/org/netbeans/core/windows/services/NbPresenter.java index 74ed8553bf7c..2e87c0d4b950 100644 --- a/platform/core.windows/src/org/netbeans/core/windows/services/NbPresenter.java +++ b/platform/core.windows/src/org/netbeans/core/windows/services/NbPresenter.java @@ -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) { diff --git a/platform/openide.dialogs/src/org/openide/NotifyDescriptor.java b/platform/openide.dialogs/src/org/openide/NotifyDescriptor.java index 263ce9383694..dcd1ef2daccf 100644 --- a/platform/openide.dialogs/src/org/openide/NotifyDescriptor.java +++ b/platform/openide.dialogs/src/org/openide/NotifyDescriptor.java @@ -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