Skip to content

Commit b0366bf

Browse files
Merge pull request #4739 from errael/DialogParentMainWindowInsteadOfNull
Dialog parent should not be null
2 parents 8898e37 + 52a0377 commit b0366bf

File tree

32 files changed

+111
-59
lines changed

32 files changed

+111
-59
lines changed

contrib/groovy.grailsproject/src/org/netbeans/modules/groovy/grailsproject/ui/GrailsPluginsPanel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.netbeans.modules.groovy.grailsproject.plugins.GrailsPlugin;
3636
import org.netbeans.modules.groovy.grailsproject.plugins.GrailsPluginSupport;
3737
import org.openide.util.NbBundle;
38+
import org.openide.util.Utilities;
3839

3940
/**
4041
* @author David Calavera
@@ -462,7 +463,7 @@ public String getDescription() {
462463
chooser.setDialogTitle(NbBundle.getMessage(GrailsPluginsPanel.class, "TITLE_BrowsePluginLocation"));
463464
chooser.setApproveButtonText(NbBundle.getMessage(GrailsPluginsPanel.class, "LBL_BrowsePluginLocation_OK_Button"));
464465

465-
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
466+
if (chooser.showOpenDialog(Utilities.findDialogParent()) == JFileChooser.APPROVE_OPTION) {
466467
pluginZipPath.setText(chooser.getSelectedFile().getAbsolutePath());
467468
installButton.setEnabled(true);
468469
}

enterprise/web.jsf.navigation/src/org/netbeans/modules/web/jsf/navigation/NavigationCaseEdge.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.openide.util.Exceptions;
4949
import org.openide.util.HelpCtx;
5050
import org.openide.util.NbBundle;
51+
import org.openide.util.Utilities;
5152

5253
/**
5354
*
@@ -137,7 +138,7 @@ public String getName() {
137138
try {
138139
name = navCase.getFromOutcome() != null ? navCase.getFromOutcome() : navCase.getFromAction();
139140
} catch (IllegalStateException ise){
140-
JOptionPane.showMessageDialog(null, MSG_FacesConfigIllegalStateWarning, TLE_FacesConfigIllegalStateWarning, JOptionPane.WARNING_MESSAGE);
141+
JOptionPane.showMessageDialog(Utilities.findDialogParent(), MSG_FacesConfigIllegalStateWarning, TLE_FacesConfigIllegalStateWarning, JOptionPane.WARNING_MESSAGE);
141142
}
142143
}
143144
return name;

ide/db.dataview/src/org/netbeans/modules/db/dataview/output/InsertRecordDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ private void copy() {
549549
int[] colsselected = insertRecordTableUI.getSelectedColumns();
550550
if (!((numrows - 1 == rowsselected[rowsselected.length - 1] - rowsselected[0] && numrows == rowsselected.length) &&
551551
(numcols - 1 == colsselected[colsselected.length - 1] - colsselected[0] && numcols == colsselected.length))) {
552-
JOptionPane.showMessageDialog(null, "Invalid Copy Selection", "Invalid Copy Selection", JOptionPane.ERROR_MESSAGE);
552+
JOptionPane.showMessageDialog(Utilities.findDialogParent(), "Invalid Copy Selection", "Invalid Copy Selection", JOptionPane.ERROR_MESSAGE);
553553
return;
554554
}
555555
for (int i = 0; i < numrows; i++) {

ide/db.dataview/src/org/netbeans/modules/db/dataview/output/dataexport/DataViewTableDataExportFileChooser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.netbeans.api.progress.BaseProgressUtils;
2929
import org.netbeans.modules.db.dataview.output.DataViewTableUIModel;
3030
import org.openide.util.NbBundle;
31+
import org.openide.util.Utilities;
3132

3233
/**
3334
*
@@ -76,8 +77,7 @@ public static synchronized void extractAsFile(final DataViewTableUIModel model)
7677

7778
private static boolean checkFile(File file) {
7879
if (file.exists()) {
79-
int a = JOptionPane.showConfirmDialog(
80-
null,
80+
int a = JOptionPane.showConfirmDialog(Utilities.findDialogParent(),
8181
Bundle.LBL_OVEWRITE_DIALOG(),
8282
Bundle.MSG_OVEWRITE_DIALOG(),
8383
JOptionPane.YES_NO_OPTION);

ide/git/src/org/netbeans/modules/git/ui/clone/CloneAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import org.openide.util.Mutex;
7272
import org.openide.util.NbBundle;
7373
import org.openide.util.RequestProcessor.Task;
74+
import org.openide.util.Utilities;
7475

7576
/**
7677
*
@@ -271,7 +272,7 @@ private void initSubmodules () {
271272
}
272273

273274
private boolean confirmSubmoduleInit (List<File> subrepos) {
274-
return JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null,
275+
return JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(Utilities.findDialogParent(),
275276
Bundle.MSG_Clone_confirmSubmoduleInit_text(),
276277
Bundle.LBL_Clone_confirmSubmoduleInit_title(),
277278
JOptionPane.YES_NO_OPTION,

ide/mercurial/src/org/netbeans/modules/mercurial/ui/clone/CloneAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public boolean cancel() {
371371

372372
OutputLogger logger = support.getLogger();
373373
logger.outputInRed(NbBundle.getMessage(CloneAction.class, "MSG_CLONE_CANCEL_ATTEMPT")); // NOI18N
374-
JOptionPane.showMessageDialog(null,
374+
JOptionPane.showMessageDialog(Utilities.findDialogParent(),
375375
NbBundle.getMessage(CloneAction.class, "MSG_CLONE_CANCEL_NOT_SUPPORTED"),// NOI18N
376376
NbBundle.getMessage(CloneAction.class, "MSG_CLONE_CANCEL_NOT_SUPPORTED_TITLE"),// NOI18N
377377
JOptionPane.INFORMATION_MESSAGE);

ide/mercurial/src/org/netbeans/modules/mercurial/ui/commit/CommitAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
import org.openide.cookies.SaveCookie;
8484
import org.openide.filesystems.FileUtil;
8585
import org.openide.nodes.Node;
86+
import org.openide.util.Utilities;
8687

8788
/**
8889
* Commit action for mercurial:
@@ -148,7 +149,7 @@ protected void performContextAction(Node[] nodes) {
148149
NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
149150
logger.output(""); // NOI18N
150151
logger.closeLog();
151-
JOptionPane.showMessageDialog(null,
152+
JOptionPane.showMessageDialog(Utilities.findDialogParent(),
152153
NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW"),// NOI18N
153154
NbBundle.getMessage(CommitAction.class, "MSG_COMMIT_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
154155
JOptionPane.INFORMATION_MESSAGE);

ide/mercurial/src/org/netbeans/modules/mercurial/ui/diff/DiffAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.netbeans.modules.mercurial.ui.log.HgLogMessage.HgRevision;
3535
import org.openide.nodes.Node;
3636
import org.openide.util.NbBundle;
37+
import org.openide.util.Utilities;
3738
import static org.netbeans.modules.mercurial.ui.diff.Bundle.*;
3839

3940
/**
@@ -89,7 +90,7 @@ protected void performContextAction(Node[] nodes) {
8990
NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
9091
logger.output(""); // NOI18N
9192
logger.closeLog();
92-
JOptionPane.showMessageDialog(null,
93+
JOptionPane.showMessageDialog(Utilities.findDialogParent(),
9394
NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW"),// NOI18N
9495
NbBundle.getMessage(DiffAction.class, "MSG_DIFF_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
9596
JOptionPane.INFORMATION_MESSAGE);

ide/mercurial/src/org/netbeans/modules/mercurial/ui/merge/MergeAction.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.netbeans.modules.mercurial.ui.log.HgLogMessage;
4343
import org.openide.DialogDescriptor;
4444
import org.openide.nodes.Node;
45+
import org.openide.util.Utilities;
4546

4647
/**
4748
* Merge action for mercurial:
@@ -84,7 +85,7 @@ protected void performContextAction(Node[] nodes) {
8485
NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NOT_SUPPORTED_INVIEW_INFO")); // NOI18N
8586
logger.output(""); // NOI18N
8687
logger.closeLog();
87-
JOptionPane.showMessageDialog(null,
88+
JOptionPane.showMessageDialog(Utilities.findDialogParent(),
8889
NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NOT_SUPPORTED_INVIEW"),// NOI18N
8990
NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NOT_SUPPORTED_INVIEW_TITLE"),// NOI18N
9091
JOptionPane.INFORMATION_MESSAGE);
@@ -103,7 +104,7 @@ public void perform() {
103104
logger.output( NbBundle.getMessage(MergeAction.class,"MSG_NOTHING_TO_MERGE")); // NOI18N
104105
logger.outputInRed( NbBundle.getMessage(MergeAction.class, "MSG_MERGE_DONE")); // NOI18N
105106
logger.output(""); // NOI18N
106-
JOptionPane.showMessageDialog(null,
107+
JOptionPane.showMessageDialog(Utilities.findDialogParent(),
107108
NbBundle.getMessage(MergeAction.class,"MSG_NOTHING_TO_MERGE"),// NOI18N
108109
NbBundle.getMessage(MergeAction.class,"MSG_MERGE_TITLE"),// NOI18N
109110
JOptionPane.INFORMATION_MESSAGE);
@@ -163,7 +164,7 @@ public static boolean handleMergeOutput(File root, List<String> listMerge, Outpu
163164
if (interactive) {
164165
logger.outputInRed(NbBundle.getMessage(MergeAction.class,
165166
"MSG_MERGE_FAILED")); // NOI18N
166-
JOptionPane.showMessageDialog(null,
167+
JOptionPane.showMessageDialog(Utilities.findDialogParent(),
167168
NbBundle.getMessage(MergeAction.class, "MSG_MERGE_UNCOMMITTED"), // NOI18N
168169
NbBundle.getMessage(MergeAction.class, "MSG_MERGE_TITLE"), // NOI18N
169170
JOptionPane.WARNING_MESSAGE);
@@ -202,7 +203,7 @@ public static boolean handleMergeOutput(File root, List<String> listMerge, Outpu
202203
if (HgCommand.isMergeUnavailableMsg(line)) {
203204
bMergeFailed = true;
204205
if (interactive) {
205-
JOptionPane.showMessageDialog(null,
206+
JOptionPane.showMessageDialog(Utilities.findDialogParent(),
206207
NbBundle.getMessage(MergeAction.class, "MSG_MERGE_UNAVAILABLE"), // NOI18N
207208
NbBundle.getMessage(MergeAction.class, "MSG_MERGE_TITLE"), // NOI18N
208209
JOptionPane.WARNING_MESSAGE);
@@ -252,7 +253,7 @@ public static void displayMergeWarning (Map<String, Collection<HgLogMessage>> br
252253
return;
253254
}
254255
Action a = logger.getOpenOutputAction();
255-
if (warnInDialog && a != null && JOptionPane.showConfirmDialog(null, NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NEEDED_BRANCHES"), //NOI18N
256+
if (warnInDialog && a != null && JOptionPane.showConfirmDialog(Utilities.findDialogParent(), NbBundle.getMessage(MergeAction.class, "MSG_MERGE_NEEDED_BRANCHES"), //NOI18N
256257
NbBundle.getMessage(MergeAction.class, "TITLE_MERGE_NEEDED_BRANCHES"), //NOI18N
257258
JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
258259
a.actionPerformed(new ActionEvent(MergeAction.class, ActionEvent.ACTION_PERFORMED, null));

ide/mercurial/src/org/netbeans/modules/mercurial/ui/properties/HgProperties.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.netbeans.modules.mercurial.util.HgRepositoryContextCache;
3434
import org.openide.util.NbBundle;
3535
import org.openide.util.RequestProcessor;
36+
import org.openide.util.Utilities;
3637

3738
/**
3839
*
@@ -127,7 +128,7 @@ protected void perform() {
127128
if (bPropChanged && hgPropertyValue.trim().length() >= 0) {
128129
if (hgPropertyName.equals(HGPROPNAME_USERNAME) &&
129130
!HgModuleConfig.getDefault().isUserNameValid(hgPropertyValue)) {
130-
JOptionPane.showMessageDialog(null,
131+
JOptionPane.showMessageDialog(Utilities.findDialogParent(),
131132
NbBundle.getMessage(HgProperties.class, "MSG_WARN_USER_NAME_TEXT"), // NOI18N
132133
NbBundle.getMessage(HgProperties.class, "MSG_WARN_FIELD_TITLE"), // NOI18N
133134
JOptionPane.WARNING_MESSAGE);

0 commit comments

Comments
 (0)