本文整理汇总了Java中org.eclipse.jface.util.Util类的典型用法代码示例。如果您正苦于以下问题:Java Util类的具体用法?Java Util怎么用?Java Util使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Util类属于org.eclipse.jface.util包,在下文中一共展示了Util类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDropdownButton
import org.eclipse.jface.util.Util; //导入依赖的package包/类
private Button createDropdownButton(final Composite parent, int id, String label, MouseListener mouseListener) {
char textEmbedding = parent.getOrientation() == SWT.LEFT_TO_RIGHT ? '\u202a' : '\u202b';
Button button = createButton(parent, id, textEmbedding + label + '\u202c', false);
if (Util.isMac()) {
// Button#setOrientation(int) is a no-op on the Mac. Use a Unicode
// BLACK DOWN-POINTING SMALL TRIANGLE.
button.setText(button.getText() + " \u25BE"); //$NON-NLS-1$
} else {
int dropDownOrientation = parent.getOrientation() == SWT.LEFT_TO_RIGHT ? SWT.RIGHT_TO_LEFT
: SWT.LEFT_TO_RIGHT;
button.setOrientation(dropDownOrientation);
button.setText(button.getText() + " \u25BE"); //$NON-NLS-1$
button.addMouseListener(mouseListener);
}
return button;
}
示例2: createDialogArea
import org.eclipse.jface.util.Util; //导入依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout(1, false);
composite.setLayout(layout);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(data);
Browser browser = new Browser(composite, SWT.NONE);
browser.setText(browserString);
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
if (Util.isMac())
browser.refresh();
composite.pack();
return composite;
}
示例3: updateTexts
import org.eclipse.jface.util.Util; //导入依赖的package包/类
@Override
public void updateTexts() {
super.updateTexts();
fileMenuHeader.setText(Messages.get(LBL_MENU_HEADER_FILE));
if (fileExitItem != null && !fileExitItem.isDisposed()) {
fileExitItem.setText(Messages.get(LBL_MENU_ITEM_EXIT));
}
eventMenuHeader.setText(Messages.get(LBL_MENU_HEADER_EVENT));
if (toolsMenuHeader != null && !toolsMenuHeader.isDisposed()) {
toolsMenuHeader.setText(Messages.get(LBL_MENU_HEADER_TOOLS));
}
if (toolsPreferencesMenuItem != null && !toolsPreferencesMenuItem.isDisposed()) {
toolsPreferencesMenuItem.setText(Messages.get(LBL_MENU_ITEM_PREFERENCES));
}
helpMenuHeader.setText(Messages.get(Util.isWindows() ? LBL_MENU_HEADER_HELP_WINDOWS : LBL_MENU_HEADER_HELP));
helpSystemInfoItem.setText(Messages.get(LBL_MENU_ITEM_SYSTEM_INFO));
if (helpAboutItem != null && !helpAboutItem.isDisposed()) {
helpAboutItem.setText(Messages.get(LBL_MENU_ITEM_ABOUT));
}
}
示例4: dropTargetIsValid
import org.eclipse.jface.util.Util; //导入依赖的package包/类
private boolean dropTargetIsValid(DropTargetEvent e, boolean isDrop) {
if (URLTransfer.getInstance().isSupportedType(e.currentDataType)) {
// on Windows, we get the URL already during drag operations...
// FIXME find a way to check the URL early on other platforms,
// too...
if (isDrop || Util.isWindows()) {
if (e.data == null && !extractEventData(e)) {
// ... but if we don't, it's no problem, unless this is
// already
// the final drop event
return !isDrop;
}
final String url = getUrl(e.data);
if (!ExampleURLHandler.isValidExample(url)) {
return false;
}
}
return true;
}
return false;
}
示例5: createWindowMenu
import org.eclipse.jface.util.Util; //导入依赖的package包/类
/**
* Creates and returns the Window menu.
*/
private MenuManager createWindowMenu() {
MenuManager menu = new MenuManager(
IDEWorkbenchMessages.Workbench_window,
IWorkbenchActionConstants.M_WINDOW);
menu.add(newWindowAction);
menu.add(newEditorAction);
menu.add(new Separator());
addPerspectiveActions(menu);
menu.add(new Separator());
addKeyboardShortcuts(menu);
Separator sep = new Separator(IWorkbenchActionConstants.MB_ADDITIONS);
sep.setVisible(!Util.isMac());
menu.add(sep);
// See the comment for quit in createFileMenu
ActionContributionItem openPreferencesItem = new ActionContributionItem(
openPreferencesAction);
openPreferencesItem.setVisible(!Util.isMac());
menu.add(openPreferencesItem);
menu.add(ContributionItemFactory.OPEN_WINDOWS.create(getWindow()));
return menu;
}
示例6: createHelpMenu
import org.eclipse.jface.util.Util; //导入依赖的package包/类
/**
* Creates and returns the Help menu.
*/
private MenuManager createHelpMenu() {
final MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP);
addSeparatorOrGroupMarker(menu, "group.intro"); //$NON-NLS-1$
menu.add(new GroupMarker("group.intro.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.main"); //$NON-NLS-1$
menu.add(helpContentsAction);
addSeparatorOrGroupMarker(menu, "group.assist"); //$NON-NLS-1$
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(new GroupMarker("group.main.ext")); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tutorials"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.tools"); //$NON-NLS-1$
addSeparatorOrGroupMarker(menu, "group.updates"); //$NON-NLS-1$
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
addSeparatorOrGroupMarker(menu, IWorkbenchActionConstants.MB_ADDITIONS);
// about should always be at the bottom
menu.add(new Separator("group.about")); //$NON-NLS-1$
final ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
aboutItem.setVisible(!Util.isMac());
menu.add(aboutItem);
menu.add(new GroupMarker("group.about.ext")); //$NON-NLS-1$
menu.add(openPreferencesAction);
return menu;
}
示例7: createWindowMenu
import org.eclipse.jface.util.Util; //导入依赖的package包/类
/**
* Creates and returns the Window menu.
*/
private MenuManager createWindowMenu()
{
MenuManager menu =
new MenuManager(IDEWorkbenchMessages.Workbench_window,
IWorkbenchActionConstants.M_WINDOW);
menu.add(newWindowAction);
menu.add(newEditorAction);
menu.add(new Separator());
addPerspectiveActions(menu);
menu.add(new Separator());
Separator sep = new Separator(IWorkbenchActionConstants.MB_ADDITIONS);
sep.setVisible(!Util.isMac());
menu.add(sep);
menu.add(ContributionItemFactory.OPEN_WINDOWS.create(getWindow()));
return menu;
}
示例8: hookApplicationMenu
import org.eclipse.jface.util.Util; //导入依赖的package包/类
private void hookApplicationMenu(@Nullable final Listener quitListener, final CallbackObject callbackObject) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
// Check platform
if (!Util.isCocoa()) {
logger.log(Level.WARNING, JFaceMessages.get("err.cocoa.enhancer.platform"));
}
initialize(callbackObject);
// Connect the quit/exit menu.
if (!display.isDisposed() && quitListener != null) {
display.addListener(SWT.Close, quitListener);
}
// Schedule disposal of callback object.
display.disposeExec(new Runnable() {
@Override
public void run() {
proc3Args.dispose();
}
});
}
示例9: constrainShellSize
import org.eclipse.jface.util.Util; //导入依赖的package包/类
@Override
protected void constrainShellSize() {
super.constrainShellSize();
if (Util.isCocoa()) {
final Tree tree = getTreeViewer().getTree();
final FontDescriptor treeFontDescriptor = FontDescriptor.createFrom(JFaceResources.getBannerFont()).setStyle(SWT.NORMAL);
final Font treeFont = treeFontDescriptor.createFont(tree.getDisplay());
updateTreeFont(treeFont);
tree.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
treeFontDescriptor.destroyFont(treeFont);
}
});
}
}
示例10: displayHelp
import org.eclipse.jface.util.Util; //导入依赖的package包/类
private void displayHelp() {
String curLang = CommonFunction.getSystemLanguage();
StringBuffer sbHelp = new StringBuffer("help");
if (Util.isWindows()) {
sbHelp.append(File.separator).append("csv2tbxdoc").append(File.separator);
if (curLang.equalsIgnoreCase("zh")) {
sbHelp.append("tbxmaker_zh-cn.chm");
} else {
sbHelp.append("tbxmaker.chm");
}
Program.launch(PluginUtil.getConfigurationFilePath(sbHelp.toString()));
} else {
sbHelp.append(File.separator).append("csv2tbxdoc").append(File.separator);
if (curLang.equalsIgnoreCase("zh")) {
sbHelp.append("zh-cn");
} else {
sbHelp.append("en");
}
sbHelp.append(File.separator).append("toc.xml");
PluginHelpDialog dialog = new PluginHelpDialog(getShell(), PluginUtil.getConfigurationFilePath(sbHelp.toString()),
Messages.getString("dialog.TBXMakerDialog.helpDialogTitle"));
dialog.open();
}
}
示例11: ConcordanceSearchDialog
import org.eclipse.jface.util.Util; //导入依赖的package包/类
/**
* 构造方法
* @param parentShell
* @param file
* 当前文件
* @param strSrcLang
* 当前文件的源语言
* @param strTgtLang
* 当前文件的目标语言
* @param strSearchText
* 搜索文本
*/
public ConcordanceSearchDialog(Shell parentShell, IFile file, String strSrcLang, String strTgtLang,
String strSearchText) {
super(parentShell);
FontData fontData = JFaceResources.getDefaultFont().getFontData()[0];
fontData.setStyle(fontData.getStyle() | SWT.BOLD);
font = new Font(Display.getDefault(), fontData);
style = new TextStyle(font, null, null);
this.strSrcLang = strSrcLang;
this.strTgtLang = strTgtLang;
this.strSearchText = strSearchText;
ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(file.getProject());
lstDatabase = projectConfig.getAllTmDbs();
filterUnAvaliableDatabase();
setHelpAvailable(true);
setBlockOnOpen(false);
lstSearchHistory = new ArrayList<String>(HISTORY_SIZE - 1);
lstFilterHistory = new ArrayList<String>(HISTORY_SIZE - 1);
if (!Util.isLinux()) {
totalWidth = 910;
}
}
示例12: getPlatform
import org.eclipse.jface.util.Util; //导入依赖的package包/类
public static String getPlatform() {
if (Util.isWindows()) {
if ("32".equals(System.getProperty("sun.arch.data.model"))) {
return "1";
} else {
return "2";
}
} else if (Util.isMac()) {
return "5";
} else {
if ("32".equals(System.getProperty("sun.arch.data.model"))) {
return "3";
} else {
return "4";
}
}
}
示例13: equals
import org.eclipse.jface.util.Util; //导入依赖的package包/类
/**
* Compares this binding set with another object. The objects will be equal
* if they are both instance of <code>CachedBindingSet</code> and have
* equivalent values for all of their properties.
*
* @param object
* The object with which to compare; may be <code>null</code>.
* @return <code>true</code> if they are both instances of
* <code>CachedBindingSet</code> and have the same values for all
* of their properties; <code>false</code> otherwise.
*/
public final boolean equals(final Object object) {
if (!(object instanceof CachedBindingSet)) {
return false;
}
final CachedBindingSet other = (CachedBindingSet) object;
if (!Util.equals(activeContextTree, other.activeContextTree)) {
return false;
}
if (!Util.equals(locales, other.locales)) {
return false;
}
if (!Util.equals(platforms, other.platforms)) {
return false;
}
return Util.equals(schemeIds, other.schemeIds);
}
示例14: localeMatches
import org.eclipse.jface.util.Util; //导入依赖的package包/类
/**
* <p>
* Tests whether the locale for the binding matches one of the active
* locales.
* </p>
* <p>
* This method completes in <code>O(n)</code>, where <code>n</code> is the
* number of active locales.
* </p>
*
* @param binding
* The binding with which to test; must not be <code>null</code>.
* @return <code>true</code> if the binding's locale matches;
* <code>false</code> otherwise.
*/
private final boolean localeMatches(final Binding binding) {
boolean matches = false;
final String locale = binding.getLocale();
if (locale == null) {
return true; // shortcut a common case
}
for (int i = 0; i < locales.length; i++) {
if (Util.equals(locales[i], locale)) {
matches = true;
break;
}
}
return matches;
}
示例15: platformMatches
import org.eclipse.jface.util.Util; //导入依赖的package包/类
/**
* <p>
* Tests whether the platform for the binding matches one of the active
* platforms.
* </p>
* <p>
* This method completes in <code>O(n)</code>, where <code>n</code> is the
* number of active platforms.
* </p>
*
* @param binding
* The binding with which to test; must not be <code>null</code>.
* @return <code>true</code> if the binding's platform matches;
* <code>false</code> otherwise.
*/
private final boolean platformMatches(final Binding binding) {
boolean matches = false;
final String platform = binding.getPlatform();
if (platform == null) {
return true; // shortcut a common case
}
for (int i = 0; i < platforms.length; i++) {
if (Util.equals(platforms[i], platform)) {
matches = true;
break;
}
}
return matches;
}