public boolean isOpen() { return dialog != null && dialog.isVisible(); }
@Override public void actionPerformed( final ActionEvent arg0 ) { dialog.setVisible( ! dialog.isVisible() ); }
/*************************************************************************** * * Use this instead of calling ErrorManager.notify() as this method would * first close a modal dialog, if opened. Otherwise the exception dialog * could not appear. * **************************************************************************/ public static void notifyError (final Throwable t) { logger.throwing(CLASS, "notifyError()", t); if ((currentModalDialog != null) && currentModalDialog.isVisible()) { currentModalDialog.dispose(); currentModalDialog = null; } ErrorManager.getDefault().notify(t); }
public void actionPerformed(ActionEvent ae) { Component comp = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (key != null) { //if there was an action, do it first Action a = chooser.getActionMap().get(key); if (a != null) { a.actionPerformed(ae); } } if (comp.getParent() == null) { //then we were editing a file name, and the editor //was removed - we don't want to close the dialog return; } Container c = chooser.getTopLevelAncestor(); //The action *may* have already hidden the panel (works //intermittently) if (c instanceof Dialog) { if (((Dialog) c).isVisible()) { ((Dialog) c).setVisible (false); ((Dialog) c).dispose(); } } } };
private boolean existsOtherDialog() { Frame ancestor = (Frame) JOptionUtils.centeringComp() .getTopLevelAncestor(); Window[] ownedWindows = ancestor.getOwnedWindows(); for (Window window : ownedWindows) { if (window instanceof Dialog && !(window == getStopDialog()) && !(window == getOwner())) { Dialog dialog = (Dialog) window; if (dialog.isVisible()) { return true; } } } return false; }
@Override public boolean matches(Object item) { if (item instanceof DialogFixture) return ((DialogFixture) item).target().isVisible(); if (item instanceof JDialog) return ((JDialog) item).isVisible(); if (item instanceof JFileChooserFixture) return ((JFileChooserFixture) item).target().isVisible(); throw new RuntimeException("Invalid matcher for " + item); }