frame = SwingUtilities.getWindowAncestor(target);
// if (window instanceof Frame) {
// frame = (Frame) window;
// }
}
JXDialog topLevel = getDialogForSharedFindPanel();
JXDialog findDialog;
if ((topLevel != null) && (topLevel.getOwner().equals(frame))) {
findDialog = topLevel;
// JW: #635-swingx - quick hack to update title to current locale ...
// findDialog.setTitle(getSharedFindPanel().getName());
KeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent(findDialog);
} else {
Point location = hideSharedFindPanel(true);
if (frame instanceof Frame) {
findDialog = new JXDialog((Frame) frame, getSharedFindPanel());
} else if (frame instanceof Dialog) {
// fix #215-swingx: had problems with secondary modal dialogs.
findDialog = new JXDialog((Dialog) frame, getSharedFindPanel());
} else {
findDialog = new JXDialog(JOptionPane.getRootFrame(), getSharedFindPanel());
}
// RJO: shouldn't we avoid overloaded useage like this in a JSR296 world? swap getName() for getTitle() here?
// findDialog.setTitle(getSharedFindPanel().getName());
// JW: don't - this will stay on top of all applications!
// findDialog.setAlwaysOnTop(true);
findDialog.pack();
if (location == null) {
findDialog.setLocationRelativeTo(frame);
} else {
findDialog.setLocation(location);
}
}
if (target != null) {
findDialog.setLocale(target.getLocale());
}
getSharedFindPanel().setSearchable(searchable);
installFindRemover(target, findDialog);
findDialog.setVisible(true);
}