本文整理汇总了Java中org.eclipse.jface.util.Util.isWindows方法的典型用法代码示例。如果您正苦于以下问题:Java Util.isWindows方法的具体用法?Java Util.isWindows怎么用?Java Util.isWindows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.util.Util
的用法示例。
在下文中一共展示了Util.isWindows方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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();
}
}
示例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: createDialogArea
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
boolean isWin32 = Util.isWindows();
GridLayoutFactory.fillDefaults().extendedMargins(isWin32 ? 0 : 3, 3, 2, 2).applyTo(composite);
kaviList.initialize(composite, getDefaultOrientation());
return composite;
}
示例5: createDialogArea
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
boolean isWin32 = Util.isWindows();
GridLayoutFactory.fillDefaults().extendedMargins(isWin32 ? 0 : 3, 3, 2, 2).applyTo(composite);
List<String> list = history.toList();
String[] items = list.toArray(new String[list.size()]);
Combo comboBox = SWTFactory.createCombo(composite, SWT.NONE, 2, items);
Font terminalFont = JFaceResources.getTextFont();
comboBox.setFont(terminalFont);
GridData textLayoutData = new GridData();
textLayoutData.horizontalAlignment = GridData.FILL;
textLayoutData.verticalAlignment = GridData.FILL;
textLayoutData.grabExcessHorizontalSpace = true;
textLayoutData.grabExcessVerticalSpace = false;
textLayoutData.horizontalSpan = 2;
comboBox.setLayoutData(textLayoutData);
comboBox.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent event) {
if (event.character == '\r' ){
inputText = comboBox.getText();
if (inputText!=null){
if (! inputText.equals(history.current())){
/* when not same as current history entry, add it to history*/
history.add(inputText);
}
}
close();
}
}
});
return composite;
}
示例6: 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);
}
}
示例7: createScrollable
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
@Override
protected Text createScrollable(final Composite parent) {
final Text text = new Text(parent, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
if (Util.isWindows()) {
text.setBackground(text.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
}
return text;
}
示例8: 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();
}
示例9: getKeyStrokeDelimiter
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
protected String getKeyStrokeDelimiter() {
// We must do the look up every time, as our locale might change.
if (Util.isWindows()) {
// return Util.translateString(RESOURCE_BUNDLE,
// WIN32_KEY_STROKE_DELIMITER_KEY,
// KeySequence.KEY_STROKE_DELIMITER);
}
// return Util.translateString(RESOURCE_BUNDLE,
// KEY_STROKE_DELIMITER_KEY,
// KeySequence.KEY_STROKE_DELIMITER);
return "nativekeyformatter";
}
示例10: 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)) {
traceMissingEventData(e);
return !isDrop;
}
}
return true;
}
return false;
}
示例11: createContents
import org.eclipse.jface.util.Util; //导入方法依赖的package包/类
protected void createContents(final Shell shell) {
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(shell);
if (key != null) {
final Label labelKey = new Label(shell, SWT.NONE);
labelKey.setText(JFaceMessages.get(LBL_SYSTEM_INFO_TABLE_KEY));
GridDataFactory.swtDefaults().applyTo(labelKey);
final Text textKey = new Text(shell, key.length() <= WRAP_LENGTH ? SWT.BORDER | SWT.READ_ONLY : SWT.BORDER | SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
textKey.setText(key);
textKey.setEditable(false);
if (Util.isWindows()) { // read-only texts are grayed by default, so force a default "active" background color
textKey.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
}
textKey.addKeyListener(new TextKeyListener(textKey));
if (key.length() <= WRAP_LENGTH) {
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(textKey);
}
else {
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(textKey);
adjustTextHeight(textKey, Math.min(MAX_TEXT_HEIGHT, MIN_TEXT_HEIGHT + key.length() / WRAP_LENGTH));
}
}
final Label labelValue = new Label(shell, SWT.NONE);
labelValue.setText(JFaceMessages.get(LBL_SYSTEM_INFO_TABLE_VALUE));
GridDataFactory.swtDefaults().applyTo(labelValue);
final Text textValue = new Text(shell, value.length() <= WRAP_LENGTH ? SWT.BORDER | SWT.READ_ONLY : SWT.BORDER | SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
textValue.setText(value);
textValue.setEditable(false);
if (Util.isWindows()) { // read-only texts are grayed by default, so force a default "active" background color
textValue.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
}
textValue.addKeyListener(new TextKeyListener(textValue));
if (value.length() <= WRAP_LENGTH) {
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(textValue);
}
else {
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(textValue);
adjustTextHeight(textValue, Math.min(MAX_TEXT_HEIGHT, MIN_TEXT_HEIGHT + value.length() / WRAP_LENGTH));
}
final Button closeButton = new Button(shell, SWT.PUSH);
closeButton.setText(JFaceMessages.get(LBL_BUTTON_CLOSE));
final int buttonWidth = SwtUtils.convertHorizontalDLUsToPixels(closeButton, IDialogConstants.BUTTON_WIDTH);
GridDataFactory.swtDefaults().span(2, 1).align(SWT.CENTER, SWT.CENTER).grab(true, false).minSize(buttonWidth, SWT.DEFAULT).applyTo(closeButton);
closeButton.setFocus();
closeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(@Nullable final SelectionEvent se) {
shell.close();
}
});
shell.setDefaultButton(closeButton);
}
示例12: 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;
}