Skip to content

Commit 8b6ff42

Browse files
Remove use of deprecated Integer constructor in NotifyDescriptor
This change keeps the existing value relationship with JOptionPane int constants, which involves managing YES and OK now having the same identity. It is no longer possible to maintain both aspects.
1 parent c3fec61 commit 8b6ff42

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

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)