Java Code Examples for org.eclipse.jface.util.Util#isMac()
The following examples show how to use
org.eclipse.jface.util.Util#isMac() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProtectionFactory.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
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"; } } }
Example 2
Source File: BrowserNative.java From Rel with Apache License 2.0 | 6 votes |
@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; }
Example 3
Source File: DBrowser.java From Rel with Apache License 2.0 | 6 votes |
private static void createMenuBar(Shell shell) { Menu bar = Display.getCurrent().getMenuBar(); boolean hasAppMenuBar = (bar != null); if (bar == null) bar = new Menu(shell, SWT.BAR); // Populate the menu bar once if this is a screen menu bar. // Otherwise, we need to make a new menu bar for each shell. if (!createdScreenBar || !hasAppMenuBar) { createFileMenu(bar); createEditMenu(bar); createOutputMenu(bar); createDatabaseMenu(bar); createToolsMenu(bar); if (!Util.isMac()) createHelpMenu(bar); if (!hasAppMenuBar) shell.setMenuBar(bar); createdScreenBar = true; } }
Example 4
Source File: ProtectionFactory.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
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"; } } }
Example 5
Source File: XFindPanel.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
private Point getToolItemLocation(ToolItem item) { Rectangle rect = item.getBounds(); Point point = new Point(rect.x, rect.y + rect.height); point = toolBar.toDisplay(point); if (Util.isMac()) { point.y += 5; } return point; }
Example 6
Source File: ProtectionFactory.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
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(); }
Example 7
Source File: PreferencePageGeneral.java From Rel with Apache License 2.0 | 5 votes |
protected void createFieldEditors() { String reloadPrompt = ""; if (!Util.isMac()) { reloadPrompt = " Restart after changing to see the full effect. "; if (IconLoader.getDPIScaling() > 100) reloadPrompt += "\nNOTE: larger icons may not work correctly on some HiDPI displays."; } 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())); }
Example 8
Source File: DBrowser.java From Rel with Apache License 2.0 | 5 votes |
private static boolean executeSplashInteractor(Runnable splashInteraction) { if (SplashScreen.getSplashScreen() == null) return false; // Non-MacOS if (!Util.isMac()) { splashInteraction.run(); closeSplash(); return true; } // MacOS Display display = Display.getDefault(); final Semaphore sem = new Semaphore(0); Thread splashInteractor = new Thread(() -> { splashInteraction.run(); sem.release(); display.asyncExec(() -> {}); closeSplash(); }); splashInteractor.start(); // Interact with splash screen while (!display.isDisposed() && !sem.tryAcquire()) if (!display.readAndDispatch()) display.sleep(); return true; }
Example 9
Source File: ProtectionFactory.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
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(); }
Example 10
Source File: DBrowser.java From Rel with Apache License 2.0 | 4 votes |
private static void createEditMenu(Menu bar) { MenuItem editItem = new MenuItem(bar, SWT.CASCADE); editItem.setText("Edit"); Menu menu = new Menu(editItem); editItem.setMenu(menu); createEditMenuItem("undo", new AcceleratedMenuItem(menu, "Undo\tCtrl-Z", SWT.MOD1 | 'Z', "undo")); int redoAccelerator = SWT.MOD1 | (Util.isMac() ? SWT.SHIFT | 'Z' : 'Y'); createEditMenuItem("redo", new AcceleratedMenuItem(menu, "Redo\tCtrl-Y", redoAccelerator, "redo")); new MenuItem(menu, SWT.SEPARATOR); createEditMenuItem("cut", new AcceleratedMenuItem(menu, "Cut\tCtrl-X", SWT.MOD1 | 'X', "cut")); createEditMenuItem("copy", new AcceleratedMenuItem(menu, "Copy\tCtrl-C", SWT.MOD1 | 'C', "copy")); createEditMenuItem("paste", new AcceleratedMenuItem(menu, "Paste\tCtrl-V", SWT.MOD1 | 'V', "paste") { public boolean canExecute() { return isThereSomethingToPaste(); } }); new MenuItem(menu, SWT.SEPARATOR); createEditMenuItem("clear", new AcceleratedMenuItem(menu, "Clear", 0, "clearIcon")); createEditMenuItem("delete", new AcceleratedMenuItem(menu, "Delete\tDel", SWT.DEL, "delete")); createEditMenuItem("selectAll", new AcceleratedMenuItem(menu, "Select All\tCtrl-A", SWT.MOD1 | 'A', "selectAll")); linkCommand(Commands.Do.FindReplace, new AcceleratedMenuItem(menu, "Find/Replace", 0, "edit_find_replace")); new MenuItem(menu, SWT.SEPARATOR); linkCommand(Commands.Do.SpecialCharacters, new AcceleratedMenuItem(menu, "Special characters", 0, "characters")); linkCommand(Commands.Do.PreviousHistory, new AcceleratedMenuItem(menu, "Previous history", 0, "previousIcon")); linkCommand(Commands.Do.NextHistory, new AcceleratedMenuItem(menu, "Next history", 0, "nextIcon")); linkCommand(Commands.Do.LoadFile, new AcceleratedMenuItem(menu, "Load file", 0, "loadIcon")); linkCommand(Commands.Do.InsertFile, new AcceleratedMenuItem(menu, "Insert file", 0, "loadInsertIcon")); linkCommand(Commands.Do.InsertFileName, new AcceleratedMenuItem(menu, "Insert file name", 0, "pathIcon")); linkCommand(Commands.Do.SaveFile, new AcceleratedMenuItem(menu, "Save file", 0, "saveIcon")); linkCommand(Commands.Do.SaveHistory, new AcceleratedMenuItem(menu, "Save history", 0, "saveHistoryIcon")); new MenuItem(menu, SWT.SEPARATOR); linkCommand(Commands.Do.CopyInputToOutput, new AcceleratedMenuItem(menu, "Copy input to output", 0, "copyToOutputIcon", SWT.CHECK)); linkCommand(Commands.Do.WrapText, new AcceleratedMenuItem(menu, "Wrap text", 0, "wrapIcon", SWT.CHECK)); }
Example 11
Source File: DBrowser.java From Rel with Apache License 2.0 | 4 votes |
private static void launch(String[] args) { Display.setAppName(Version.getAppName()); Display.setAppVersion(Version.getVersion()); final Display display = new Display(); OpenDocumentEventProcessor openDocProcessor = new OpenDocumentEventProcessor(); display.addListener(SWT.OpenDocument, openDocProcessor); openDocProcessor.addFilesToOpen(args); if (Util.isMac()) executeSplashInteractor(() -> { try { Thread.sleep(300); } catch (InterruptedException e1) { } }); try { Class.forName("org.reldb.rel.Rel"); localRel = true; } catch (ClassNotFoundException cnfe) { localRel = false; } OSSpecific.launch(Version.getAppName(), event -> quit(), event -> new AboutDialog(shell).open(), event -> new Preferences(shell).show() ); if (!Util.isMac()) { SplashScreen splash = SplashScreen.getSplashScreen(); if (splash != null && localRel && !Preferences.getPreferenceBoolean(PreferencePageGeneral.SKIP_DEFAULT_DB_LOAD)) { Graphics2D gc = splash.createGraphics(); Rectangle rect = splash.getBounds(); int barWidth = rect.width - 20; int barHeight = 10; Rectangle progressBarRect = new Rectangle(10, rect.height - 20, barWidth, barHeight); gc.draw3DRect(progressBarRect.x, progressBarRect.y, progressBarRect.width, progressBarRect.height, false); gc.setColor(Color.green); (new Thread(() -> { while (SplashScreen.getSplashScreen() != null) { int percent = Loading.getPercentageOfExpectedMessages(); int drawExtent = Math.min(barWidth * percent / 100, barWidth); gc.fillRect(progressBarRect.x, progressBarRect.y, drawExtent, barHeight); splash.update(); try { Thread.sleep(250); } catch (InterruptedException e) { } } })).start(); } } shell = createShell(); shell.setImage(IconLoader.loadIcon("RelIcon")); shell.setImages(loadIcons(display)); shell.setText(Version.getAppID()); shell.addListener(SWT.Close, e -> { shell.dispose(); }); shell.addDisposeListener(e -> quit()); shell.layout(); Loading.start(); Core.launch(openDocProcessor, shell); if (!Util.isMac()) closeSplash(); shell.open(); while (!display.isDisposed()) { try { if (!display.readAndDispatch()) display.sleep(); } catch (Throwable t) { System.out.println("DBrowser: Exception: " + t); t.printStackTrace(); } } }