本文整理汇总了Java中org.eclipse.swt.widgets.Display类的典型用法代码示例。如果您正苦于以下问题:Java Display类的具体用法?Java Display怎么用?Java Display使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Display类属于org.eclipse.swt.widgets包,在下文中一共展示了Display类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
/**
* Starting point for the demonstration application.
*
* @param args ignored.
*/
public static void main( String[] args )
{
JFreeChart chart = createChart(createDataset());
Display display = new Display();
Shell shell = new Shell(display);
shell.setSize(600, 400);
shell.setLayout(new FillLayout());
shell.setText("Test for jfreechart running with SWT");
final ChartComposite frame = new ChartComposite(shell, SWT.NONE, chart, true);
//frame.setDisplayToolTips(false);
frame.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
示例2: onDoubleClick
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
@Override
protected void onDoubleClick() {
HivePartitionKeyValueDialog fieldDialog=new HivePartitionKeyValueDialog(Display.getCurrent().getActiveShell(), propertyDialogButtonBar);
fieldDialog.setComponentName(gridConfig.getComponentName());
if (getProperties().get(propertyName) == null) {
InputHivePartitionKeyValues inputHivePartitionKeyValues = new InputHivePartitionKeyValues();
List<String> keys= new ArrayList<>();
List<InputHivePartitionColumn> keyValues = new ArrayList<>();
inputHivePartitionKeyValues.setKey(keys);
inputHivePartitionKeyValues.setKeyValues(keyValues);
setProperties(propertyName, (InputHivePartitionKeyValues)inputHivePartitionKeyValues);
}
fieldDialog.setRuntimePropertySet(hivePartitionKeyValues);
fieldDialog.setSourceFieldsFromPropagatedSchema(getPropagatedSchema());
fieldDialog.open();
setProperties(propertyName,fieldDialog.getRuntimePropertySet());
}
示例3: init
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
super.init(site, input);
setSite(site);
setPartName(input.getName());
setInputWithNotify(input);
site.setSelectionProvider(this);
if (getEditorInput() instanceof FileEditorInput) {
FileEditorInput fei = (FileEditorInput) getEditorInput();
IFile file = fei.getFile();
gWGraph = ResourceManager.load(file);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
gWGraph.initialize(getGraphicalViewer().getEditPartRegistry());
if (!ResourceManager.isEditable(file)) {
gWGraph.setReadOnly(true);
getGraphicalViewer().getControl().setEnabled(false);
String title = MessageUtil.getString("conversion");
String message = MessageUtil.getString("not_formatted_as_json_convert_it");
DialogManager.displayWarning(title, message);
}
}
});
}
}
示例4: show
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
/**
* Build and show the Window, dispose it after is is not longer needed.
* @param parent The parent ShellWindow.
* @param arrayModificationHandler The ArrayModificationHandler the holds the represented array.
* @param myDimension The dimension of a probably multidimensional array this Window represents.
* @param dimensionsIndexes Dimension indexes of the higher-level dimensions the array represented might be a part of.
*/
public void show(ShellWindow parent, ArrayModificationHandler arrayModificationHandler, int myDimension, int[] dimensionsIndexes) {
try {
// Initialize.
this.parent = parent;
this.display = Display.getDefault();
createShell(arrayModificationHandler, myDimension, dimensionsIndexes);
this.shell.open();
// Keep the window active as long as it is needed.
while (!this.shell.isDisposed()) {
if (!this.display.readAndDispatch())
this.display.sleep();
}
} catch (Throwable t) {
arrayModificationHandler.doNotReturnThisArray();
StaticGuiSupport.processGuiError(t, "Array entries", parent.getShell());
} finally {
doExit();
}
}
示例5: testFinished
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
/**
* Called when an atomic test has finished, whether the test succeeds or fails.
*
* @param description
* the description of the test that just ran
*/
@Override
public void testFinished(Description description) throws Exception {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
try {
N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
N4IDEXpectView.ID);
view.notifyFinishedExecutionOf(description);
} catch (PartInitException e) {
N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
}
}
});
}
示例6: testAssumptionFailure
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
/**
* Called when an atomic test flags that it assumes a condition that is false
*
* describes the test that failed and the {@link AssumptionViolatedException} that was thrown
*/
@Override
public void testAssumptionFailure(Failure failure) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
IWorkbenchWindow[] windows = N4IDEXpectUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
try {
N4IDEXpectView view = (N4IDEXpectView) windows[0].getActivePage().showView(
N4IDEXpectView.ID);
view.notifyFailedExecutionOf(failure);
} catch (PartInitException e) {
N4IDEXpectUIPlugin.logError("cannot refresh test view window", e);
}
}
});
}
示例7: show
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
/**
* Build and show the Windows, dispose it after is is not longer needed.
* @param parentShell The parent windows' Shell.
* @param classLoader The system MugglClassLoader.
* @param classFile The classFile the initial Method belongs to.
* @param method The initial Method.
*/
public void show(Shell parentShell, MugglClassLoader classLoader, ClassFile classFile, Method method) {
try {
this.display = Display.getDefault();
if (createShell(parentShell, classLoader, classFile, method))
this.shell.open();
// Now make the parent shell invisible.
parentShell.setVisible(false);
// Keep the window alive.
while (!this.shell.isDisposed()) {
if (!this.display.readAndDispatch())
this.display.sleep();
}
} catch (Throwable t) {
StaticGuiSupport.processGuiError(t, "Step by step execution", parentShell);
} finally {
//Make the parent shell visible.
parentShell.setVisible(true);
// Make sure execution is aborted. Otherwise the Thread would not be stopped and the memory released after this window is closed.
if (this.stepByStepExecutionComposite != null) this.stepByStepExecutionComposite.abortExecution(false);
doExit();
}
}
示例8: update
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
@Override
public void update ( final ViewerCell cell )
{
final ConfigurationDescriptor cfg = (ConfigurationDescriptor)cell.getElement ();
switch ( cell.getColumnIndex () )
{
case 0:
cell.setText ( cfg.getConfigurationInformation ().getId () );
break;
case 1:
cell.setText ( "" + cfg.getConfigurationInformation ().getState () );
break;
}
if ( cfg.getConfigurationInformation ().getErrorInformation () != null )
{
cell.setBackground ( Display.getCurrent ().getSystemColor ( SWT.COLOR_RED ) );
}
else
{
cell.setBackground ( null );
}
super.update ( cell );
}
示例9: MainAvoCADoShell
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
/**
* create the main avoCADo shell and display it
* @param display
*/
public MainAvoCADoShell(Display display){
shell = new Shell(display);
setupShell(); // place components in the main avoCADo shell
shell.setText("avoCADo");
shell.setSize(800, 600); //TODO: set intial size to last known size
shell.setMinimumSize(640, 480);
Rectangle b = display.getBounds();
int xPos = Math.max(0, (b.width-800)/2);
int yPos = Math.max(0, (b.height-600)/2);
shell.setLocation(xPos, yPos);
shell.setImage(ImageUtils.getIcon("./avoCADo.png", 32, 32));
shell.open();
AvoGlobal.intializeNewAvoCADoProject(); // initialize app to starting model/view.
StartupSplashShell.closeSplash();
// handle events while the shell is not disposed
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
示例10: focusMarker
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
public static void focusMarker(final IMarker marker) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
try {
IDE.openEditor(
MarkerActivator.getDefault().getWorkbench().getWorkbenchWindows()[0].getActivePage(),
marker);
} catch (final PartInitException e1) {
e1.printStackTrace();
}
}
});
}
示例11: TestProgressBar
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
/**
* Create instance.
*/
public TestProgressBar(Composite parent, int style) {
super(parent, style);
// damn you, SWT color management
// Color sample is form: http://www.colorpicker.com/c6f2b1
colorSkipped = new Color(Display.getCurrent(), 230, 232, 235);
colorPassed = new Color(Display.getCurrent(), 198, 242, 177);
colorFailed = new Color(Display.getCurrent(), 242, 188, 177);
colorError = new Color(Display.getCurrent(), 242, 188, 177);
colorFixme = new Color(Display.getCurrent(), 177, 231, 242);
addPaintListener((ev) -> {
onPaint(ev.gc);
});
addDisposeListener((ev) -> {
onDispose();
});
}
示例12: getSchemaFromXSD
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
public List<GridRow> getSchemaFromXSD(String XSDFile,String loopXPathQuery) throws ParserConfigurationException, SAXException, IOException, JAXBException{
SchemaParser parser = new SchemaParser();
try{
Schema schema=parser.parse(XSDFile);
Element element = getRowTagElement(schema);
if(element==null){
return null;
}
return parseElementsOfRowTag(element,loopXPathQuery);
}
catch(Exception e){
createMessageBox(INVALID_XSD_FILE+e.getMessage(), Constants.ERROR, SWT.ERROR,Display.getCurrent().getActiveShell());
}
return null;
}
示例13: CommentBoxFigure
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
/**
* Creates a new CommentBoxFigure with a MarginBorder that is the given size and a FlowPage containing a TextFlow
* with the style WORD_WRAP_SOFT.
*
* @param borderSize
* the size of the MarginBorder
*/
public CommentBoxFigure(int borderSize) {
setBorder(new MarginBorder(5));
FlowPage flowPage = new FlowPage();
textFlow = new TextFlow();
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_SOFT));
flowPage.add(textFlow);
setLayoutManager(new StackLayout());
add(flowPage);
font = new Font(Display.getDefault(), "Arial", 9, SWT.NORMAL);
setFont(font);
setForegroundColor(ColorConstants.black);
setOpaque(false);
}
示例14: start
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
@Override
public Object start ( final IApplicationContext context ) throws Exception
{
Display display = PlatformUI.createDisplay ();
try
{
int returnCode = PlatformUI.createAndRunWorkbench ( display, new ApplicationWorkbenchAdvisor () );
if ( returnCode == PlatformUI.RETURN_RESTART )
{
return IApplication.EXIT_RESTART;
}
else
{
return IApplication.EXIT_OK;
}
}
finally
{
display.dispose ();
}
}
示例15: AboutAvoCADoGPLShell
import org.eclipse.swt.widgets.Display; //导入依赖的package包/类
/**
* create the startup splash shell and display it
* @param display
*/
public AboutAvoCADoGPLShell(Display display){
shell = new Shell(display, SWT.PRIMARY_MODAL);
setupShell(); // place components in the avoCADo license shell
shell.setText("avoCADo GPLv2");
shell.setSize(583, 350); //TODO: set initial size to last known size
Rectangle b = display.getBounds();
int xPos = Math.max(0, (b.width-583)/2);
int yPos = Math.max(0, (b.height-350)/2);
shell.setLocation(xPos, yPos);
shell.open();
// handle events while the shell is not disposed
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}