Skip to content

Commit 9277a63

Browse files
Merge pull request #8799 from neilcsmith-net/nd-ints
Remove use of deprecated Integer constructor in NotifyDescriptor
2 parents c3fec61 + c52de5d commit 9277a63

File tree

3 files changed

+13
-39
lines changed

3 files changed

+13
-39
lines changed

harness/jellytools.platform/test/qa-functional/src/org/netbeans/jellytools/NbDialogOperatorTest.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,11 @@ public class NbDialogOperatorTest extends JellyTestCase {
3838
"testBtCancel",
3939
"testBtClose",
4040
"testBtHelp",
41-
"testBtNo",
4241
"testBtOK",
43-
"testBtYes",
4442
"testCancel",
4543
"testClose",
4644
"testHelp",
47-
"testNo",
4845
"testOK",
49-
"testYes"
5046
};
5147

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

126-
/** Test Yes button getter. */
127-
public void testBtYes() {
128-
new NbDialogOperator(TEST_DIALOG_TITLE).btYes().push();
129-
assertTrue("Yes not detected correctly.", getResult().equals(DialogDescriptor.YES_OPTION));
130-
}
131-
132-
/** Test Yes button pushing. */
133-
public void testYes() {
134-
new NbDialogOperator(TEST_DIALOG_TITLE).yes();
135-
assertTrue("Yes not pushed.", getResult().equals(DialogDescriptor.YES_OPTION));
136-
}
137-
138-
/** Test No button getter. */
139-
public void testBtNo() {
140-
new NbDialogOperator(TEST_DIALOG_TITLE).btNo().push();
141-
assertTrue("No not detected correctly.", getResult().equals(DialogDescriptor.NO_OPTION));
142-
}
143-
144-
/** Test No button pushing. */
145-
public void testNo() {
146-
new NbDialogOperator(TEST_DIALOG_TITLE).no();
147-
assertTrue("No not pushed.", getResult().equals(DialogDescriptor.NO_OPTION));
148-
}
149122
private TestLabel label;
150123

151124
/** Opens modal dialog with OK, Cancel, Yes, No, Close and Help buttons.
@@ -155,8 +128,6 @@ protected void showTestDialog(String testDialogTitle) {
155128
Object[] options = new Object[]{
156129
DialogDescriptor.OK_OPTION,
157130
DialogDescriptor.CANCEL_OPTION,
158-
DialogDescriptor.YES_OPTION,
159-
DialogDescriptor.NO_OPTION,
160131
DialogDescriptor.CLOSED_OPTION
161132
};
162133
label = new TestLabel(TEST_DIALOG_LABEL);

platform/core.windows/src/org/netbeans/core/windows/services/NbPresenter.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -661,13 +661,16 @@ protected final void initializeButtons() {
661661
}
662662
currentPrimaryButtons = new Component [primaryOptions.length];
663663
for (int i = 0; i < primaryOptions.length; i++) {
664-
if (primaryOptions[i] == NotifyDescriptor.YES_OPTION) {
665-
currentPrimaryButtons[i] = stdYesButton;
664+
if (primaryOptions[i] == NotifyDescriptor.OK_OPTION ||
665+
primaryOptions[i] == NotifyDescriptor.YES_OPTION) {
666+
if (Arrays.asList(primaryOptions).contains(NotifyDescriptor.NO_OPTION)) {
667+
currentPrimaryButtons[i] = stdYesButton;
668+
} else {
669+
currentPrimaryButtons[i] = stdOKButton;
670+
stdOKButton.setEnabled(descriptor.isValid());
671+
}
666672
} else if (primaryOptions[i] == NotifyDescriptor.NO_OPTION) {
667673
currentPrimaryButtons[i] = stdNoButton;
668-
} else if (primaryOptions[i] == NotifyDescriptor.OK_OPTION) {
669-
currentPrimaryButtons[i] = stdOKButton;
670-
stdOKButton.setEnabled(descriptor.isValid());
671674
} else if (primaryOptions[i] == NotifyDescriptor.CANCEL_OPTION) {
672675
currentPrimaryButtons[i] = stdCancelButton;
673676
} else if (primaryOptions[i] == NotifyDescriptor.CLOSED_OPTION) {

platform/openide.dialogs/src/org/openide/NotifyDescriptor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,19 @@ public class NotifyDescriptor extends Object {
134134
//
135135

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

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

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

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

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

151151
//
152152
// Option types

0 commit comments

Comments
 (0)