本文整理汇总了Java中org.eclipse.jface.util.Util.isMac方法的典型用法代码示例。如果您正苦于以下问题:Java Util.isMac方法的具体用法?Java Util.isMac怎么用?Java Util.isMac使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.util.Util
的用法示例。
在下文中一共展示了Util.isMac方法的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: 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";
}
}
}
示例4: createWidget
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
@Override
public boolean createWidget(Composite parent) {
if (Util.isMac())
style = new Style(-3);
else
style = new Style(0);
try {
browser = new BrowserNativeWidget(parent, SWT.BORDER);
browser.setJavascriptEnabled(true);
browser.addProgressListener(new ProgressAdapter() {
@Override
public void completed(ProgressEvent event) {
pumpQueue();
}
});
} catch (Throwable t) {
System.out.println("BrowserNative: Native browser not available: " + t);
return false;
}
clear();
return true;
}
示例5: showInSystemExplorer
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
public void showInSystemExplorer(File canonicalPath, IProgressMonitor monitor) throws IOException {
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
String launchCmd = formShowInSystemExplorerCommand(canonicalPath);
if ("".equals(launchCmd)) {
throw new IOException(
"System Explorer command unavailable. Please set the System Explorer command in the workspace preferences.");
}
File dir = ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile();
Process p;
if (Util.isLinux() || Util.isMac()) {
p = Runtime.getRuntime().exec(new String[] { "/bin/sh", "-c", launchCmd }, null, dir);
} else {
p = Runtime.getRuntime().exec(launchCmd, null, dir);
}
int retCode;
try {
retCode = p.waitFor();
} catch (InterruptedException e) {
throw new IOException(e);
}
subMonitor.worked(100);
if (retCode != 0 && !Util.isWindows()) {
throw new IOException("Execution of '" + launchCmd + "' failed with return code: " + retCode, null);
}
}
示例6: quotePath
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
private String quotePath(String path) {
if (Util.isLinux() || Util.isMac()) {
// Quote for usage inside "", man sh, topic QUOTING:
path = path.replaceAll("[\"$`]", "\\\\$0"); //$NON-NLS-1$ //$NON-NLS-2$
}
// Windows: Can't quote, since explorer.exe has a very special command
// line parsing strategy.
return path;
}
示例7: intializePath
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
/**
* Get the path and cache it values
*/
private static void intializePath(){
String path = null;
Location configArea = Platform.getInstallLocation();
String product = Platform.getProduct().getName();
if (configArea != null) {
if (Util.isMac()) {
path = configArea.getURL().toExternalForm() + "/" + product + ".app/Contents/MacOS/";
path = path + product + ".ini";
}
else path = configArea.getURL().toExternalForm() + product + ".ini"; //$NON-NLS-1$
}
cachedPath = path;
}
示例8: initializeBounds
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
@Override
protected void initializeBounds() {
super.initializeBounds();
if (openWithButton.getDisplay().getDismissalAlignment() == SWT.RIGHT) {
// Move the menu button back to the right of the default button.
if (!Util.isMac()) {
// On the Mac, the round buttons and the big padding would destroy the visual coherence of the split button.
openWithButton.moveBelow(null);
openWithButton.getParent().layout();
}
}
}
示例9: getSeries
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
public static String getSeries() {
SeriesInterface s;
if (Util.isWindows()) {
s = new WindowsSeries();
} else if (Util.isMac()) {
s = new MacosxSeries();
} else {
s = new LinuxSeries();
}
return s.getSeries();
}
示例10: format
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
/**
* Formats an individual key into a human readable format. This uses an
* internationalization resource bundle to look up the key. This does the
* platform-specific formatting for Carbon.
*
* @param key
* The key to format.
* @return The key formatted as a string; should not be <code>null</code>.
*/
public final String format(final int key) {
final IKeyLookup lookup = KeyLookupFactory.getDefault();
final String name = lookup.formalNameLookup(key);
// TODO consider platform-specific resource bundles
if (Util.isMac()) {
String formattedName = (String) CARBON_KEY_LOOK_UP.get(name);
if (formattedName != null) {
return formattedName;
}
}
return super.format(key);
}
示例11: getKeyDelimiter
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
protected String getKeyDelimiter() {
// We must do the look up every time, as our locale might change.
if (Util.isMac()) {
// return Util.translateString(RESOURCE_BUNDLE,
// CARBON_KEY_DELIMITER_KEY, Util.ZERO_LENGTH_STRING);
}
// return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY,
// KeyStroke.KEY_DELIMITER);
return "nativekeyformatter";
}
示例12: createFieldEditors
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
protected void createFieldEditors() {
String reloadPrompt = "";
if (!Util.isMac())
reloadPrompt = " Restart after changing to see the full effect.";
addField(new BooleanFieldEditor(LARGE_ICONS, "&Larger icons." + reloadPrompt, getFieldEditorParent()));
addField(new BooleanFieldEditor(DEFAULT_CMD_MODE, "Default to command-line mode.", getFieldEditorParent()));
addField(new BooleanFieldEditor(SKIP_DEFAULT_DB_LOAD, "Do not automatically load user's default database.", getFieldEditorParent()));
}
示例13: 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;
}
示例14: getCtrlKey
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
/**
* Return the hotkey used with the mousewheel to request a zoom operation
*
* @return SWT.command is the os is mac, SWT.ctrl otherwise
*/
public static int getCtrlKey() {
return Util.isMac() ? SWT.COMMAND : SWT.CTRL;
}
示例15: showTopSeperator
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
/**
* Returns whether to show a top separator line between the menu bar and the
* rest of the window contents. On some platforms such as the Mac, the menu
* is separated from the main window already, so a separator line is not
* desired.
*
* @return <code>true</code> to show the top separator, <code>false</code>
* to not show it
* @since 3.0
*/
protected boolean showTopSeperator() {
return !Util.isMac();
}