@Override public void pluginAdded( Object serviceObject ) { previousShowTrans = false; // hack to get the tree to reload Display.getDefault().asyncExec( new Runnable() { @Override public void run() { refreshCoreObjects(); } } ); }
@Override public void pluginRemoved( Object serviceObject ) { previousShowTrans = false; // hack to get the tree to reload Display.getDefault().asyncExec( new Runnable() { @Override public void run() { refreshCoreObjects(); } } ); }
private void messageReceived(final Table table, final String channel, final String message) { Display.getDefault().asyncExec(new Runnable() { public void run() { TableItem item = new TableItem(table, SWT.None); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS", Locale.getDefault()); String time = df.format(new Date()); String[] str = new String[]{time, channel, message}; item.setText(str); table.setSelection(item); } }); }
public boolean threadMessageBox( final String message, final String text, boolean allowCancel, int type ) { final boolean[] result = new boolean[1]; Display.getDefault().syncExec( new Runnable() { public void run() { result[0] = SpoonFactory.getInstance().messageBox( message, text, true, Const.INFO ); } } ); return result[0]; }
private void update() { Display.getDefault().syncExec( new Runnable() { @Override public void run() { connectionBox.removeItems(); for ( String key : keys ) { connectionBox.addItem( key ); } } } ); } } );
/** * Returns the system cursor matching the specific ID. * * @param id * int The ID value for the cursor * @return Cursor The system cursor matching the specific ID */ public static Cursor getCursor(int id) { Integer key = Integer.valueOf(id); Cursor cursor = m_idToCursorMap.get(key); if (cursor == null) { cursor = new Cursor(Display.getDefault(), id); m_idToCursorMap.put(key, cursor); } return cursor; } /**
protected void doInEventThread( final Runnable r ) { if ( Display.getCurrent() != null ) { r.run(); } else { Display.getDefault().syncExec( r ); } }
@Override public void setEnabled( boolean enabled ) { styledText.setEnabled( enabled ); // StyledText component does not get the "disabled" look, so it needs to be applied explicitly // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=4745 if ( Display.getDefault() != null ) { Color foreground = Display.getDefault().getSystemColor( enabled ? SWT.COLOR_BLACK : SWT.COLOR_DARK_GRAY ); Color background = Display.getDefault().getSystemColor( enabled ? SWT.COLOR_WHITE : SWT.COLOR_WIDGET_BACKGROUND ); styledText.setForeground( foreground ); styledText.setBackground( background ); } } }
private StyleRange getValueStyle() { StyleRange style1 = new StyleRange(); style1.fontStyle = SWT.NORMAL; style1.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLUE); return style1; }
private StyleRange getKeyStyle() { StyleRange style = new StyleRange(); style.fontStyle = SWT.BOLD; style.foreground = Display.getDefault().getSystemColor(SWT.COLOR_RED); return style; } }
protected void populateSubSteps( Event event ) { try { String current = wSubStep.getText(); wSubStep.removeAll(); ofNullable( getMappingMeta() ) .ifPresent( transMeta -> transMeta .getSteps() .stream() .map( StepMeta::getName ) .sorted() .forEach( wSubStep::add ) ); //I don't know why but just calling setText does not work when the text is not one of the items in the list. //Instead the first item in the list is selected. asyncExec solves it. If you have a better solution, by all //means go ahead and implement Display.getDefault().asyncExec( () -> wSubStep.setText( current ) ); } catch ( KettleException e ) { logDebug( e.getMessage(), e ); } }
protected void doWithBusyIndicator( final Runnable r ) { BusyIndicator.showWhile( Display.getCurrent() != null ? Display.getCurrent() : Display.getDefault(), r ); }
public void fireMenuControlers() { if ( !Display.getDefault().getThread().equals( Thread.currentThread() ) ) { display.syncExec( new Runnable() { @Override public void run() { fireMenuControlers(); } } ); return; } org.pentaho.ui.xul.dom.Document doc; if ( mainSpoonContainer != null ) { doc = mainSpoonContainer.getDocumentRoot(); for ( ISpoonMenuController menuController : menuControllers ) { menuController.updateMenu( doc ); } } }
protected void onAuthorization( AuthorizationCodeRequestUrl authorizationUrl ) throws IOException { String url = authorizationUrl.build(); Spoon spoon = Spoon.getInstance(); if ( spoon != null ) { Display.getDefault().syncExec( new Runnable() { public void run() { Shell shell = spoon.getShell(); GoogleAuthorizationDialog authorizationDialog = new GoogleAuthorizationDialog( shell, getReceiver() ); authorizationDialog.open( url ); } } ); } else { browse( url ); } } }
Display.getDefault().asyncExec( new Runnable() { public void run() { if ( !wReturn.isDisposed() ) {
/** * Open the window. * */ public void open() { Display display = null; display = Display.getDefault(); createContents(); shell.open(); shell.layout(); while (!shell.isDisposed()) { try { if (!display.readAndDispatch()) { display.sleep(); } } catch (Exception e) { MessageDialog.openError(shell, i18nFile.getText(I18nFile.ERROR), e.getLocalizedMessage()); e.printStackTrace(); } } display.dispose(); }
Display.getDefault().asyncExec( new Runnable() { public void run() { if ( !wReturn.isDisposed() ) {
void initializeColors() { Display display = Display.getDefault(); colors = new Color[] { new Color( display, new RGB( 0, 0, 0 ) ), // black new Color( display, new RGB( 63, 127, 95 ) ), // red new Color( display, new RGB( 0, 0, 192 ) ), // green new Color( display, new RGB( 127, 0, 85 ) ), // blue new Color( display, new RGB( 255, 102, 0 ) ) // Kettle Functions / Orange }; tokenColors = new int[MAXIMUM_TOKEN]; tokenColors[WORD] = 0; tokenColors[WHITE] = 0; tokenColors[KEY] = 3; tokenColors[COMMENT] = 1; tokenColors[STRING] = 2; tokenColors[OTHER] = 0; tokenColors[NUMBER] = 0; tokenColors[FUNCTIONS] = 4; }
void initializeColors() { Display display = Display.getDefault(); colors = new Color[] { new Color( display, new RGB( 0, 0, 0 ) ), // black new Color( display, new RGB( 255, 0, 0 ) ), // red new Color( display, new RGB( 63, 127, 95 ) ), // green new Color( display, new RGB( 0, 0, 255 ) ), // blue new Color( display, new RGB( 255, 0, 255 ) ) // SQL Functions / Rose }; tokenColors = new int[MAXIMUM_TOKEN]; tokenColors[WORD] = 0; tokenColors[WHITE] = 0; tokenColors[KEY] = 3; tokenColors[COMMENT] = 2; tokenColors[STRING] = 1; tokenColors[OTHER] = 0; tokenColors[NUMBER] = 0; tokenColors[VALUESNAME] = 4; }
void initializeColors() { Display display = Display.getDefault(); colors = new Color[] { new Color( display, new RGB( 0, 0, 0 ) ), // black new Color( display, new RGB( 255, 0, 0 ) ), // red new Color( display, new RGB( 63, 127, 95 ) ), // green new Color( display, new RGB( 0, 0, 255 ) ), // blue new Color( display, new RGB( 255, 0, 255 ) ) // SQL Functions / Rose }; tokenColors = new int[MAXIMUM_TOKEN]; tokenColors[WORD] = 0; tokenColors[WHITE] = 0; tokenColors[KEY] = 3; tokenColors[COMMENT] = 2; tokenColors[STRING] = 1; tokenColors[OTHER] = 0; tokenColors[NUMBER] = 0; tokenColors[FUNCTIONS] = 4; }