当前位置: 首页>>代码示例>>Java>>正文


Java Shell.getDisplay方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Shell.getDisplay方法的典型用法代码示例。如果您正苦于以下问题:Java Shell.getDisplay方法的具体用法?Java Shell.getDisplay怎么用?Java Shell.getDisplay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.Shell的用法示例。


在下文中一共展示了Shell.getDisplay方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: runEventLoop

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
private void runEventLoop(Shell loopShell) {
	Display display;
	if (getShell() == null) {
		display = Display.getCurrent();
	} else {
		display = loopShell.getDisplay();
	}

	while (loopShell != null && !loopShell.isDisposed()) {
		try {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		} catch (Throwable e) {
			EclipseUtil.logError("UI problems on dispatch",e);
		}
	}
	if (!display.isDisposed()) {
		display.update();
	}
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:22,代码来源:AbstractQuickDialog.java

示例2: DialogFuture

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public DialogFuture ( final Shell parentShell, final Callback[] callbacks, final List<CallbackWidgetFactory> factories )
{
    this.parentShell = parentShell;
    this.display = parentShell.getDisplay ();
    this.callbacks = callbacks;
    this.factories = factories;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:8,代码来源:DialogFuture.java

示例3: DisplayCallbackHandler

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public DisplayCallbackHandler ( final Shell parentShell, final String dialogTitle, final String dialogMessage )
{
    this.parentShell = parentShell;
    this.display = parentShell.getDisplay ();
    this.dialogTitle = dialogTitle;
    this.dialogMessage = dialogMessage;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:8,代码来源:DisplayCallbackHandler.java

示例4: configureShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
@Override
public void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText("Limit chars logs");
	newShell.setSize(nWidth, nHeight);

	int nLeft = 0;
	int nTop = 0;

	Display display = newShell.getDisplay();

	Point pt = display.getCursorLocation();
	Monitor[] monitors = display.getMonitors();

	for (int i = 0; i < monitors.length; i++) {
		if (monitors[i].getBounds().contains(pt)) {
			Rectangle rect = monitors[i].getClientArea();

			if (rect.x < 0)
				nLeft = ((rect.width - nWidth) / 2) + rect.x;
			else
				nLeft = (rect.width - nWidth) / 2;

			if (rect.y < 0)
				nTop = ((rect.height - nHeight) / 2) + rect.y;
			else
				nTop = (rect.height - nHeight) / 2;

			break;
		}
	}

	newShell.setBounds(nLeft, nTop, nWidth, nHeight);
	
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:36,代码来源:LimitCharsLogsPreferenceDialog.java

示例5: configureShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
@Override
public void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText("Parameters availables");
	newShell.setSize(nWidth, nHeight);

	int nLeft = 0;
	int nTop = 0;

	Display display = newShell.getDisplay();

	Point pt = display.getCursorLocation();
	Monitor[] monitors = display.getMonitors();

	for (int i = 0; i < monitors.length; i++) {
		if (monitors[i].getBounds().contains(pt)) {
			Rectangle rect = monitors[i].getClientArea();

			if (rect.x < 0)
				nLeft = ((rect.width - nWidth) / 2) + rect.x;
			else
				nLeft = (rect.width - nWidth) / 2;

			if (rect.y < 0)
				nTop = ((rect.height - nHeight) / 2) + rect.y;
			else
				nTop = (rect.height - nHeight) / 2;

			break;
		}
	}

	newShell.setBounds(nLeft, nTop, nWidth, nHeight);
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:35,代码来源:CouchVariablesDialog.java

示例6: configureShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
@Override
	public void configureShell(Shell newShell) {
		super.configureShell(newShell);
		
		newShell.setText(dialogTitle);	
		
		int nLeft = 0;
		int nTop = 0;
		 
		Display display = newShell.getDisplay();

//		// mods jmc 22/10/2013
//		nWidth = newShell.getSize().x;
//		nHeight = newShell.getSize().y;
		
		Point pt = display.getCursorLocation();
	    Monitor [] monitors = display.getMonitors();

	    for (int i= 0; i<monitors.length; i++) {
	          if (monitors[i].getBounds().contains(pt)) {
	             Rectangle rect = monitors[i].getClientArea();
	             
	             if (rect.x < 0)
	         		nLeft = ((rect.width - nWidth) / 2) + rect.x;
	             else
	         		nLeft = (rect.width - nWidth) / 2;

	             if (rect.y < 0)
	         		nTop = ((rect.height - nHeight) / 2) + rect.y;
	             else
	         		nTop = (rect.height - nHeight) / 2;
	             
	             break;
	          }
	    }

	    newShell.setBounds(nLeft, nTop, nWidth, nHeight);
	}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:39,代码来源:MyAbstractDialog.java

示例7: configureShell

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
@Override
public void configureShell(Shell newShell) {
	super.configureShell(newShell);
	newShell.setText("Engine Log settings");
	newShell.setSize(nWidth, nHeight);

	int nLeft = 0;
	int nTop = 0;

	Display display = newShell.getDisplay();

	Point pt = display.getCursorLocation();
	Monitor[] monitors = display.getMonitors();

	for (int i = 0; i < monitors.length; i++) {
		if (monitors[i].getBounds().contains(pt)) {
			Rectangle rect = monitors[i].getClientArea();

			if (rect.x < 0)
				nLeft = ((rect.width - nWidth) / 2) + rect.x;
			else
				nLeft = (rect.width - nWidth) / 2;

			if (rect.y < 0)
				nTop = ((rect.height - nHeight) / 2) + rect.y;
			else
				nTop = (rect.height - nHeight) / 2;

			break;
		}
	}

	newShell.setBounds(nLeft, nTop, nWidth, nHeight);
	
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:36,代码来源:EnginePreferenceDialog.java

示例8: main

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	// create the widget's shell
	Shell shell = new Shell();
	shell.setLayout(new FillLayout());
	shell.setSize(500, 500);
	Display display = shell.getDisplay();

	Composite parent = new Composite(shell, SWT.NONE);
	parent.setLayout(new GridLayout());

	StyledText styledText = new StyledText(parent, SWT.BORDER | SWT.V_SCROLL);
	styledText.setLayoutData(new GridData(GridData.FILL_BOTH));

	styledText.setText("a\nb\nc\nd");
	
	StyledTextPatcher.setLineSpacingProvider(styledText, new ILineSpacingProvider() {
		
		@Override
		public Integer getLineSpacing(int lineIndex) {
			if (lineIndex == 0) {
				return 10;
			} else if (lineIndex == 1) {
				return 30;
			}
			return null;
		}
	});
	
	shell.open();
	while (!shell.isDisposed())
		if (!display.readAndDispatch())
			display.sleep();
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:34,代码来源:StyledTextLineSpacingDemo.java

示例9: main

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public static void main(String[] args) {
	Shell shell = new Shell(new Display());
	shell.setSize(365, 280);
	shell.setLayout(new GridLayout());

	Figure root = new Figure();
	root.setFont(shell.getFont());
	XYLayout layout = new XYLayout();
	root.setLayoutManager(layout);

	Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
	canvas.setBackground(ColorConstants.white);
	canvas.setLayoutData(new GridData(GridData.FILL_BOTH));

	VarParser parser = new VarParser("src/pt/iscte/pandionj/tests/Test.java");
	parser.run();
	System.out.println(parser.toText());
	
	createDiagram(root, parser);
	
	LightweightSystem lws = new LightweightSystem(canvas);
	lws.setContents(root);
	

	Display display = shell.getDisplay();
	shell.open();
	while (!shell.isDisposed()) {
		while (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:33,代码来源:TestFigureParser.java

示例10: main

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
	// create the widget's shell
	Shell shell = new Shell();
	shell.setLayout(new FillLayout());
	shell.setSize(500, 500);
	Display display = shell.getDisplay();

	Composite parent = new Composite(shell, SWT.NONE);
	parent.setLayout(new GridLayout(2, false));

	ITextViewer textViewer = new TextViewer(parent, SWT.V_SCROLL | SWT.BORDER);
	String delim = textViewer.getTextWidget().getLineDelimiter();
	textViewer.setDocument(new Document(delim + " class A" + delim + "new A" + delim + "new A" + delim + "class B"
			+ delim + "new B" + delim + "interface I" + delim + "class C implements I"));
	StyledText styledText = textViewer.getTextWidget();
	styledText.setLayoutData(new GridData(GridData.FILL_BOTH));

	CodeLensProviderRegistry registry = CodeLensProviderRegistry.getInstance();
	registry.register(CONTENT_TYPE_ID, new ClassReferencesCodeLensProvider());
	registry.register(CONTENT_TYPE_ID, new ClassImplementationsCodeLensProvider());

	CodeLensStrategy codelens = new CodeLensStrategy(new DefaultCodeLensContext(textViewer), false);
	codelens.addTarget(CONTENT_TYPE_ID).reconcile(null);

	styledText.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent event) {
			codelens.reconcile(null);
		}
	});

	shell.open();
	while (!shell.isDisposed())
		if (!display.readAndDispatch())
			display.sleep();
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:38,代码来源:CodeLensDemo.java

示例11: IconAndMessageDialogEx

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public IconAndMessageDialogEx(Shell parent) {
	super(parent);

	// Create the image
	try {
		image = new Image(parent.getDisplay(),
				new FileInputStream("facepalm.png"));
	} catch (FileNotFoundException e) {
	}

	// Set the default message
	message = "Are you sure you want to do something that dumb?";
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:14,代码来源:IconAndMessageDialogEx.java

示例12: getSWTImage

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
private Image getSWTImage() {
	Shell shell = getShell();
	final Display display;
	if (shell == null || shell.isDisposed()) {
		shell = getParentShell();
	}
	if (shell == null || shell.isDisposed()) {
		display = Display.getCurrent();
		// The dialog should be always instantiated in UI thread.
		// However it was possible to instantiate it in other threads
		// (the code worked in most cases) so the assertion covers
		// only the failing scenario. See bug 107082 for details.
		Assert.isNotNull(display,
				"The dialog should be created in UI thread"); //$NON-NLS-1$
	} else {
		display = shell.getDisplay();
	}

	final Image[] image = new Image[1];
	display.syncExec(new Runnable() {
		public void run() {
			image[0] = display.getSystemImage(SWT.ICON_QUESTION);
		}
	});

	return image[0];

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:29,代码来源:SaveJobFileBeforeRunDialog.java

示例13: StringListChooser

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public StringListChooser(final Shell parentShell) {
  result = null;

  display = parentShell.getDisplay();
  if(display == null || display.isDisposed()) return;
  display.syncExec(new Runnable() {
    @Override
    public void run() {
     createShell(parentShell);
    }
  });
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:13,代码来源:StringListChooser.java

示例14: main

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public static void main(String[] args) {
	Shell shell = new Shell(new Display());
	shell.setSize(1200, 500);
	shell.setLayout(new GridLayout());
	shell.setLocation(100, 150);

	Figure root = new Figure();
	root.setFont(shell.getFont());
	//		XYLayout layout = new XYLayout();
	//		root.setLayoutManager(layout);

	org.eclipse.draw2d.GridLayout layout = new org.eclipse.draw2d.GridLayout(2,false);
	layout.horizontalSpacing = 100;
	root.setLayoutManager(layout);

	Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
	canvas.setBackground(ColorConstants.white);
	canvas.setLayoutData(new GridData(GridData.FILL_BOTH));

	createDiagram(root);

	LightweightSystem lws = new LightweightSystem(canvas);
	lws.setContents(root);

	Display display = shell.getDisplay();
	shell.open();
	while (!shell.isDisposed()) {
		while (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:33,代码来源:TestFigure.java

示例15: main

import org.eclipse.swt.widgets.Shell; //导入方法依赖的package包/类
public static void main(String[] args) {
	Shell shell = new Shell(new Display());
	shell.setSize(1200, 500);
	shell.setLayout(new GridLayout());
	shell.setLocation(100, 150);
	
	Figure root = new Figure();
	root.setFont(shell.getFont());
	//		XYLayout layout = new XYLayout();
	//		root.setLayoutManager(layout);
	
	org.eclipse.draw2d.GridLayout layout = new org.eclipse.draw2d.GridLayout(2,false);
	layout.horizontalSpacing = 100;
	root.setLayoutManager(layout);
	
	Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
	canvas.setBackground(ColorConstants.white);
	canvas.setLayoutData(new GridData(GridData.FILL_BOTH));
	
	MatrixWidget widget = new MatrixWidget();
	MockArray array = new MockArray("int[]", new int[]{1,2,3}, new int[]{4,5,6}, new int[]{7,8,9}, new int[]{10,11,12});
	root.add(widget.createFigure(array));
	
	LightweightSystem lws = new LightweightSystem(canvas);
	lws.setContents(root);
	
	Display display = shell.getDisplay();
	shell.open();
	while (!shell.isDisposed()) {
		while (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:35,代码来源:TestMatrixWidget.java


注:本文中的org.eclipse.swt.widgets.Shell.getDisplay方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。