@SuppressWarnings("unchecked") public void XtestSetFeatures() { FeatureCollection<SimpleFeatureType, SimpleFeature> newFeatures = FeatureCollections.newCollection(); newFeatures.add(feature1); table.setFeatures(newFeatures); while (Display.getCurrent().readAndDispatch()) ; assertEquals(1, table.getViewer().getTable().getItemCount()); TableItem item = table.getViewer().getTable().getItem(0); assertEquals(feature1, item.getData()); newFeatures.add(feature2); while (Display.getCurrent().readAndDispatch()) ; assertEquals(2, table.getViewer().getTable().getItemCount()); item = table.getViewer().getTable().getItem(0); assertEquals(feature1, item.getData()); item = table.getViewer().getTable().getItem(1); assertEquals(feature2, item.getData()); newFeatures.remove(feature1); while (Display.getCurrent().readAndDispatch()) ; assertEquals(1, table.getViewer().getTable().getItemCount()); item = table.getViewer().getTable().getItem(0); assertEquals(feature2, item.getData()); }
/** * Updates the current tile on the Thumbnail. An area of the source Figure is painted to an * {@link Image}. That Image is then drawn on the Thumbnail. Scaling of the source Image is done * inside {@link GC#drawImage(Image, int, int, int, int, int, int, int, int)} since the source * and target sizes are different. The current tile indexes are incremented and if more updating * is necesary, this {@link Runnable} is called again in a {@link Display#timerExec(int, * Runnable)}. If no more updating is required, {@link #stop()} is called. */ public void run() { if (!isActive() || !isRunning()) return; int v = getCurrentVTile(); int sy1 = v * tileSize.height; int sy2 = Math.min((v + 1) * tileSize.height, getSourceRectangle().height); int h = getCurrentHTile(); int sx1 = h * tileSize.width; int sx2 = Math.min((h + 1) * tileSize.width, getSourceRectangle().width); com.architexa.org.eclipse.draw2d.geometry.Point p = getSourceRectangle().getLocation(); Rectangle rect = new Rectangle(sx1 + p.x, sy1 + p.y, sx2 - sx1, sy2 - sy1); thumbnailGraphics.pushState(); thumbnailGraphics.setClip(rect); thumbnailGraphics.fillRectangle(rect); sourceFigure.paint(thumbnailGraphics); thumbnailGraphics.popState(); if (getCurrentHTile() < (hTiles - 1)) setCurrentHTile(getCurrentHTile() + 1); else { setCurrentHTile(0); if (getCurrentVTile() < (vTiles - 1)) setCurrentVTile(getCurrentVTile() + 1); else setCurrentVTile(0); } if (getCurrentHTile() != 0 || getCurrentVTile() != 0) Display.getCurrent().asyncExec(this); else if (isDirty()) { setDirty(false); Display.getCurrent().asyncExec(this); repaint(); } else { stop(); repaint(); } }
/** * @param index index of feature (in collection) to select) * @param blockForViewing for debugging. just blocks so that the table can be * visually/interactively inspected. * @throws Exception */ private void assertSelected(final int index, boolean blockForViewing) throws Exception { final String fid = "feature" + (index + 1); // $NON-NLS-1$ final Table tree = table.getViewer().getTable(); selectFeature(index, true); if (blockForViewing) { doWait(); } TableItem item = tree.getItem(index); Color selectedBackColor = Display.getCurrent().getSystemColor(SWT.COLOR_LIST_SELECTION); Color selectedForeColor = Display.getCurrent().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT); assertEquals(fid, ((SimpleFeature) item.getData()).getID()); TableItem[] items = tree.getItems(); for (TableItem item2 : items) { if (item2 == item) { assertEquals("item should be selected", selectedBackColor, item.getBackground()); assertEquals("item should be selected", selectedForeColor, item.getForeground()); } else { assertNotSame("item should not be selected", selectedBackColor, item.getBackground()); } } Rectangle bounds = item.getBounds(); assertTrue(tree.getBounds().intersects(bounds)); }
@Override public boolean track(MUIElement dragElement, DnDInfo info) { if (!clientBounds.contains(info.cursorPos)) return false; boolean wasOnEdge = onEdge; int dockLocation = getDockLocation(info); if (feedback != null) { feedback.setFeedback(getEnclosed(), getModified()); } if (dockLocation == curDockLocation && wasOnEdge == onEdge) return true; if (dropStack == dragElement && !onEdge) return false; curDockLocation = dockLocation; if (curDockLocation != NOWHERE) { showFeedback(curDockLocation); dndManager.setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_HAND)); } else { unDock(dragElement); dndManager.setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_NO)); } return true; }
protected void runSootDirectly(String mainClass) { int length = getSootCommandList().getList().size(); String temp[] = new String[length]; getSootCommandList().getList().toArray(temp); sendSootOutputEvent(mainClass); sendSootOutputEvent(" "); final String[] cmdAsArray = temp; for (int i = 0; i < temp.length; i++) { sendSootOutputEvent(temp[i]); sendSootOutputEvent(" "); } sendSootOutputEvent("\n"); IRunnableWithProgress op; try { newProcessStarting(); op = new SootRunner(temp, Display.getCurrent(), mainClass); ((SootRunner) op).setParent(this); ModalContext.run(op, true, new NullProgressMonitor(), Display.getCurrent()); } catch (InvocationTargetException e1) { // handle exception System.out.println("InvocationTargetException: " + e1.getMessage()); System.out.println("InvocationTargetException: " + e1.getTargetException()); System.out.println(e1.getStackTrace()); } catch (InterruptedException e2) { // handle cancelation System.out.println("InterruptedException: " + e2.getMessage()); } }
public void writeValue(int ex) { double x = xyGraph.primaryXAxis.getPositionValue(ex, false); int index = (int) x; if (index < 0) { return; } Sample sample = (Sample) trace.getDataProvider().getSample(index); if (sample != null) { double y = sample.getYValue(); int height = xyGraph.primaryYAxis.getValuePosition(y, false); int startX = xyGraph.primaryXAxis.getValuePosition((int) x, false); GC gc = new GC(canvas); Font font = new Font(null, "Verdana", 10, SWT.BOLD); gc.setFont(font); String value = FormatUtil.print(y, "#,###"); Point textSize = gc.textExtent(value); gc.drawText(value, startX + (xAxisUnitWidth - textSize.x) / 2, height - 20, true); int ground = xyGraph.primaryYAxis.getValuePosition(0, false); gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_MAGENTA)); gc.drawRectangle( startX + (xAxisUnitWidth - lineWidth) / 2, height, lineWidth, ground - height); gc.fillRectangle( startX + (xAxisUnitWidth - lineWidth) / 2, height, lineWidth, ground - height); gc.dispose(); writedValueMode = true; lastWritedX = ex; } }
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new FillLayout()); toolkit = new FormToolkit(composite.getDisplay()); form = toolkit.createScrolledForm(composite); FormColors colors = toolkit.getColors(); colors.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER); // // toolkit.getHyperlinkGroup().setActiveForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)); // toolkit.getHyperlinkGroup().setForeground(colors.getColor("Categorytitle")); toolkit .getHyperlinkGroup() .setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); body = form.getBody(); GridLayout bodyLayout = new GridLayout(); bodyLayout.verticalSpacing = 3; body.setLayout(bodyLayout); // body.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); toolkit.paintBordersFor(body); return composite; }
private static void init() { BOLD = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT); ITALIC = JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT); BOLD_ITALIC = new Font( Display.getCurrent(), getModifiedFontData(ITALIC.getFontData(), SWT.BOLD | SWT.ITALIC)); Font defaultFont = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT); FontData[] defaultData = defaultFont.getFontData(); if (defaultData != null && defaultData.length == 1) { FontData data = new FontData( defaultData[0].getName(), defaultData[0].getHeight(), defaultData[0].getStyle()); if ("win32".equals(SWT.getPlatform())) { // $NON-NLS-1$ // NOTE: Windows only, for: data.data.lfStrikeOut = 1; try { Field dataField = data.getClass().getDeclaredField("data"); // $NON-NLS-1$ Object dataObject = dataField.get(data); Class<?> clazz = dataObject.getClass().getSuperclass(); Field strikeOutFiled = clazz.getDeclaredField("lfStrikeOut"); // $NON-NLS-1$ strikeOutFiled.set(dataObject, (byte) 1); CommonFonts.STRIKETHROUGH = new Font(Display.getCurrent(), data); } catch (Throwable t) { // ignore } } } if (CommonFonts.STRIKETHROUGH == null) { CommonFonts.HAS_STRIKETHROUGH = false; CommonFonts.STRIKETHROUGH = defaultFont; } else { CommonFonts.HAS_STRIKETHROUGH = true; } }
/** * Causes the run() method of the runnable to be invoked by the user-interface thread at the next * reasonable opportunity. The caller of this method continues to run in parallel, and is not * notified when the runnable has completed. * * @param runnable runnable code to run on the user-interface thread. */ public static void safeAsyncExec(final Runnable runnable) { if (Display.getCurrent() != null) { Display.getCurrent().asyncExec(runnable); } else { Display.getDefault().asyncExec(runnable); } }
/* * @see IColorManager#getColor(RGB) */ public Color getColor(RGB rgb) { if (rgb == null) { return null; } final Display display = Display.getCurrent(); Map<RGB, Color> colorTable = fDisplayTable.get(display); if (colorTable == null) { colorTable = new HashMap<RGB, Color>(10); fDisplayTable.put(display, colorTable); if (fAutoDisposeOnDisplayDispose) { display.disposeExec( new Runnable() { public void run() { dispose(display); } }); } } Color color = colorTable.get(rgb); if (color == null) { color = new Color(Display.getCurrent(), rgb); colorTable.put(rgb, color); } return color; }
/** * Tries to find a cursor for the specified id. * * @param cursorId the cursor id * @return a cursor or null if none was found */ public static Cursor getCursor(String cursorId) { // find the descriptor for the specified cursor id AbstractCursor d = CursorService.getInstance().findCursor(cursorId); Cursor cursor = null; if (d != null) { if (d == ICursorService.SYSTEM_DEFAULT_CURSOR) { cursor = null; } else if (d instanceof SWTCursor) { cursor = new Cursor(Display.getCurrent(), ((SWTCursor) d).getSWTCursor()); } else if (d instanceof ContributedCursor) { ContributedCursor cc = (ContributedCursor) d; ImageData imageData = ImageUtil.getInstance().getImage(cc.getBundle(), cc.getImage()).getImageData(); cursor = new Cursor(Display.getCurrent(), imageData, 1, 1); } else if (d instanceof WorkspaceCursor) { WorkspaceCursor wc = (WorkspaceCursor) d; ImageData imageData = ImageUtil.getInstance().getImageDescriptorFromFile(wc.getGraphicsFile()).getImageData(); cursor = new Cursor(Display.getCurrent(), imageData, 1, 1); } else { LOG.warn("Unknown cursor type: " + d.getClass()); cursor = null; } } return cursor; }
public ListItem(Composite parent, int style, Item current) { super(parent, style | SWT.TRANSPARENT); myObject = current; this.setLayout(new GridLayout(2, false)); iconLabel = new Label(this, SWT.CENTER); iconLabel.setImage(Display.getCurrent().getSystemImage(SWT.ICON_WORKING)); getDisplay() .asyncExec( new Runnable() { @Override public void run() { if (null == iconLabel || iconLabel.isDisposed()) return; iconLabel.setImage(myObject.getThumbnail()); iconLabel.redraw(); } }); iconLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); iconLabel.setLayoutData(new GridData(100, 100)); // nameLabel = new Label(this, SWT.NONE); // nameLabel.setText(current.getName()); // nameLabel.setBackground(Display.getCurrent().getSystemColor( // SWT.COLOR_LIST_BACKGROUND)); setSelected(false); this.layout(); }
@Override public void dispose() { Display.getCurrent().removeFilter(SWT.FocusIn, myDisplayFilter); Display.getCurrent().removeFilter(SWT.MouseDown, myDisplayFilter); Display.getCurrent().removeFilter(SWT.KeyUp, myDisplayFilter); Display.getCurrent().removeFilter(SWT.MenuDetect, myDisplayFilter); }
private void handleSetDefaultButton() { try { CustomizeData custData = getCustTableSelection(); if (custData.getName().equals(CustomizeManager.TABLE_DEFAULT_LABEL) || custData.getName().equals(CustomizeManager.CURRENT_LABEL)) { XViewerLib.popup("ERROR", XViewerText.get("error.set_default")); return; } if (xViewerToCustomize.getCustomizeMgr().isCustomizationUserDefault(custData)) { if (MessageDialog.openConfirm( Display.getCurrent().getActiveShell(), XViewerText.get("button.remove_default"), MessageFormat.format( XViewerText.get("XViewerCustomizeDialog.prompt.remove_default"), custData.getName()))) { xViewerToCustomize.getCustomizeMgr().setUserDefaultCustData(custData, false); } } else if (MessageDialog.openConfirm( Display.getCurrent().getActiveShell(), XViewerText.get("button.set_default"), MessageFormat.format( XViewerText.get("XViewerCustomizeDialog.prompt.set_default"), custData.getName()))) { xViewerToCustomize.getCustomizeMgr().setUserDefaultCustData(custData, true); } loadCustomizeTable(); } catch (Exception ex) { XViewerLog.logAndPopup(Activator.class, Level.SEVERE, ex); } }
@Override public void run(boolean fork, boolean cancelable, final IRunnableWithProgress request) throws InvocationTargetException, InterruptedException { if (headless && Display.getCurrent() == null) { PlatformGIS.run(request); return; } if (getProgressMonitor() instanceof ProgressMonitorPart) { ProgressMonitorPart part = (ProgressMonitorPart) getProgressMonitor(); if (Display.getCurrent() != null) part.setVisible(true); try { setEnablement(buttonBar, false); if (fork) { PlatformGIS.run(request, part); } else { PlatformGIS.runBlockingOperation(request, part); } } finally { setEnablement(buttonBar, true); if (Display.getCurrent() != null && !part.isDisposed()) part.setVisible(false); } } else { if (fork) { PlatformGIS.run(request); } else { PlatformGIS.runBlockingOperation(request, ProgressManager.instance().get()); } } }
protected void paintFigure(Graphics graphics) { int alpha = 0x60; graphics.setAntialias(SWT.ON); if (control != null && !control.isDisposed() && control.isEnabled()) { graphics.setAlpha(0xff); } else { graphics.setAlpha(0x90); } Rectangle r = getBounds(); Path shape = new Path(Display.getCurrent()); float corner = Math.max(2, (vertical ? r.width : r.height) / 2); SWTUtils.addRoundedRectangle(shape, r.x, r.y, r.width - 1, r.height - 1, corner); Pattern pattern = new Pattern( Display.getCurrent(), // r.x, r.y, // vertical ? r.right() - 1 : r.x, // vertical ? r.y : r.bottom() - 1, // ColorConstants.gray, alpha, // ColorConstants.lightGray, alpha); graphics.setBackgroundPattern(pattern); graphics.fillPath(shape); graphics.setBackgroundPattern(null); pattern.dispose(); graphics.setAlpha(alpha); graphics.setForegroundColor(ColorConstants.gray); graphics.drawPath(shape); shape.dispose(); }
/** Constructs and returns a new source provider. */ public BindingSourceProvider() { Display.getCurrent().addFilter(SWT.FocusIn, myDisplayFilter); Display.getCurrent().addFilter(SWT.MouseDown, myDisplayFilter); Display.getCurrent().addFilter(SWT.KeyUp, myDisplayFilter); Display.getCurrent().addFilter(SWT.MenuDetect, myDisplayFilter); resetMap(myCurrentState); }
@Override public Color getBackground(Object element) { Color color = new Color(Display.getCurrent(), 255, 255, 255); Analyse analyse = (Analyse) element; if (analyse.isUrgent()) { color = new Color(Display.getCurrent(), 186, 0, 255); } return color; }
// make paramter integers private void assertSelectedBackgroundColor(Object... selectedItems) { Color selectedBackColor = Display.getCurrent().getSystemColor(SWT.COLOR_LIST_SELECTION); Color backColor = Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND); Table t = table.getViewer().getTable(); for (int i = 0; i < 4; i++) { if (contains(i, selectedItems)) assertEquals("" + i, selectedBackColor, t.getItem(i).getBackground()); // $NON-NLS-1$ else assertEquals("" + i, backColor, t.getItem(i).getBackground()); // $NON-NLS-1$ } }
public static Color getSystemColor(String key, Color defaultValue) { if (Styles.FillColor.equals(key)) { return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); } else if (Styles.LineColor.equals(key)) { return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BORDER); } else if (Styles.TextColor.equals(key)) { return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND); } return defaultValue; }
private static RGB getSystemRGB(String key, RGB defaultValue) { if (Styles.FillColor.equals(key)) { return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND).getRGB(); } else if (Styles.LineColor.equals(key)) { return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BORDER).getRGB(); } else if (Styles.TextColor.equals(key)) { return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND).getRGB(); } return defaultValue; }
// Bug 224703 - Project explorer doesn't show recreated working set // (this test does not show the problem since it was in the // WorkingSetSelectionDialog, but still it's nice to have) public void testDeletedAndRecreated() throws Exception { INavigatorContentExtension ce = _contentService.getContentExtensionById(WorkingSetsContentProvider.EXTENSION_ID); ce.getContentProvider(); IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); IWorkingSet ws1 = workingSetManager.createWorkingSet("ws1", new IAdaptable[] {_p1}); workingSetManager.addWorkingSet(ws1); IWorkingSet ws2 = workingSetManager.createWorkingSet("ws2", new IAdaptable[] {_p2}); workingSetManager.addWorkingSet(ws2); WorkingSetActionProvider provider = (WorkingSetActionProvider) TestAccessHelper.getActionProvider( _contentService, _actionService, WorkingSetActionProvider.class); IWorkbenchWindow activeWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IWorkbenchPage activePage = activeWindow.getActivePage(); activePage.setWorkingSets(new IWorkingSet[] {ws1, ws2}); IPropertyChangeListener l = provider.getFilterChangeListener(); PropertyChangeEvent event = new PropertyChangeEvent(this, WorkingSetFilterActionGroup.CHANGE_WORKING_SET, null, ws2); l.propertyChange(event); DisplayHelper.runEventLoop(Display.getCurrent(), 100); TreeItem[] items = _viewer.getTree().getItems(); assertTrue(items[0].getData().equals(_p2)); l = provider.getFilterChangeListener(); event = new PropertyChangeEvent(this, WorkingSetFilterActionGroup.CHANGE_WORKING_SET, null, ws1); l.propertyChange(event); DisplayHelper.runEventLoop(Display.getCurrent(), 100); items = _viewer.getTree().getItems(); assertTrue(items[0].getData().equals(_p1)); workingSetManager.removeWorkingSet(ws2); ws2 = workingSetManager.createWorkingSet("ws2", new IAdaptable[] {_p2}); workingSetManager.addWorkingSet(ws2); l = provider.getFilterChangeListener(); event = new PropertyChangeEvent(this, WorkingSetFilterActionGroup.CHANGE_WORKING_SET, null, ws2); l.propertyChange(event); DisplayHelper.runEventLoop(Display.getCurrent(), 100); items = _viewer.getTree().getItems(); assertTrue(items[0].getData().equals(_p2)); if (SLEEP_LONG) DisplayHelper.sleep(Display.getCurrent(), 10000000); }
@Override public Color getSeasonForegroundColor(ServiceVO service) { try { if (service == null) return null; if (service.getName().toUpperCase().startsWith("LENT")) { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } if (service.getName().toUpperCase().startsWith("ASH")) { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } if (service.getName().toUpperCase().startsWith("ADVENT")) { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } if (service.getName().toUpperCase().indexOf("GOOD FRIDAY") >= 0) { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } if (service.getType() != null && service.getType().toUpperCase().indexOf("FUNERAL") >= 0) { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } if (service.getType() != null && service.getType().toUpperCase().indexOf("REQUIEM") >= 0) { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } if (service.getName().toUpperCase().indexOf("SOULS") >= 0) { return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); } return Display.getCurrent().getSystemColor(SWT.COLOR_BLACK); } catch (Exception e) { return Display.getCurrent().getSystemColor(SWT.COLOR_BLACK); } }
private void start(Event e) { event = e; if (bkg == null) bkg = ((Control) e.widget).getBackground(); color = new Color(Display.getCurrent(), 255, 255, 200); ((Control) e.widget).setBackground(color); delayedListeners.add(this); Display.getCurrent().timerExec(-1, run); Display.getCurrent().timerExec(3000, run); }
/* (non-Javadoc) * @see javax.microedition.lcdui.Displayable#handleHideEvent() */ void eswtHandleHideCurrentEvent() { super.eswtHandleHideCurrentEvent(); topShell.removeListener(SWT.Resize, resizeListener); nextDisplayable = null; resetTimerTask(false); // remove key filter for scrollable text composite org.eclipse.swt.widgets.Display.getCurrent().removeFilter(SWT.KeyDown, keyListener); org.eclipse.swt.widgets.Display.getCurrent().removeFilter(SWT.Traverse, keyListener); org.eclipse.swt.widgets.Display.getCurrent().removeFilter(SWT.MouseUp, keyListener); }
/** * ************************************************************************* Do a half-blink * ************************************************************************* */ void blink() { if (!m_promptText.isDisposed()) { if (m_blinkSwitch) { m_blinkSwitch = false; m_promptText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW)); } else { m_blinkSwitch = true; m_promptText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); } m_promptText.redraw(); } }
private Image drawPercentage(final double percentage) { final Image img = new Image(Display.getCurrent(), new Rectangle(2, 3, 20, 8)); final GC graphic = new GC(img); graphic.setForeground(new Color(Display.getCurrent(), 60, 140, 10)); graphic.setBackground(new Color(Display.getCurrent(), 60, 140, 10)); graphic.drawRectangle(0, 0, 18, 6); graphic.fillRectangle(1, 1, (int) (17 * percentage / 100), 5); return img; }
public static String getInput(String mes, String title) { Shell shell; if (Display.getCurrent() == null || Display.getCurrent().getActiveShell() == null) { shell = new Shell(); } else { shell = Display.getCurrent().getActiveShell(); } MessageBox what_a_mess = new MessageBox(shell, SWT.ICON_QUESTION); what_a_mess.setMessage(mes); what_a_mess.setText(title); return what_a_mess.open() + ""; }
private static void show(String mes, String title, int style) { Shell shell; if (Display.getCurrent() == null || Display.getCurrent().getActiveShell() == null) { shell = new Shell(); } else { shell = Display.getCurrent().getActiveShell(); } MessageBox what_a_mess = new MessageBox(shell, style); what_a_mess.setMessage(mes); what_a_mess.setText(title); what_a_mess.open(); }
/** * Launch the application. * * @param args */ public static void main(String[] args) { try { SendMsgWindow window = new SendMsgWindow(null, null); Shell sendMsgWindowShell = window.open(); while (sendMsgWindowShell.isDisposed() != true) { if (Display.getCurrent().readAndDispatch() != true) { Display.getCurrent().sleep(); } } } catch (Exception e) { e.printStackTrace(); } }