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


Java Util.isGtk方法代码示例

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


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

示例1: showDialogMenu

import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
/**
 * Show the dialog's menu. This message has no effect if the receiver was
 * not configured to show a menu. Clients may call this method in order to
 * trigger the menu via keystrokes or other gestures. Subclasses typically
 * do not override method.
 */
protected void showDialogMenu() {
	if (!showDialogMenu) {
		return;
	}

	if (menuManager == null) {
		menuManager = new MenuManager();
		fillDialogMenu(menuManager);
	}
	// Setting this flag works around a problem that remains on X only,
	// whereby activating the menu deactivates our shell.
	listenToDeactivate = !Util.isGtk();

	Menu menu = menuManager.createContextMenu(getShell());
	Rectangle bounds = toolBar.getBounds();
	Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
	topLeft = getShell().toDisplay(topLeft);
	menu.setLocation(topLeft.x, topLeft.y);
	menu.setVisible(true);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:27,代码来源:PopupDialog.java

示例2: getChange

import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
/**
 * Returns the change that will be executed when the proposal is applied.
 * This method calls {@link #createChange()} to compute the change.
 * 
 * @return the change for this proposal, can be <code>null</code> in rare cases if creation of
 *         the change failed
 * @throws CoreException when the change could not be created
 */
public final Change getChange() throws CoreException {
	if (Util.isGtk()) {
		// workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=293995 :
		// [Widgets] Deadlock while UI thread displaying/computing a change proposal and non-UI thread creating image
		
		// Solution is to create the change outside a 'synchronized' block.
		// Synchronization is achieved by polling fChange, using "fChange == COMPUTING_CHANGE" as barrier.
		// Timeout of 10s for safety reasons (should not be reached).
		long end= System.currentTimeMillis() + 10000;
		do {
			boolean computing;
			synchronized (this) {
				computing= fChange == COMPUTING_CHANGE;
			}
			if (computing) {
				try {
					Display display= Display.getCurrent();
					if (display != null) {
						while (! display.isDisposed() && display.readAndDispatch()) {
							// empty the display loop
						}
						display.sleep();
					} else {
						Thread.sleep(100);
					}
				} catch (InterruptedException e) {
					//continue
				}
			} else {
				synchronized (this) {
					if (fChange == COMPUTING_CHANGE) {
						continue;
					} else if (fChange != null) {
						return fChange;
					} else {
						fChange= COMPUTING_CHANGE;
					}
				}
				Change change= createChange();
				synchronized (this) {
					fChange= change;
				}
				return change;
			}
		} while (System.currentTimeMillis() < end);
		
		synchronized (this) {
			if (fChange == COMPUTING_CHANGE) {
				return null; //failed
			}
		}
		
	} else {
		synchronized (this) {
			if (fChange == null) {
				fChange= createChange();
			}
		}
	}
	return fChange;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:70,代码来源:ChangeCorrectionProposal.java

示例3: sortModifierKeys

import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
protected int[] sortModifierKeys(final int modifierKeys) {
	final IKeyLookup lookup = KeyLookupFactory.getDefault();
	final int[] sortedKeys = new int[4];
	int index = 0;

	if (Util.isWindows()) {
		if ((modifierKeys & lookup.getCtrl()) != 0) {
			sortedKeys[index++] = lookup.getCtrl();
		}
		if ((modifierKeys & lookup.getAlt()) != 0) {
			sortedKeys[index++] = lookup.getAlt();
		}
		if ((modifierKeys & lookup.getShift()) != 0) {
			sortedKeys[index++] = lookup.getShift();
		}

	} else if (Util.isGtk() || Util.isMotif()) {
		if ((modifierKeys & lookup.getShift()) != 0) {
			sortedKeys[index++] = lookup.getShift();
		}
		if ((modifierKeys & lookup.getCtrl()) != 0) {
			sortedKeys[index++] = lookup.getCtrl();
		}
		if ((modifierKeys & lookup.getAlt()) != 0) {
			sortedKeys[index++] = lookup.getAlt();
		}

	} else if (Util.isMac()) {
		if ((modifierKeys & lookup.getShift()) != 0) {
			sortedKeys[index++] = lookup.getShift();
		}
		if ((modifierKeys & lookup.getCtrl()) != 0) {
			sortedKeys[index++] = lookup.getCtrl();
		}
		if ((modifierKeys & lookup.getAlt()) != 0) {
			sortedKeys[index++] = lookup.getAlt();
		}
		if ((modifierKeys & lookup.getCommand()) != 0) {
			sortedKeys[index++] = lookup.getCommand();
		}

	}

	return sortedKeys;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:46,代码来源:NativeKeyFormatter.java

示例4: createLoadingShell

import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
private Shell createLoadingShell() {
	final Shell shell = new Shell(SWT.NO_TRIM);

	shell.setLayout(new FormLayout());
	shell.setMinimumSize(backgroundWidth, backgroundHeight);
	shell.setSize(backgroundWidth, backgroundHeight);
	
	Image background = IconLoader.loadIconNormal("loading");
	
	Label lblTitle = new Label(shell, SWT.TRANSPARENT);
	lblTitle.setFont(FontSize.getThisFontInNewSize(lblTitle.getFont(), 24, SWT.BOLD));
	FormData fd_lblTitle = new FormData();
	fd_lblTitle.top = new FormAttachment(0, 0);
	fd_lblTitle.left = new FormAttachment(0, 10);
	fd_lblTitle.right = new FormAttachment(100, -10);
	lblTitle.setLayoutData(fd_lblTitle);
	lblTitle.setText("Loading");
	
	progressBar = new ProgressBar(shell, SWT.NONE);
	progressBar.setMaximum(expectedMessageCount);
	progressBar.setMinimum(0);
	progressBar.setSelection(0);
	FormData fd_progressBar = new FormData();
	fd_progressBar.bottom = new FormAttachment(100, -10);
	fd_progressBar.left = new FormAttachment(0, 10);
	fd_progressBar.right = new FormAttachment(100, -10);
	progressBar.setLayoutData(fd_progressBar);
	
	lblAction = new Text(shell, SWT.WRAP | SWT.TRANSPARENT);
	lblAction.setEditable(false);
	FormData fd_lblAction = new FormData();
	fd_lblAction.top = new FormAttachment(progressBar, -60);
	fd_lblAction.bottom = new FormAttachment(progressBar, -10);
	fd_lblAction.left = new FormAttachment(0, 10);
	fd_lblAction.right = new FormAttachment(100, -200);
	lblAction.setLayoutData(fd_lblAction);
	lblAction.setText("Starting...");
	
	if (!Util.isGtk()) {
		shell.setBackgroundImage(background);
		shell.setBackgroundMode(SWT.INHERIT_FORCE);
		lblTitle.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		lblAction.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	}
	
	shell.setSize(background.getBounds().x, background.getBounds().y);
	shell.setLocation(getMonitorCenter(shell));
	
	return shell;
}
 
开发者ID:DaveVoorhis,项目名称:Rel,代码行数:51,代码来源:Loading.java


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