Java Code Examples for org.openide.util.Utilities#OS_SOLARIS

The following examples show how to use org.openide.util.Utilities#OS_SOLARIS . 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: LocationChooser.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private boolean isPlatformDir ( File f ) {
    //XXX: Workaround of hard NFS mounts on Solaris.
    final int osId = Utilities.getOperatingSystem();
    if (osId == Utilities.OS_SOLARIS || osId == Utilities.OS_SUNOS) {
        return false;
    }
    FileObject fo = (f != null) ? convertToValidDir(f) : null;
    if (fo != null) {
        //XXX: Workaround of /net folder on Unix, the folders in the root are not badged as platforms.
        // User can still select them.
        try {
            if (Utilities.isUnix() && (fo.getParent() == null || fo.getFileSystem().getRoot().equals(fo.getParent()))) {
                return false;
            }
        } catch (FileStateInvalidException e) {
            return false;
        }
        if (this.platformInstall.accept(fo)) {
            return true;
        }
    }
    return false;
}
 
Example 2
Source File: EventLock.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** @return true iff current thread is EventDispatchThread */
static boolean isDispatchThread() {
    boolean dispatch = EventQueue.isDispatchThread ();
    if (!dispatch && Utilities.getOperatingSystem () == Utilities.OS_SOLARIS) {
        // on solaris the event queue is not always recognized correctly
        // => try to guess by name
        dispatch = (Thread.currentThread().getClass().getName().indexOf("EventDispatchThread") >= 0); // NOI18N
    }
    return dispatch;
}
 
Example 3
Source File: CreateJREPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static boolean isEJDK(@NonNull final File folder) {
    //XXX: Workaround of hard NFS mounts on Solaris.
    final int osId = Utilities.getOperatingSystem();
    if (osId == Utilities.OS_SOLARIS || osId == Utilities.OS_SUNOS) {
        return false;
    }
    final String jrecreateName = Utilities.isWindows() ?
        "jrecreate.bat" :  //NOI18N
        "jrecreate.sh";    //NOI18N
    final File jrecreate = new File(
        new File(folder, "bin"),    //NOI18N
        jrecreateName);
    return jrecreate.exists();
}
 
Example 4
Source File: KeyStrokeUtils.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Sort the list, so that the most appropriate accelerator is at index 0.
 */
private static List<KeyStroke[]> sortKeyStrokesByPreference(
        List<KeyStroke[]> keystrokes) {
    if (keystrokes.size() < 2) {
        return keystrokes;
    }
    KeyStroke best[] = null;
    boolean isSolaris =
            Utilities.getOperatingSystem() == Utilities.OS_SOLARIS;
    for (int i = 0; i < keystrokes.size(); i++) {
        KeyStroke[] ks = keystrokes.get(i);
        if (ks.length > 1) {
            continue;
        }
        boolean solarisKey = ks[0].getKeyCode() >= KeyEvent.VK_STOP
                && ks[0].getKeyCode() <= KeyEvent.VK_CUT;
        if (isSolaris == solarisKey
                && (best == null
                || best[0].getKeyCode() > ks[0].getKeyCode())) {
            //Solaris key on solaris OS or other key on other OS.
            best = ks;
        }
    }
    if (best != null) {
        keystrokes.remove(best);
        keystrokes.add(0, best);
    }
    return keystrokes;
}
 
Example 5
Source File: NewObjectPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void newObjectNameFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_newObjectNameFocusGained
    if (
        Utilities.getOperatingSystem() == Utilities.OS_SOLARIS ||
        Utilities.getOperatingSystem() == Utilities.OS_SUNOS
    ) {
        // does not work on CDE window manager, so better do nothin
        return;
    }

    newObjectName.selectAll ();
}
 
Example 6
Source File: WinSysPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void fireChanged() {
    boolean isChanged = false;
    boolean isNotSolaris = Utilities.getOperatingSystem() != Utilities.OS_SOLARIS;
    boolean isMacJDK17 = isMacJDK7();
    if (isDragImage.isSelected() != prefs.getBoolean(WinSysPrefs.DND_DRAGIMAGE, isNotSolaris && !isMacJDK17)
            || isDragImageAlpha.isSelected() != prefs.getBoolean(WinSysPrefs.TRANSPARENCY_DRAGIMAGE, isNotSolaris && !isMacJDK17)
            || isAlphaFloating.isSelected() != prefs.getBoolean(WinSysPrefs.TRANSPARENCY_FLOATING, false)
            || isSnapping.isSelected() != prefs.getBoolean(WinSysPrefs.SNAPPING, true)
            || isSnapScreenEdges.isSelected() != prefs.getBoolean(WinSysPrefs.SNAPPING_SCREENEDGES, true)) {
        isChanged = true;
    }
    controller.changed(isChanged);
}
 
Example 7
Source File: WinSysPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void load() {
    boolean isNotSolaris = Utilities.getOperatingSystem() != Utilities.OS_SOLARIS;
    boolean isMacJDK17 = isMacJDK7();
    isDragImage.setSelected(prefs.getBoolean(WinSysPrefs.DND_DRAGIMAGE, isNotSolaris && !isMacJDK17));
    isDragImageAlpha.setSelected(prefs.getBoolean(WinSysPrefs.TRANSPARENCY_DRAGIMAGE, isNotSolaris && !isMacJDK17));

    isAlphaFloating.setSelected(prefs.getBoolean(WinSysPrefs.TRANSPARENCY_FLOATING,false));
    
    isSnapping.setSelected(prefs.getBoolean(WinSysPrefs.SNAPPING, true));
    isSnapScreenEdges.setSelected(prefs.getBoolean(WinSysPrefs.SNAPPING_SCREENEDGES, true));
}
 
Example 8
Source File: NavigationTreeViewTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void testStructureFullOfFormFiles() throws Exception {
    if ((
        Utilities.getOperatingSystem() & 
        (Utilities.OS_SOLARIS | Utilities.OS_SUNOS)
    ) != 0) {
        LOG.log(Level.CONFIG, "Giving up, this test fails too randomly on Solaris");
        return;
    }
    
    Children ch = new Children.Array();
    Node root = new AbstractNode(ch);
    root.setName(getName());

    ch.add(nodeWith("A", "-A", "-B", "B"));
    ch.add(nodeWith("X", "Y", "Z"));

    final Node first = ch.getNodes()[0];

    LOG.log(Level.INFO, "Nodes are ready: {0}", root);
    final ExplorerManager em = testWindow.getExplorerManager();
    em.setRootContext(root);
    LOG.info("setRootContext done");
    em.setSelectedNodes(new Node[] { first });
    LOG.log(Level.INFO, "setSelectedNodes to {0}", first);
    LOG.log(Level.INFO, "Verify setSelectedNodes: {0}", Arrays.asList(em.getSelectedNodes()));

    EventQueue.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            TreePath path = treeView.tree.getSelectionPath();
            LOG.log(Level.INFO, "getSelectionPath {0}", path);
            LOG.log(Level.INFO, "getSelectedNodes {0}", Arrays.toString(em.getSelectedNodes()));
            assertNotNull("Something is selected", path);
            Node node = Visualizer.findNode(path.getLastPathComponent());
            assertEquals("It is the first node", first, node);
        }
    });
    
    sendAction("expand");
    sendAction("selectNext");

    assertEquals("Explored context is N0", first, em.getExploredContext());
    assertEquals("Selected node is A", 1, em.getSelectedNodes().length);
    assertEquals("Selected node is A", "A", em.getSelectedNodes()[0].getName());

    sendAction(enter);

    Keys keys = (Keys)first.getChildren();
    assertEquals("One invocation", 1, keys.actionPerformed);
    assertFalse("No write access", keys.writeAccess);
    assertFalse("No read access", keys.readAccess);
}
 
Example 9
Source File: PhpEnvironment.java    From netbeans with Apache License 2.0 4 votes vote down vote up
static boolean isSolaris() {
    return (Utilities.getOperatingSystem() & Utilities.OS_SOLARIS) != 0
            || (Utilities.getOperatingSystem() & Utilities.OS_SUNOS) != 0;
}