本文整理了Java中org.eclipse.jface.util.Util.isMac()
方法的一些代码示例,展示了Util.isMac()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.isMac()
方法的具体详情如下:
包路径:org.eclipse.jface.util.Util
类名称:Util
方法名:isMac
[英]Common WS query helper method.
[中]通用WS-query助手方法。
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* 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();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* 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();
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* 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 1.0
*/
protected boolean showTopSeperator() {
return !Util.isMac();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
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;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
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);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
@Override
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);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
@Override
protected String getKeyDelimiter() {
// We must do the look up every time, as our locale might change.
if (org.eclipse.jface.util.Util.isMac()) {
return Util.translateString(RESOURCE_BUNDLE,
CARBON_KEY_DELIMITER_KEY, Util.ZERO_LENGTH_STRING, false,
false);
}
return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY, KeyStroke.KEY_DELIMITER, false, false);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
/**
* 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; must not be <code>null</code>.
* @return The key formatted as a string; should not be <code>null</code>.
*/
@Override
public String format(Key key) {
String name = key.toString();
// TODO consider platform-specific resource bundles
if (org.eclipse.jface.util.Util.isMac()) {
String formattedName = (String) CARBON_KEY_LOOK_UP.get(name);
if (formattedName != null) {
return formattedName;
}
}
return super.format(key);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
/**
* The default command for launching the system explorer on this platform.
*
* @return The default command which launches the system explorer on this system, or an empty
* string if no default exists
* @see ShowInSystemExplorerHandler#getDefaultCommand()
*/
public static String getShowInSystemExplorerCommand() {
// See https://bugs.eclipse.org/419940 why it is implemented in here and not in ShowInSystemExplorerHandler#getDefaultCommand()
if (Util.isGtk()) {
return "dbus-send --print-reply --dest=org.freedesktop.FileManager1 /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:\"${selected_resource_uri}\" string:\"\""; //$NON-NLS-1$
} else if (Util.isWindows()) {
return "explorer /E,/select=${selected_resource_loc}"; //$NON-NLS-1$
} else if (Util.isMac()) {
return "open -R \"${selected_resource_loc}\""; //$NON-NLS-1$
}
// if all else fails, return empty default
return ""; //$NON-NLS-1$
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* 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);
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
public void handleEvent(Event event) {
// ignore this event if we have launched a child
if (event.widget == getShell()
&& getShell().getShells().length == 0) {
listenToDeactivate = true;
// Typically we start listening for parent deactivate after
// we are activated, except on the Mac, where the deactivate
// is received after activate.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=100668
listenToParentDeactivate = !Util.isMac();
}
}
});
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* 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>.
*/
@Override
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 = CARBON_KEY_LOOK_UP.get(name);
if (formattedName != null) {
return formattedName;
}
}
return super.format(key);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* 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>.
*/
@Override
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);
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools.ui
public void selectOption(Key key) {
Control control = findControl(key);
if (control != null) {
if (!fExpComps.isEmpty()) {
ExpandableComposite expandable = getParentExpandableComposite(control);
if (expandable != null) {
for (int i = 0; i < fExpComps.size(); i++) {
ExpandableComposite curr = fExpComps.get(i);
curr.setExpanded(curr == expandable);
}
}
}
control.setFocus();
if (org.eclipse.jface.util.Util.isMac()) {
Label labelControl = fComboLabelMap.get(control);
if (labelControl != null && control instanceof Combo) {
highlight(control.getParent(), labelControl, (Combo) control, ConfigurationBlock.HIGHLIGHT_FOCUS);
}
}
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
public void selectOption(Key key) {
Control control= findControl(key);
if (control != null) {
if (!fExpandableComposites.isEmpty()) {
ExpandableComposite expandable= getParentExpandableComposite(control);
if (expandable != null) {
for (int i= 0; i < fExpandableComposites.size(); i++) {
ExpandableComposite curr= fExpandableComposites.get(i);
curr.setExpanded(curr == expandable);
}
expandedStateChanged(expandable);
}
}
control.setFocus();
if (Util.isMac()) {
Label label= fLabels.get(control);
final PreferenceHighlight highLight= label == null ? null : (PreferenceHighlight) label.getData(DATA_PREF_HIGHLIGHT);
if (highLight != null) {
highLight.setFocus(true);
}
}
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
protected String getKeyDelimiter() {
// We must do the look up every time, as our locale might change.
if (Util.isMac()) {
// return Util.translateString(RESOURCE_BUNDLE,
return Util.translateString(getResourceBundle( NativeKeyFormatter.class ),
CARBON_KEY_DELIMITER_KEY, Util.ZERO_LENGTH_STRING);
}
// return Util.translateString(RESOURCE_BUNDLE,
return Util.translateString(getResourceBundle( NativeKeyFormatter.class ),
KEY_DELIMITER_KEY, KeyStroke.KEY_DELIMITER);
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools.ui
public void selectOption() {
if (fCombo != null && !fCombo.isDisposed()) {
fCombo.setFocus();
if (fLabel != null && !fLabel.isDisposed()) {
if (org.eclipse.jface.util.Util.isMac()) {
if (fLabel != null) {
highlight(fCombo.getParent(), fLabel, fCombo, ConfigurationBlock.HIGHLIGHT_FOCUS);
}
}
}
}
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
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.setImage(WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_BUTTON_MENU));
button.addMouseListener(mouseListener);
}
return button;
}
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
private void createEditors() {
final Table table = fConfigurationsTable.getTable();
fLevelColumnEditor = new TableEditor(table);
fLevelColumnEditor.horizontalAlignment = SWT.CENTER;
fLevelColumnEditor.minimumWidth = 40;
fLevelColumnEditor.grabHorizontal = true;
if (Util.isMac())
fLevelColumnEditor.minimumHeight = 27;
fAutoColumnEditor = new TableEditor(table);
fAutoColumnEditor.horizontalAlignment = SWT.CENTER;
fAutoColumnEditor.grabHorizontal = true;
fAutoColumnEditor.minimumWidth = 50;
table.addSelectionListener(widgetSelectedAdapter(e -> showControls()));
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
/**
* Calculates a rank for a given modifier key.
*
* @param modifierKey
* The modifier key to rank; may be <code>null</code>.
* @return The rank of this modifier key. This is a non-negative number
* where a lower number suggests a higher rank.
*/
private int rank(ModifierKey modifierKey) {
if (Util.isWindows()) {
return rankWindows(modifierKey);
}
if (Util.isGtk()) {
// TODO Do a look-up on window manager.
return rankGNOME(modifierKey);
}
if (Util.isMac()) {
return rankMacOSX(modifierKey);
}
return UNKNOWN_KEY;
}
内容来源于网络,如有侵权,请联系作者删除!