use of org.eclipse.swt.widgets.Display in project translationstudio8 by heartsome.
the class ColorPicker method getColorImage.
private Image getColorImage(Color color) {
Display display = Display.getCurrent();
image = new Image(display, new Rectangle(10, 10, 70, 20));
GC gc = new GC(image);
gc.setBackground(color);
gc.fillRectangle(image.getBounds());
gc.dispose();
return image;
}
use of org.eclipse.swt.widgets.Display in project translationstudio8 by heartsome.
the class CustomMatchConditionDialog method main.
/**
* @param args ;
*/
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
final Combo combo = new Combo(shell, SWT.READ_ONLY);
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
Button button = new Button(shell, SWT.PUSH);
button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
button.setText("OK");
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CustomMatchConditionDialog dialog = new CustomMatchConditionDialog(shell);
int res = dialog.open();
if (res == CustomMatchConditionDialog.OK) {
}
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
use of org.eclipse.swt.widgets.Display in project translationstudio8 by heartsome.
the class XLIFFEditorImplWithNatTable method close.
/**
* 关闭此编辑器。 <li>当编辑器关闭自己会抛出 PartInitException 异常警告,因此此方法最适合在 init(IEditorSite site, IEditorInput input) 方法中调用</li>
*/
private void close() throws PartInitException {
Display display = getSite().getShell().getDisplay();
display.asyncExec(new Runnable() {
public void run() {
getSite().getPage().closeEditor(XLIFFEditorImplWithNatTable.this, false);
// Add By Leakey 释放资源
if (titleImage != null && !titleImage.isDisposed()) {
titleImage.dispose();
titleImage = null;
}
if (statusLineImage != null && !statusLineImage.isDisposed()) {
statusLineImage.dispose();
statusLineImage = null;
}
if (table != null && !table.isDisposed()) {
table.dispose();
table = null;
}
handler = null;
System.gc();
JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener);
}
});
}
use of org.eclipse.swt.widgets.Display in project otertool by wuntee.
the class BuildAndSignApkDialog method open.
/**
* Open the dialog.
* @return the result
*/
public BuildAndSignApkBean open() {
createContents();
shlBuildAndSign.open();
shlBuildAndSign.layout();
Display display = getParent().getDisplay();
while (!shlBuildAndSign.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return result;
}
use of org.eclipse.swt.widgets.Display in project otertool by wuntee.
the class FindDialog method open.
/**
* Open the dialog.
* @return the result
*/
public Object open() {
createContents();
shlFind.open();
shlFind.layout();
Display display = getParent().getDisplay();
while (!shlFind.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return result;
}
Aggregations