Java Code Examples for org.eclipse.swt.layout.GridData#CENTER
The following examples show how to use
org.eclipse.swt.layout.GridData#CENTER .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoginDialog.java From nebula with Eclipse Public License 2.0 | 6 votes |
private void buildOkButton() { buttonOk = new Button(shell, SWT.PUSH); final GridData gdOk = new GridData(GridData.END, GridData.CENTER, true, false, 3, 1); gdOk.verticalIndent = 60; gdOk.minimumWidth = 80; buttonOk.setLayoutData(gdOk); buttonOk.setText(ResourceManager.getLabel(ResourceManager.OK)); buttonOk.setEnabled(false); buttonOk.addListener(SWT.Selection, event -> { try { verifier.authenticate(login, password); returnedValue = true; shell.dispose(); } catch (final Exception e) { Dialog.error(ResourceManager.getLabel(ResourceManager.LOGIN_FAILED), e.getMessage()); for (final Control control : shell.getChildren()) { if (control instanceof Text || control instanceof Combo) { control.setFocus(); break; } } } }); }
Example 2
Source File: OptionsConfigurationBlock.java From typescript.java with MIT License | 6 votes |
protected Combo addComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels, int indent) { GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1); gd.horizontalIndent = indent; Label labelControl = new Label(parent, SWT.LEFT); labelControl.setText(label); labelControl.setFont(JFaceResources.getDialogFont()); labelControl.setLayoutData(gd); Combo comboBox = newComboControl(parent, key, values, valueLabels); comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); fLabels.put(comboBox, labelControl); return comboBox; }
Example 3
Source File: ExtractMethodComposite.java From Pydev with Eclipse Public License 1.0 | 6 votes |
private void createOffsetStrategy(Composite mainComp) { FillLayout fillLayout = new FillLayout(); fillLayout.type = org.eclipse.swt.SWT.VERTICAL; GridData gridData7 = new GridData(); gridData7.horizontalSpan = 2; gridData7.verticalAlignment = GridData.CENTER; gridData7.grabExcessHorizontalSpace = true; gridData7.horizontalAlignment = GridData.FILL; Composite comboComp = new Composite(mainComp, SWT.NONE); comboComp.setLayoutData(gridData7); comboComp.setLayout(fillLayout); methodInsertionLbl = new CLabel(comboComp, SWT.NONE); methodInsertionLbl.setText(Messages.offsetStrategyInsertionPointMethod); methodInsertionComb = createComboViewer(comboComp); methodInsertionComb.getCombo().select(0); }
Example 4
Source File: SortMembersMessageDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private Control createLinkControl(Composite composite) { Link link= new Link(composite, SWT.WRAP | SWT.RIGHT); link.setText(DialogsMessages.SortMembersMessageDialog_description); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openMembersSortOrderPage(); } }); link.setToolTipText(DialogsMessages.SortMembersMessageDialog_link_tooltip); GridData gridData= new GridData(GridData.FILL, GridData.CENTER, true, false); gridData.widthHint= convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);//convertWidthInCharsToPixels(60); link.setLayoutData(gridData); link.setFont(composite.getFont()); return link; }
Example 5
Source File: OptionsConfigurationBlock.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected Combo addComboBox(Composite parent, String label, String key, int indent, String[] values, String[] valueLabels) { GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1); gd.horizontalIndent = indent; Label labelControl = new Label(parent, SWT.LEFT); labelControl.setFont(JFaceResources.getDialogFont()); labelControl.setText(label); labelControl.setLayoutData(gd); Combo comboBox = newComboControl(parent, key, values, valueLabels); comboBox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); labels.put(comboBox, labelControl); return comboBox; }
Example 6
Source File: CheckBoxGroup.java From nebula with Eclipse Public License 2.0 | 6 votes |
private void createCheckBoxButton() { button = new Button(this, SWT.CHECK); final GridData gdButton = new GridData(GridData.BEGINNING, GridData.CENTER, true, false); gdButton.horizontalIndent = 15; button.setLayoutData(gdButton); button.setSelection(true); button.pack(); button.addSelectionListener(new SelectionAdapter() { /** * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(final SelectionEvent e) { e.doit = fireSelectionListeners(e); if (!e.doit) { return; } if (button.getSelection()) { activate(); } else { deactivate(); } } }); }
Example 7
Source File: OverrideMethodsPage.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private void createCommentComp(Composite parent) { GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.horizontalSpan = 2; gridData.verticalAlignment = GridData.CENTER; }
Example 8
Source File: SdkToolsControlAddDialog.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override public void createControl(Composite parent) { initializeDialogUnits(parent); setTitle(Messages.SdkToolsControlAddDialog_AddToToolMenu); setDescription(Messages.SdkToolsControlAddDialog_Description); Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(1, false)); Composite rbblock = new Composite(container, SWT.NULL); GridData gridData = new GridData(GridData.CENTER, GridData.CENTER, true, true); rbblock.setLayoutData(gridData); GridLayout grid = new GridLayout(1, false); grid.verticalSpacing = 20; grid.marginRight = 100; rbblock.setLayout(grid); rbTool = SWTFactory.createRadiobutton(rbblock, Messages.SdkToolsControlAddDialog_AddTool, 1); rbSeparator = SWTFactory.createRadiobutton(rbblock, Messages.SdkToolsControlAddDialog_AddSeparator, 1); rbGroup = SWTFactory.createRadiobutton(rbblock, Messages.SdkToolsControlAddDialog_AddGroup, 1); rbSeparator.addSelectionListener(this); rbTool.addSelectionListener(this); rbGroup.addSelectionListener(this); rbTool.setSelection(true); widgetSelected(null); }
Example 9
Source File: LoginDialog.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Build the "remember password" part of the box */ private void buildRememberPassword() { final Button checkbox = new Button(shell, SWT.CHECK); final GridData gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false, 4, 1); gridData.horizontalIndent = 35; checkbox.setLayoutData(gridData); checkbox.setText(ResourceManager.getLabel(ResourceManager.REMEMBER_PASSWORD)); checkbox.setSelection(rememberPassword); }
Example 10
Source File: LabelFieldEditor.java From developer-studio with Apache License 2.0 | 5 votes |
protected void doFillIntoGrid(Composite parent, int numColumns) { label = getLabelControl(parent); GridData gridData = new GridData(); gridData.horizontalSpan = numColumns; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = false; gridData.verticalAlignment = GridData.CENTER; gridData.grabExcessVerticalSpace = false; label.setLayoutData(gridData); }
Example 11
Source File: OverrideMethodsPage.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private void createComboComp() { FillLayout fillLayout = new FillLayout(); fillLayout.type = org.eclipse.swt.SWT.VERTICAL; GridData gridData7 = new GridData(); gridData7.horizontalSpan = 2; gridData7.verticalAlignment = GridData.CENTER; gridData7.grabExcessHorizontalSpace = true; gridData7.horizontalAlignment = GridData.FILL; comboComp = new Composite(mainComp, SWT.NONE); comboComp.setLayoutData(gridData7); comboComp.setLayout(fillLayout); insertionPointLbl = new CLabel(comboComp, SWT.NONE); insertionPointLbl.setText(Messages.offsetStrategyInsertionPointMethod); insertionPointCmb = createComboViewer(comboComp); insertionPointCmb.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection sel = (IStructuredSelection) event.getSelection(); if (!sel.isEmpty()) { OffsetStrategyModel elem = (OffsetStrategyModel) sel.getFirstElement(); getRequestProcessor().setInsertionPoint(elem.getStrategy()); } } }); getRequestProcessor().setInsertionPoint(strategyProvider.get(0).getStrategy()); insertionPointCmb.getCombo().select(0); }
Example 12
Source File: SVNWizardPage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Create a text field specific for this application * * @param parent the parent of the new text field * @return the new text field */ static public Text createTextField(Composite parent) { Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.verticalAlignment = GridData.CENTER; data.grabExcessVerticalSpace = false; data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; text.setLayoutData(data); return text; }
Example 13
Source File: QuickOutlinePopup.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected Text createFilterText(Composite parent) { filterText = new Text(parent, SWT.NONE); Dialog.applyDialogFont(filterText); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.CENTER; filterText.setLayoutData(data); filterText.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == 0x0D) // return gotoSelectedElement(); if (e.keyCode == SWT.ARROW_DOWN) treeViewer.getTree().setFocus(); if (e.keyCode == SWT.ARROW_UP) treeViewer.getTree().setFocus(); if (e.character == 0x1B) // ESC dispose(); if (e.keyCode == invokingKeystroke.getNaturalKey() && e.stateMask == invokingKeystroke.getModifierKeys()) { changeOutlineMode(); e.doit = false; } } }); return filterText; }
Example 14
Source File: MonthCalendar.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * This method initializes weekHeader * */ private void createWeekHeader() { GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.verticalAlignment = GridData.CENTER; weekHeader = new WeekHeader(this, SWT.NONE); weekHeader.setLayoutData(gridData); }
Example 15
Source File: NativeLibrariesConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public Control createContents(Composite parent) { fShell= parent.getShell(); Composite inner= new Composite(parent, SWT.NONE); inner.setFont(parent.getFont()); inner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); int nColumns= 3; GridLayout layout= new GridLayout(nColumns, false); layout.marginWidth= 0; layout.marginWidth= 0; inner.setLayout(layout); PixelConverter converter= new PixelConverter(parent); Label desc= new Label(inner, SWT.WRAP); desc.setFont(inner.getFont()); desc.setText(Messages.format(NewWizardMessages.NativeLibrariesDialog_description, new String[] { BasicElementLabels.getResourceName(fEntry.getPath().lastSegment()) })); GridData gridData= new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1); gridData.widthHint= converter.convertWidthInCharsToPixels(80); desc.setLayoutData(gridData); fPathField.doFillIntoGrid(inner, 2); LayoutUtil.setHorizontalGrabbing(fPathField.getTextControl(null)); LayoutUtil.setWidthHint(fPathField.getTextControl(null), converter.convertWidthInCharsToPixels(50)); fBrowseExternal.doFillIntoGrid(inner, 1); DialogField.createEmptySpace(inner, 2); fBrowseWorkspace.doFillIntoGrid(inner, 1); fPathField.setFocus(); return parent; }
Example 16
Source File: AbstractPictureControl.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Create the "Modify" Link to open Explorer File to select a new image. * * @param parent * @param style * @return */ private T createModifyLink(Composite parent, int style) { T modifyImageLink = createLink(parent, style); GridData gridData = new GridData(GridData.CENTER, GridData.CENTER, true, false); modifyImageLink.setLayoutData(gridData); setLinkText(modifyImageLink, resources.getString(PICTURE_CONTROL_MODIFY)); addModifyImageHandler(modifyImageLink); return modifyImageLink; }
Example 17
Source File: StringSortPageableTableExample.java From nebula with Eclipse Public License 2.0 | 4 votes |
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); GridLayout layout = new GridLayout(2, false); shell.setLayout(layout); final List<String> items = createList(); // 1) Create pageable table with 10 items per page // This SWT Component create internally a SWT Table+JFace TreeViewer int pageSize = 10; paginationTable = new PageableTable(shell, SWT.BORDER, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, pageSize); paginationTable.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); // 2) Initialize the table viewer + SWT Table TableViewer viewer = paginationTable.getViewer(); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.setLabelProvider(new LabelProvider()); Table table = viewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); // 3) Create column by adding SortTableColumnSelectionListener listener // to sort the paginated table. TableViewerColumn col = createTableViewerColumn(viewer, "Name", 150); col.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { String p = (String) element; return p; } }); // Call SortTableColumnSelectionListener with null property name because // it's a list of String. col.getColumn().addSelectionListener(new SortTableColumnSelectionListener(null)); // 4) Set the page loader used to load a page (sublist of String) // according the page index selected, the page size etc. paginationTable.setPageLoader(new PageResultLoaderList<>(items)); // 5) Set current page to 0 to display the first page paginationTable.setCurrentPage(0); Label lbl = new Label(shell, SWT.NONE); lbl.setText("Max rows per page: "); lbl.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); txt = new Text(shell, SWT.BORDER); txt.setText("10"); GridData gd = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); gd.widthHint = 30; txt.setLayoutData(gd); txt.addTraverseListener(e -> updatePageSize()); txt.addListener(SWT.FocusOut, e -> updatePageSize()); // paginationTable.getController().setPageSize(10); shell.setSize(550, 320); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
Example 18
Source File: RangeSliderSnippet.java From nebula with Eclipse Public License 2.0 | 4 votes |
private static void createDifferentSliders(final Group group) { group.setLayout(new GridLayout(3, false)); final TitledSeparator tsh = new TitledSeparator(group, SWT.NONE); tsh.setText("Horizontal Range Slider, between 100 and 1000, increment by 100"); tsh.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1)); final RangeSlider hRangeSlider = new RangeSlider(group, SWT.HORIZONTAL); final GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 2); gd.widthHint = 250; hRangeSlider.setLayoutData(gd); hRangeSlider.setMinimum(100); hRangeSlider.setMaximum(1000); hRangeSlider.setLowerValue(200); hRangeSlider.setUpperValue(800); hRangeSlider.setIncrement(100); hRangeSlider.setPageIncrement(200); final Label hLabelLower = new Label(group, SWT.NONE); hLabelLower.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1)); hLabelLower.setText("Lower Value:"); final Text hTextLower = new Text(group, SWT.BORDER); hTextLower.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1)); hTextLower.setText(hRangeSlider.getLowerValue() + " "); hTextLower.setEnabled(false); final Label hLabelUpper = new Label(group, SWT.NONE); hLabelUpper.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1)); hLabelUpper.setText("Upper Value:"); final Text hTextUpper = new Text(group, SWT.BORDER); hTextUpper.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1)); hTextUpper.setText(hRangeSlider.getUpperValue() + " "); hTextUpper.setEnabled(false); final TitledSeparator tsv = new TitledSeparator(group, SWT.NONE); tsv.setText("Vertical Range Slider, between 100 and 1000, increment by 100"); tsv.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1)); final RangeSlider vRangeSlider = new RangeSlider(group, SWT.VERTICAL); final GridData gd2 = new GridData(GridData.CENTER, GridData.FILL, false, false, 1, 2); gd2.heightHint = 300; vRangeSlider.setLayoutData(gd2); vRangeSlider.setMinimum(100); vRangeSlider.setMaximum(1000); vRangeSlider.setLowerValue(200); vRangeSlider.setUpperValue(800); vRangeSlider.setIncrement(100); vRangeSlider.setPageIncrement(200); final Label vLabelLower = new Label(group, SWT.NONE); vLabelLower.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1)); vLabelLower.setText("Lower Value:"); final Text vTextLower = new Text(group, SWT.BORDER); vTextLower.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1)); vTextLower.setText(vRangeSlider.getLowerValue() + " "); vTextLower.setEnabled(false); final Label vLabelUpper = new Label(group, SWT.NONE); vLabelUpper.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 1, 1)); vLabelUpper.setText("Upper Value:"); final Text vTextUpper = new Text(group, SWT.BORDER); vTextUpper.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 1, 1)); vTextUpper.setText(vRangeSlider.getUpperValue() + " "); vTextUpper.setEnabled(false); }
Example 19
Source File: WeekHeader.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * This method initializes this * */ private void initialize() { this.setSize(new org.eclipse.swt.graphics.Point(536, 54)); GridData gridData6 = new GridData(); gridData6.horizontalAlignment = GridData.FILL; gridData6.grabExcessHorizontalSpace = true; gridData6.verticalAlignment = GridData.CENTER; GridData gridData5 = new GridData(); gridData5.horizontalAlignment = GridData.FILL; gridData5.grabExcessHorizontalSpace = true; gridData5.verticalAlignment = GridData.CENTER; GridData gridData4 = new GridData(); gridData4.horizontalAlignment = GridData.FILL; gridData4.grabExcessHorizontalSpace = true; gridData4.verticalAlignment = GridData.CENTER; GridData gridData3 = new GridData(); gridData3.horizontalAlignment = GridData.FILL; gridData3.grabExcessHorizontalSpace = true; gridData3.verticalAlignment = GridData.CENTER; GridData gridData2 = new GridData(); gridData2.horizontalAlignment = GridData.FILL; gridData2.grabExcessHorizontalSpace = true; gridData2.verticalAlignment = GridData.CENTER; GridData gridData1 = new GridData(); gridData1.horizontalAlignment = GridData.FILL; gridData1.grabExcessHorizontalSpace = true; gridData1.verticalAlignment = GridData.CENTER; GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.verticalAlignment = GridData.CENTER; setLayout(new GridLayout(7, true)); label = new Label(this, SWT.CENTER); label.setBounds(new org.eclipse.swt.graphics.Rectangle(23, 18, 53, 18)); label.setLayoutData(gridData6); label.setText("Monday"); label1 = new Label(this, SWT.CENTER); label1.setBounds(new org.eclipse.swt.graphics.Rectangle(98, 18, 79, 17)); label1.setLayoutData(gridData5); label1.setText("Tuesday"); label2 = new Label(this, SWT.CENTER); label2.setBounds(new org.eclipse.swt.graphics.Rectangle(187, 18, 47, 17)); label2.setLayoutData(gridData4); label2.setText("Wednesday"); label3 = new Label(this, SWT.CENTER); label3.setBounds(new org.eclipse.swt.graphics.Rectangle(256, 17, 67, 17)); label3.setLayoutData(gridData3); label3.setText("Thursday"); label4 = new Label(this, SWT.CENTER); label4.setBounds(new org.eclipse.swt.graphics.Rectangle(338, 17, 62, 20)); label4.setLayoutData(gridData2); label4.setText("Friday"); label5 = new Label(this, SWT.CENTER); label5.setBounds(new org.eclipse.swt.graphics.Rectangle(415, 16, 43, 21)); label5.setLayoutData(gridData1); label5.setText("Saturday"); label6 = new Label(this, SWT.CENTER); label6.setBounds(new org.eclipse.swt.graphics.Rectangle(469, 16, 61, 23)); label6.setLayoutData(gridData); label6.setText("Sunday"); }
Example 20
Source File: PasswordRevealerSnippet.java From nebula with Eclipse Public License 2.0 | 4 votes |
public static void main(final String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); final Color white = display.getSystemColor(SWT.COLOR_WHITE); shell.setBackground(white); shell.setText("Password Revealer Snippet"); final Image image = new Image(display, PasswordRevealerSnippet.class.getResourceAsStream("eye.png")); final Image clickImage = new Image(display, PasswordRevealerSnippet.class.getResourceAsStream("eye-slash.png")); shell.addListener(SWT.Dispose, e -> { image.dispose(); clickImage.dispose(); }); final Label lbl1 = new Label(shell, SWT.NONE); lbl1.setText("Password Revealer:"); final GridData gdLabel1 = new GridData(GridData.BEGINNING, GridData.CENTER, true, false); gdLabel1.widthHint = 150; lbl1.setBackground(white); lbl1.setLayoutData(gdLabel1); final PasswordRevealer revealer = new PasswordRevealer(shell, SWT.NONE); final GridData gd = new GridData(GridData.FILL, GridData.CENTER, true, false); gd.widthHint = 250; revealer.setLayoutData(gd); revealer.setBackground(white); new Label(shell, SWT.NONE); final Label lbl2 = new Label(shell, SWT.NONE); lbl2.setText("Password Revealer with other icon:"); final GridData gdLabel2 = new GridData(GridData.FILL, GridData.CENTER, true, false); gdLabel2.widthHint = 150; lbl2.setBackground(white); lbl2.setLayoutData(gdLabel2); final PasswordRevealer revealer2 = new PasswordRevealer(shell, SWT.NONE); final GridData gd2 = new GridData(GridData.FILL, GridData.CENTER, true, false); gd2.widthHint = 250; revealer2.setLayoutData(gd2); revealer2.setBackground(white); revealer2.setImage(image); revealer2.setClickImage(clickImage); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }