@Override public ActionCallback show() { LOG.assertTrue( EventQueue.isDispatchThread(), "Access is allowed from event dispatch thread only"); if (myTypeAheadCallback != null) { IdeFocusManager.getInstance(myProject).typeAheadUntil(myTypeAheadCallback); } LOG.assertTrue( EventQueue.isDispatchThread(), "Access is allowed from event dispatch thread only"); final ActionCallback result = new ActionCallback(); final AnCancelAction anCancelAction = new AnCancelAction(); final JRootPane rootPane = getRootPane(); anCancelAction.registerCustomShortcutSet( new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), rootPane); myDisposeActions.add( new Runnable() { @Override public void run() { anCancelAction.unregisterCustomShortcutSet(rootPane); } }); if (!myCanBeParent && myWindowManager != null) { myWindowManager.doNotSuggestAsParent(myDialog.getWindow()); } final CommandProcessorEx commandProcessor = ApplicationManager.getApplication() != null ? (CommandProcessorEx) CommandProcessor.getInstance() : null; final boolean appStarted = commandProcessor != null; if (myDialog.isModal() && !isProgressDialog()) { if (appStarted) { commandProcessor.enterModal(); LaterInvocator.enterModal(myDialog); } } if (appStarted) { hidePopupsIfNeeded(); } try { myDialog.show(); } finally { if (myDialog.isModal() && !isProgressDialog()) { if (appStarted) { commandProcessor.leaveModal(); LaterInvocator.leaveModal(myDialog); } } myDialog.getFocusManager().doWhenFocusSettlesDown(result.createSetDoneRunnable()); } return result; }
public void changedUpdate(DocumentEvent e) { assert EventQueue.isDispatchThread(); // System.err.println("changedUpdate fired!"); // Utilities.invokeLater(new Runnable() { // public void run() { removeListener(); _pim.setMask(_textField.getText()); updateExtensionLabel(); updateList(); addListener(); // } // }); }
@Override @SuppressWarnings("SSBasedInspection") protected void dispose() { LOG.assertTrue( EventQueue.isDispatchThread(), "Access is allowed from event dispatch thread only"); for (Runnable runnable : myDisposeActions) { runnable.run(); } myDisposeActions.clear(); final JRootPane root = myDialog.getRootPane(); Runnable disposer = new Runnable() { @Override public void run() { myDialog.dispose(); myProject = null; SwingUtilities.invokeLater( new Runnable() { @Override public void run() { if (myDialog != null && root != null) { myDialog.remove(root); } } }); } }; if (EventQueue.isDispatchThread()) { disposer.run(); } else { SwingUtilities.invokeLater(disposer); } }
/* (non-Javadoc) * @see java.awt.Component#doLayout() */ public void doLayout() { if (EventQueue.isDispatchThread()) { Dimension size = this.getSize(); this.rblock.setBounds(0, 0, size.width, size.height); this.removeAll(); this.rblock.layout(size.width, size.height); this.rblock.updateWidgetBounds(); } else { EventQueue.invokeLater( new Runnable() { public void run() { HtmlBlock.this.doLayout(); } }); } }
/** Toggle visibility of this frame. Warning, it behaves like a modal dialog. */ public void setVisible(boolean vis) { assert EventQueue.isDispatchThread(); validate(); if (vis) { DrJavaRoot.installModalWindowAdapter(this, LambdaUtil.NO_OP, CANCEL); setOwnerEnabled(false); selectStrategy(); _textField.requestFocus(); toFront(); } else { DrJavaRoot.removeModalWindowAdapter(this); setOwnerEnabled(true); if (_owner != null) { _owner.toFront(); } } super.setVisible(vis); }
/** * ** Returns true if the calling Thread is the event dispatch thread ** @return True if the * calling Thread is the event dispatch thread */ public static boolean isDispatchThread() { return EventQueue.isDispatchThread(); }