List of usage examples for java.awt EventQueue invokeLater
public static void invokeLater(Runnable runnable)
From source file:org.zaproxy.zap.extension.soap.ExtensionImportWSDL.java
private void printOutput(StringBuilder sb) { if (View.isInitialised()) { final String str = sb.toString(); EventQueue.invokeLater(new Runnable() { @Override/*from w ww . ja va 2s .c o m*/ public void run() { View.getSingleton().getOutputPanel().append(str); } }); } }
From source file:org.zaproxy.zap.extension.spider.ExtensionSpider.java
private void addScanToUi(final SpiderScan scan) { if (!EventQueue.isDispatchThread()) { EventQueue.invokeLater(new Runnable() { @Override/* www . java2 s .c om*/ public void run() { addScanToUi(scan); } }); return; } this.getSpiderPanel().scannerStarted(scan); scan.setListener(getSpiderPanel()); // So the UI gets updated this.getSpiderPanel().switchView(scan); this.getSpiderPanel().setTabFocus(); }
From source file:com.kenai.redminenb.query.RedmineQueryController.java
protected void populate() { if (Redmine.LOG.isLoggable(Level.FINE)) { Redmine.LOG.log(Level.FINE, "Starting populate query controller {0}", (query.isSaved() ? " - " + query.getDisplayName() : "")); // NOI18N }/*from ww w . j a v a 2 s .co m*/ try { EventQueue.invokeLater(new Runnable() { @Override public void run() { populateProjectDetails(); if (query.isSaved()) { boolean autoRefresh = RedmineConfig.getInstance() .getQueryAutoRefresh(query.getDisplayName()); queryPanel.refreshCheckBox.setSelected(autoRefresh); } } }); } finally { if (Redmine.LOG.isLoggable(Level.FINE)) { Redmine.LOG.log(Level.FINE, "Finnished populate query controller{0}", (query.isSaved() ? " - " + query.getDisplayName() : "")); // NOI18N } } }
From source file:org.zaproxy.zap.extension.api.CoreAPI.java
private static void persistMessage(final HttpMessage message) { final HistoryReference historyRef; try {//from w ww . ja v a 2 s . c om historyRef = new HistoryReference(Model.getSingleton().getSession(), HistoryReference.TYPE_ZAP_USER, message); } catch (Exception e) { logger.warn(e.getMessage(), e); return; } final ExtensionHistory extHistory = (ExtensionHistory) Control.getSingleton().getExtensionLoader() .getExtension(ExtensionHistory.NAME); if (extHistory != null) { EventQueue.invokeLater(new Runnable() { @Override public void run() { extHistory.addHistory(historyRef); Model.getSingleton().getSession().getSiteTree().addPath(historyRef, message); } }); } }
From source file:me.paddingdun.gen.code.gui.view.dbtable.TableView.java
/** * add by 201645 ?;//from w w w . j av a 2 s . c o m */ private void changeTableRow() { if (model != null && model.getEntity() != null && model.getEntity().getTableColumns() != null) { final int index = tableColumnTable.getSelectedRow(); if (index < 0) return; TaskHelper.runInNonEDT(new Callable<Void>() { public Void call() throws Exception { List<TableColumn> list = model.getEntity().getTableColumns(); if (index < list.size()) { final TableColumn tc = list.get(index); EventQueue.invokeLater(new Runnable() { public void run() { ModelHelper.simpleGetAndComplexSet(tc, TableView.this, ModelValueCategory.Column); } }); } return null; } }); } }
From source file:org.zaproxy.zap.extension.soap.WSDLCustomParser.java
private static void persistMessage(final HttpMessage message, final String opDisplayName) { // Add the message to the history panel and sites tree final HistoryReference historyRef; try {/* w w w .j a v a 2s. co m*/ historyRef = new HistoryReference(Model.getSingleton().getSession(), HistoryReference.TYPE_ZAP_USER, message); } catch (Exception e) { LOG.warn(e.getMessage(), e); return; } final ExtensionHistory extHistory = Control.getSingleton().getExtensionLoader() .getExtension(ExtensionHistory.class); if (extHistory != null) { EventQueue.invokeLater(new Runnable() { @Override public void run() { extHistory.addHistory(historyRef); // FIXME /* * Modifies the URI adding the SOAP operation name to avoid overwrites. It's * done after saving it in history so that the original URI is preserved for * scanning tasks. * * URI modification solution is only a workaround since it has size limitations * and, anyway, it is not an elegant solution. */ try { URI soapURI = message.getRequestHeader().getURI(); String soapStringURI = soapURI.getPath(); soapURI.setPath(soapStringURI + opDisplayName); } catch (URIException e) { LOG.warn(e.getMessage(), e); } Model.getSingleton().getSession().getSiteTree().addPath(historyRef, message); } }); } }
From source file:org.jivesoftware.sparkimpl.plugin.viewer.PluginViewer.java
/** * Common code for copy routines. By convention, the streams are * closed in the same method in which they were opened. Thus, * this method does not close the streams when the copying is done. * * @param in Stream to copy from.// w ww. j a v a 2 s .c o m * @param out Stream to copy to. */ private void copy(final InputStream in, final OutputStream out) { int read = 0; while (true) { try { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } final byte[] buffer = new byte[4096]; int bytesRead = in.read(buffer); if (bytesRead < 0) { break; } out.write(buffer, 0, bytesRead); read += bytesRead; final int readprogr = read; EventQueue.invokeLater(new Runnable() { @Override public void run() { progressBar.setValue(readprogr); } }); } catch (IOException e) { Log.error(e); } } }
From source file:tax.MainForm.java
private void dateTextKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_dateTextKeyPressed if (evt.getKeyCode() == KeyEvent.VK_ENTER) { if (!dateText.getText().equals("")) { Util.fadeInAndOut(dateText, Util.darkGreen); priceText.setEnabled(true);/*from w w w. j a v a 2s .c o m*/ priceText.requestFocus(); } else Util.fadeInAndOut(dateText, Util.darkOrange); } else if (!evt.isActionKey() && !evt.isAltDown() && !evt.isControlDown() && !evt.isShiftDown() && !evt.isMetaDown() && (evt.getKeyCode() != KeyEvent.VK_BACK_SPACE) && (evt.getKeyCode() != KeyEvent.VK_DELETE) && (evt.getKeyCode() != KeyEvent.VK_ESCAPE)) { EventQueue.invokeLater(new Runnable() { @Override public void run() { String text = dateText.getText(); int dateLength = text.length(); while (lastDateTextLength == dateLength) { try { Thread.sleep(100); System.out.println("text: " + text); System.out.println(lastDateTextLength + " " + dateLength); return; } catch (InterruptedException ex) { Logger.getLogger(MainForm.class.getName()).log(Level.SEVERE, null, ex); } text = dateText.getText(); dateLength = text.length(); } try { int num = Integer.decode(text); if (num > 31) { if (text.length() > 0) dateText.setText(text.substring(0, dateLength - 1)); else dateText.setText(""); return; } } catch (Exception e) { if (text.length() > 0) dateText.setText(text.substring(0, dateLength - 1)); else dateText.setText(""); return; } lastDateTextLength = dateLength; } }); } }
From source file:de.huxhorn.lilith.Lilith.java
private static void showMainFrame() { if (mainFrame != null) { final MainFrame frame = mainFrame; EventQueue.invokeLater(() -> { if (frame.isVisible()) { frame.setVisible(false); }/*from w ww. ja v a 2 s .c o m*/ Windows.showWindow(frame, null, false); frame.toFront(); }); } }
From source file:de.huxhorn.lilith.Lilith.java
private static void updateSplashStatus(final SplashScreen splashScreen, final String status) { if (splashScreen != null) { EventQueue.invokeLater(() -> { if (!splashScreen.isVisible()) { Windows.showWindow(splashScreen, null, true); }//from ww w . j a v a2 s .c o m splashScreen.toFront(); splashScreen.setStatusText(status); }); } }