當前位置: 首頁>>代碼示例>>Java>>正文


Java Utilities.getOperatingSystem方法代碼示例

本文整理匯總了Java中org.openide.util.Utilities.getOperatingSystem方法的典型用法代碼示例。如果您正苦於以下問題:Java Utilities.getOperatingSystem方法的具體用法?Java Utilities.getOperatingSystem怎麽用?Java Utilities.getOperatingSystem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.util.Utilities的用法示例。


在下文中一共展示了Utilities.getOperatingSystem方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isPlatformDir

import org.openide.util.Utilities; //導入方法依賴的package包/類
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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:LocationChooser.java

示例2: testNormalizeDrivesOnWindows48681

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void testNormalizeDrivesOnWindows48681 () {
    if ((Utilities.isWindows () || (Utilities.getOperatingSystem () == Utilities.OS_OS2))) {
        File[] roots = File.listRoots();
        for (int i = 0; i < roots.length; i++) {
            File file = roots[i];
            if (FileSystemView.getFileSystemView().isFloppyDrive(file) || !file.exists()) {
                continue;
            }
            File normalizedFile = FileUtil.normalizeFile(file);
            File normalizedFile2 = FileUtil.normalizeFile(new File (file, "."));
            
            assertEquals (normalizedFile.getPath(), normalizedFile2.getPath());
        }
        
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:BaseFileObjectTestHid.java

示例3: mousePressed

import org.openide.util.Utilities; //導入方法依賴的package包/類
public WidgetAction.State mousePressed(Widget widget, WidgetAction.WidgetMouseEvent event) {
    if (isLocked ())
        return State.createLocked (widget, this);
    if ((event.getModifiers () & modifiers) == modifiers) {
        if ((Utilities.getOperatingSystem () & Utilities.OS_MAC) != 0)
            macLocking = true;
        return super.mousePressedCore(widget,event);
    }
    return State.REJECTED;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:ExtendedConnectAction.java

示例4: getSources

import org.openide.util.Utilities; //導入方法依賴的package包/類
@NonNull
private static FileObject[] getSources(@NonNull final Collection<? extends FileObject> installFolders) {
    if (installFolders.isEmpty()) {
        return new FileObject[0];
    }
    final FileObject installFolder = installFolders.iterator().next();
    if (installFolder == null || !installFolder.isValid()) {
        return new FileObject[0];
    }
    FileObject src = installFolder.getFileObject("src.zip");    //NOI18N
    if (src == null) {
        src = installFolder.getFileObject("src.jar");    //NOI18N
    }
    if (src == null || !src.canRead()) {
        return new FileObject[0];
    }
    FileObject root = FileUtil.getArchiveRoot(src);
    if (root == null) {
        return new FileObject[0];
    }
    if (Utilities.getOperatingSystem() == Utilities.OS_MAC) {
        FileObject reloc = root.getFileObject("src");   //NOI18N
        if (reloc != null) {
            root = reloc;
        }
    }
    return new FileObject[]{root};
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:FallbackDefaultJavaPlatform.java

示例5: sortKeyStrokesByPreference

import org.openide.util.Utilities; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:KeyStrokeUtils.java

示例6: defineOsTokens

import org.openide.util.Utilities; //導入方法依賴的package包/類
/**
 * Define {@code org.openide.modules.os.*} tokens according to the current platform.
 * @param provides a collection that may be added to
 */
public static void defineOsTokens(Collection<? super String> provides) {
    if (Utilities.isUnix()) {
        provides.add("org.openide.modules.os.Unix"); // NOI18N
        if (!Utilities.isMac()) {
            provides.add("org.openide.modules.os.PlainUnix"); // NOI18N
        }
    }
    if (Utilities.isWindows()) {
        provides.add("org.openide.modules.os.Windows"); // NOI18N
    }
    if (Utilities.isMac()) {
        provides.add("org.openide.modules.os.MacOSX"); // NOI18N
    }
    if ((Utilities.getOperatingSystem() & Utilities.OS_OS2) != 0) {
        provides.add("org.openide.modules.os.OS2"); // NOI18N
    }
    if ((Utilities.getOperatingSystem() & Utilities.OS_LINUX) != 0) {
        provides.add("org.openide.modules.os.Linux"); // NOI18N
    }
    if ((Utilities.getOperatingSystem() & Utilities.OS_SOLARIS) != 0) {
        provides.add("org.openide.modules.os.Solaris"); // NOI18N
    }
    
    if (isJavaFX(new File(System.getProperty("java.home")))) {
        provides.add("org.openide.modules.jre.JavaFX"); // NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:32,代碼來源:CoreBridge.java

示例7: SimpleExtBrowser

import org.openide.util.Utilities; //導入方法依賴的package包/類
/** Creates new SimpleExtBrowser */
public SimpleExtBrowser() {
    super(PrivateBrowserFamilyId.UNKNOWN);
    if (Utilities.getOperatingSystem () == Utilities.OS_OS2) {
        browserExecutable = new NbProcessDescriptor(
            "Netscape.exe", // NOI18N
            // {URL}
            " {" + BrowserFormat.TAG_URL + "}", // NOI18N
            NbBundle.getBundle(SimpleExtBrowser.class).getString("MSG_BrowserExecutorHint")
        );
    } else if (Utilities.isMac()) {
        browserExecutable = new NbProcessDescriptor(
            "/usr/bin/open", // NOI18N
            // {URL}
            " {" + BrowserFormat.TAG_URL + "}", // NOI18N
            NbBundle.getBundle(SimpleExtBrowser.class).getString("MSG_BrowserExecutorHint")
        );
    } else {
        browserExecutable = new NbProcessDescriptor(
            // empty string for process
            "", // NOI18N
            // {URL}
            " {" + BrowserFormat.TAG_URL + "}", // NOI18N
            NbBundle.getBundle(SimpleExtBrowser.class).getString("MSG_BrowserExecutorHint")
        );
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:SimpleExtBrowser.java

示例8: isDispatchThread

import org.openide.util.Utilities; //導入方法依賴的package包/類
/** @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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:EventLock.java

示例9: testNextEvent

import org.openide.util.Utilities; //導入方法依賴的package包/類
/**
 * Test of nextEvent method, of class LinuxNotifier.
 *
 * @throws java.lang.Exception
 */
public void testNextEvent() throws Exception {

    if (Utilities.getOperatingSystem() != Utilities.OS_LINUX) {
        System.out.println("Skipping linux-only test: " + getName());
        return;
    }

    prepareFiles();

    final AtomicBoolean folder2refreshed = new AtomicBoolean(false);
    Logger log = Logger.getLogger(FolderObj.class.getName());

    Handler h = createHandler(folder2refreshed);
    log.addHandler(h);
    try {
        FileChangeListener l = new FileChangeAdapter();
        FileUtil.addFileChangeListener(l, folder1text1Txt);
        // This causes an IN_IGNORED native event.
        FileUtil.removeFileChangeListener(l, folder1text1Txt);
        // Native listeners may need some time.
        Thread.sleep(2000);
    } finally {
        log.removeHandler(h);
    }
    assertFalse("Folder folder2 should not be refreshed.",
            folder2refreshed.get());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:LinuxNotifier235632Test.java

示例10: newObjectNameFocusGained

import org.openide.util.Utilities; //導入方法依賴的package包/類
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 ();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:NewObjectPanel.java

示例11: fireChanged

import org.openide.util.Utilities; //導入方法依賴的package包/類
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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:WinSysPanel.java

示例12: load

import org.openide.util.Utilities; //導入方法依賴的package包/類
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));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:WinSysPanel.java

示例13: getCurrentOsId

import org.openide.util.Utilities; //導入方法依賴的package包/類
private String getCurrentOsId() {
    int osId = Utilities.getOperatingSystem();
    for(Field field : Utilities.class.getDeclaredFields()) {
        try {
            int value = field.getInt(null);
            if (value == osId) {
                return field.getName();
            }
        } catch (Exception e) {
            // ignore
        }
    }
    fail("Can't detect OS type ");
    return null; // not reachable
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:LocatorTest.java

示例14: isEJDK

import org.openide.util.Utilities; //導入方法依賴的package包/類
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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:CreateJREPanel.java

示例15: testStructureFullOfFormFiles

import org.openide.util.Utilities; //導入方法依賴的package包/類
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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:53,代碼來源:NavigationTreeViewTest.java


注:本文中的org.openide.util.Utilities.getOperatingSystem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。