Java Code Examples for org.openide.util.Utilities#isMac()
The following examples show how to use
org.openide.util.Utilities#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: SharedDrawable.java From constellation with Apache License 2.0 | 6 votes |
/** * Update the glyph textures on the shared GL context. The update will occur * via the GlyphManagerOpenGLController object, which checks its * GlyphManager to see if anything has changed, and if so, copies the * appropriate data to the open GL textures. * * @param glCurrent The GL context to switch back to after updating the * shared context. */ public static void updateGlyphTextureController(final GL3 glCurrent) { if (Utilities.isMac()) { glyphTextureController.update(glCurrent); } else { glCurrent.getContext().release(); try { final int result = gl.getContext().makeCurrent(); if (result == GLContext.CONTEXT_NOT_CURRENT) { glCurrent.getContext().makeCurrent(); throw new RenderException(COULD_NOT_CONTEXT_CURRENT); } glyphTextureController.update(gl); } finally { gl.getContext().release(); glCurrent.getContext().makeCurrent(); } } }
Example 2
Source File: OptionsPanel.java From netbeans with Apache License 2.0 | 6 votes |
public OptionsPanel (String categoryID, CategoryModel categoryModel) { this.categoryModel = categoryModel; // init UI components, layout and actions, and add some default values initUI(categoryID); if (getActionMap().get("SEARCH_OPTIONS") == null) {//NOI18N InputMap inputMap = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); if(Utilities.isMac()) { inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.META_MASK), "SEARCH_OPTIONS");//NOI18N // Mac cloverleaf symbol hintText = Bundle.Filter_Textfield_Hint("\u2318+F"); } else { inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK), "SEARCH_OPTIONS");//NOI18N hintText = Bundle.Filter_Textfield_Hint("Ctrl+F"); } getActionMap().put("SEARCH_OPTIONS", new SearchAction());//NOI18N } }
Example 3
Source File: FilesystemInterceptorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testRenameFolderChangeCase_FO () throws Exception { // prepare File fromFolder = createFolder(repositoryLocation, "folder"); File fromFile = createFile(fromFolder, "file"); File toFolder = new File(repositoryLocation, "FOLDER"); File toFile = new File(toFolder, fromFile.getName()); add(fromFolder); commit(fromFolder); // move h.setFilesToRefresh(new HashSet(Arrays.asList(fromFolder, toFolder))); renameFO(fromFolder, toFolder); // test if (Utilities.isWindows() || Utilities.isMac()) { assertTrue(Arrays.asList(toFolder.getParentFile().list()).contains(toFolder.getName())); assertFalse(Arrays.asList(fromFolder.getParentFile().list()).contains(fromFolder.getName())); } else { assertTrue(h.waitForFilesToRefresh()); assertFalse(fromFolder.exists()); assertTrue(toFolder.exists()); assertTrue(toFile.exists()); assertEquals(EnumSet.of(Status.REMOVED_HEAD_INDEX, Status.REMOVED_HEAD_WORKING_TREE), getCache().getStatus(fromFile).getStatus()); assertEquals(EnumSet.of(Status.NEW_HEAD_INDEX, Status.NEW_HEAD_WORKING_TREE), getCache().getStatus(toFile).getStatus()); } }
Example 4
Source File: CordovaTemplate.java From netbeans with Apache License 2.0 | 6 votes |
public static void setPhoneGapBrowser(final Project project) throws IOException, IllegalArgumentException { ProjectBrowserProvider browserProvider = project.getLookup().lookup(ProjectBrowserProvider.class); for (WebBrowser browser:browserProvider.getBrowsers()) { if (browser.getBrowserFamily() == BrowserFamilyId.PHONEGAP) { if (Utilities.isMac()) { if (browser.getId().equals("ios")) { // NOI18N browserProvider.setActiveBrowser(browser); break; } } else { if (browser.getId().equals("android_1")) { // NOI18N browserProvider.setActiveBrowser(browser); break; } } } } }
Example 5
Source File: OutlineView.java From netbeans with Apache License 2.0 | 6 votes |
private void removeDefaultCutCopyPaste(InputMap map) { putActionDelegate(map, KeyStroke.getKeyStroke("control C")); // NOI18N map.put(KeyStroke.getKeyStroke("control V"), "none"); // NOI18N map.put(KeyStroke.getKeyStroke("control X"), "none"); // NOI18N putActionDelegate(map, KeyStroke.getKeyStroke("COPY")); // NOI18N map.put(KeyStroke.getKeyStroke("PASTE"), "none"); // NOI18N map.put(KeyStroke.getKeyStroke("CUT"), "none"); // NOI18N if (Utilities.isMac()) { putActionDelegate(map, KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.META_MASK)); // NOI18N map.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.META_MASK), "none"); // NOI18N map.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.META_MASK), "none"); // NOI18N } else { putActionDelegate(map, KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK)); // NOI18N map.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK), "none"); // NOI18N map.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK), "none"); // NOI18N } }
Example 6
Source File: OutlineView.java From netbeans with Apache License 2.0 | 6 votes |
public OutlineViewOutline(final OutlineModel mdl, PropertiesRowModel rowModel) { super(mdl); this.rowModel = rowModel; setSelectVisibleColumnsLabel(NbBundle.getMessage(OutlineView.class, "CTL_ColumnsSelector")); //NOI18N // fix for #198694 // default action map for JTable defines these shortcuts // but we use our own mechanism for handling them // following lines disable default L&F handling (if it is // defined on Ctrl-c, Ctrl-v and Ctrl-x) removeDefaultCutCopyPaste(getInputMap(WHEN_FOCUSED)); removeDefaultCutCopyPaste(getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)); KeyStroke ctrlSpace; if (Utilities.isMac()) { ctrlSpace = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, KeyEvent.META_MASK, false); } else { ctrlSpace = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, KeyEvent.CTRL_DOWN_MASK, false); } Object ctrlSpaceActionBind = getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).get(ctrlSpace); if (ctrlSpaceActionBind != null) { getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ctrlSpace, "invokeCustomEditor"); //NOI18N Action invokeCustomEditorAction = new InvokeCustomEditorAction(ctrlSpaceActionBind); getActionMap().put("invokeCustomEditor", invokeCustomEditorAction); } }
Example 7
Source File: SBHomeFactory.java From netbeans with Apache License 2.0 | 5 votes |
/** * Return default Home factory depending on current OS * @return default Home factory */ public static HomeFactory getDefault() { if (Utilities.isWindows()) { return getDefaultWindows(); } else if (Utilities.isMac()) { return getDefaultMac(); } else { return getDefaultUx(); } }
Example 8
Source File: SimpleDialogPanelTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testLabels2() { SimpleDialogPanel.DialogDescriptor dd = new SimpleDialogPanel.DialogDescriptor(LABELS1); dd.setMnemonics(MNEMONICS1); SimpleDialogPanel sdp = new SimpleDialogPanel(dd); JLabel[] labels = sdp.getLabels(); for (int i=0,maxi=LABELS1.length; i<maxi; i++) { int expectedMnemonic = Utilities.isMac() ? 0 : MNEMONICS1[i]; assertEquals(expectedMnemonic, labels[i].getDisplayedMnemonic()); } }
Example 9
Source File: IOWindowTest.java From netbeans with Apache License 2.0 | 5 votes |
/** * Test for bug 254566 - Output window is hogging space with minimum * vertical space requirement. */ @Test public void testMinimumHeight() { IOWindow.IOWindowImpl ioWin = IOWindow.IOWindowImpl.findDefault(); if (Utilities.isMac()) { ioWin.addTab(new JPanel(), null); ioWin.addTab(new JPanel(), null); int minHeight = ioWin.getMinimumSize().height; ioWin.addTab(new JPanel(), null); Assert.assertEquals("Adding tab should not affect minimum height of" + " the window.", minHeight, ioWin.getMinimumSize().height); } }
Example 10
Source File: PatchedHtmlRenderer.java From netbeans with Apache License 2.0 | 5 votes |
/** * Workaround for Apple bug 3644261 - after using form editor, all boldface * fonts start showing up with incorrect metrics, such that all boldface * fonts in the entire IDE are displayed 12px below where they should be. * Embarrassing and awful. */ private static final Font deriveFont(Font f, int style) { // return f.deriveFont(style); // see #49973 for details. Font result = Utilities.isMac() ? new Font(f.getName(), style, f.getSize()) : f.deriveFont(style); return result; }
Example 11
Source File: MozillaBrowser.java From netbeans with Apache License 2.0 | 5 votes |
/** * Returns a new instance of BrowserImpl implementation. * @throws UnsupportedOperationException when method is called and OS is not Windows. * @return browserImpl implementation of browser. */ @Override public HtmlBrowser.Impl createHtmlBrowserImpl() { ExtBrowserImpl impl = null; if (Utilities.isWindows()) { impl = new NbDdeBrowserImpl(this); } else if (Utilities.isUnix() && !Utilities.isMac()) { impl = new UnixBrowserImpl(this); } else { throw new UnsupportedOperationException (NbBundle.getMessage (MozillaBrowser.class, "MSG_CannotUseBrowser")); } return impl; }
Example 12
Source File: SystemDefaultBrowser.java From netbeans with Apache License 2.0 | 5 votes |
/** * Returns a new instance of BrowserImpl implementation. * @throws UnsupportedOperationException when method is called and OS is not Windows. * @return browserImpl implementation of browser. */ @Override public HtmlBrowser.Impl createHtmlBrowserImpl() { if (ACTIVE) { return new Jdk6BrowserImpl(); } else if (Utilities.isWindows()) { return new NbDdeBrowserImpl(this); } else if (Utilities.isMac()) { return new MacBrowserImpl(this); } else if (Utilities.isUnix() && !Utilities.isMac()) { return new NbDefaultUnixBrowserImpl(this); } else { throw new UnsupportedOperationException(NbBundle.getMessage(SystemDefaultBrowser.class, "MSG_CannotUseBrowser")); } }
Example 13
Source File: CompletionLayoutPopup.java From netbeans with Apache License 2.0 | 5 votes |
/** * Create and display the popup at the given bounds. * * @param popupBounds location and size of the popup. * @param displayAboveCaret whether the popup is displayed above the anchor * bounds or below them (it does not be right above them). */ private void show(Rectangle popupBounds, boolean displayAboveCaret) { // Hide the original popup if exists if (popup != null) { popup.hide(); popup = null; } // Explicitly set the preferred size Dimension origPrefSize = getPreferredSize(); Dimension newPrefSize = popupBounds.getSize(); JComponent contComp = getContentComponent(); if (contComp == null){ return; } contComp.setPreferredSize(newPrefSize); showRetainedPreferredSize = newPrefSize.equals(origPrefSize); PopupFactory factory = PopupFactory.getSharedInstance(); // Lightweight completion popups don't work well on the Mac - trying // to click on its scrollbars etc. will cause the window to be hidden, // so force a heavyweight parent by passing in owner==null. (#96717) JTextComponent owner = layout.getEditorComponent(); if(owner != null && owner.getClientProperty("ForceHeavyweightCompletionPopup") != null) { owner = null; } // #76648: Autocomplete box is too close to text if(displayAboveCaret && Utilities.isMac()) { popupBounds.y -= 10; } popup = factory.getPopup(owner, contComp, popupBounds.x, popupBounds.y); popup.show(); this.popupBounds = popupBounds; this.displayAboveCaret = displayAboveCaret; }
Example 14
Source File: JavaHlClientAdapterFactory.java From netbeans with Apache License 2.0 | 5 votes |
private void presetJavahl() { if(Utilities.isUnix() && !Utilities.isMac() ) { // javahl for mac is already bundled presetJavahlUnix(); } else if(Utilities.isWindows()) { presetJavahlWindows(); } }
Example 15
Source File: Install.java From visualvm with GNU General Public License v2.0 | 4 votes |
public void uninstalled() { // SysTray isn't supported for Mac if (Utilities.isMac()) return; SysTray.getInstance().uninitialize(); }
Example 16
Source File: MercurialInterceptor.java From netbeans with Apache License 2.0 | 4 votes |
/** * On Windows and Mac platforms files are the same if the paths equal with ignored case */ private boolean equalPathsIgnoreCase(File srcFile, File dstFile) { return Utilities.isWindows() && srcFile.equals(dstFile) || Utilities.isMac() && srcFile.getPath().equalsIgnoreCase(dstFile.getPath()); }
Example 17
Source File: DockerConnectionPanel.java From netbeans with Apache License 2.0 | 4 votes |
private static String getDefaultUrl() { String url = null; String envUrl = System.getenv("DOCKER_HOST"); // NOI18N if (envUrl != null) { envUrl = envUrl.trim(); try { return new URL(envUrl).toString(); } catch (MalformedURLException ex) { // try to parse it } Matcher m = REMOTE_HOST_PATTERN.matcher(envUrl); if (m.matches()) { boolean https = false; String tlsEnv = System.getenv("DOCKER_TLS_VERIFY"); // NOI18N if (tlsEnv != null && "1".equals(tlsEnv)) { // NOI18N https = true; } else { https = Integer.parseInt(m.group(2)) == 2376; } return (https ? "https://" : "http://") + envUrl.substring(m.group(1).length()); // NOI18N } } if (url == null) { if (Utilities.isMac() || Utilities.isWindows()) { if (Utilities.isWindows()) { String appData = System.getenv("APPDATA"); // NOI18N // docker beta detection if (appData != null && new File(appData, "Docker" + File.separatorChar + ".trackid").isFile()) { // NOI18N url = "http://127.0.0.1:2375"; // NOI18N } } else if (Utilities.isMac()) { // FIXME beta detection } if (url == null) { if (new File(System.getProperty("user.home"), ".docker").isDirectory()) { // NOI18N // dockertoolbox url = "https://192.168.99.100:2376"; // NOI18N } else { // obsolete boot2docker url = "https://192.168.59.103:2376"; // NOI18N } } } else { url = "http://127.0.0.1:2375"; // NOI18N } } return url; }
Example 18
Source File: IOSBrowserActionProvider.java From netbeans with Apache License 2.0 | 4 votes |
@Override public boolean isActionEnabled(String command, Lookup context) throws IllegalArgumentException { return Utilities.isMac(); }
Example 19
Source File: CordovaBrowserFactory.java From netbeans with Apache License 2.0 | 4 votes |
@Override public boolean canCreateHtmlBrowserImpl() { return Utilities.isMac(); }
Example 20
Source File: MAMPInstallation.java From netbeans with Apache License 2.0 | 4 votes |
public boolean isInstalled() { return Utilities.isMac() && Utils.isValidExecutable(getStartCommand()[0]); }