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


Java Utilities.isUnix方法代碼示例

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


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

示例1: testEqualSymlinks

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void testEqualSymlinks() throws Exception {
    if (!Utilities.isUnix()) {
        return;
    }
    File copy = new File(getWorkDir(), "copy");
    int ret = new ProcessBuilder("ln", "-s", "orig", copy.getPath()).start().waitFor();
    assertEquals("Symlink created", ret, 0);
    assertTrue("Dir exists", copy.exists());
    File f = new File(copy, "test.js");
    assertTrue("File exists", f.exists());
    
    URLEquality oe = new URLEquality(orig.toURI().toURL());
    URLEquality ne = new URLEquality(f.toURI().toURL());

    assertEquals("Same hashCode", oe.hashCode(), ne.hashCode());
    assertEquals("They are similar", oe, ne);
    
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:URLEqualityTest.java

示例2: isHidden

import org.openide.util.Utilities; //導入方法依賴的package包/類
/** Determines whether the browser should be visible or not
 *  @return true when OS is Windows.
 *          false in all other cases.
 */
public static Boolean isHidden () {
    String detectedPath = null;
    if (Utilities.isWindows()) {
        try {
            detectedPath = NbDdeBrowserImpl.getBrowserPath(ExtWebBrowser.FIREFOX);      // NOI18N
        } catch (NbBrowserException e) {
            ExtWebBrowser.getEM().log(Level.FINEST, "Cannot detect Firefox : {0}", e);      // NOI18N
        }
        if ((detectedPath != null) && (detectedPath.trim().length() > 0)) {
            return Boolean.FALSE;
        }
        return Boolean.TRUE;
    }
    return (Utilities.isUnix()) ? Boolean.FALSE : Boolean.TRUE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:FirefoxBrowser.java

示例3: createHtmlBrowserImpl

import org.openide.util.Utilities; //導入方法依賴的package包/類
/**
 * 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.isMac()) {
        impl = new MacBrowserImpl(this);
    } else if (Utilities.isUnix() && !Utilities.isMac()) {
        impl = new UnixBrowserImpl(this);
    } else {
        throw new UnsupportedOperationException (NbBundle.getMessage(FirefoxBrowser.class, "MSG_CannotUseBrowser"));
    }
    
    return impl;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:FirefoxBrowser.java

示例4: createHtmlBrowserImpl

import org.openide.util.Utilities; //導入方法依賴的package包/類
/**
 * Returns a new instance of BrowserImpl implementation.
 * @throws UnsupportedOperationException when method is called and OS is not supported.
 * @return browserImpl implementation of browser.
 */
@Override
public HtmlBrowser.Impl createHtmlBrowserImpl() {
    ExtBrowserImpl impl = null;

    if (Utilities.isUnix() && !Utilities.isMac()) {
        impl = new UnixBrowserImpl(this);
    } else if (Utilities.isWindows()) {
        impl = new NbDdeBrowserImpl(this);
    } else {
        throw new UnsupportedOperationException (NbBundle.
                getMessage(FirefoxBrowser.class, "MSG_CannotUseBrowser"));  // NOI18N
    }
    
    return impl;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:ChromiumBrowser.java

示例5: isNetBeansProject

import org.openide.util.Utilities; //導入方法依賴的package包/類
public static boolean isNetBeansProject (File directory) {
    boolean retVal = false;
    if (directory != null) {
        FileObject fo = convertToValidDir(directory);
        if (fo != null) {
            if (Utilities.isUnix() && fo.getParent() != null
                    && fo.getParent().getParent() == null) {
                retVal = false; // Ignore all subfolders of / on unixes
                // (e.g. /net, /proc)
            } else {
                retVal = ProjectManager.getDefault().isProject(fo);
            }
        }
    }
    return retVal;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:DirectoryNode.java

示例6: testLockFile

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void testLockFile() throws IOException {
    FileObject fobj = getFileObject(testFile);
    monitor.reset();
    final FileLock lock = fobj.lock();
    try {
        int expectedCount = 0;
        if (Utilities.isUnix()) {
            // called File.toURI() from FileUtil.normalizeFile()
            expectedCount = 1;
        }
        // we check canWrite once
        monitor.getResults().assertResult(1, StatFiles.WRITE);
        // adding one for the canWrite access above
        monitor.getResults().assertResult(1 + expectedCount, StatFiles.ALL);
        //second time
        monitor.reset();
        FileLock lock2 = null;
        try {
            lock2 = fobj.lock();
            fail();
        } catch (IOException ex) {
        }
        // again one for canWrite
        monitor.getResults().assertResult(1 + expectedCount, StatFiles.ALL);
    } finally {
        lock.releaseLock();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:StatFilesTest.java

示例7: doShow

import org.openide.util.Utilities; //導入方法依賴的package包/類
private void doShow () {
    //#206802 - dialog windows are hidden behind full screen window
    Window fullScreenWindow = null;
    if( Utilities.isUnix() ) {
        GraphicsDevice gd = getGraphicsConfiguration().getDevice();
        if( gd.isFullScreenSupported() ) {
            fullScreenWindow = gd.getFullScreenWindow();
            if( null != fullScreenWindow )
                gd.setFullScreenWindow( null );
        }
    }
    NbPresenter prev = null;
    try {
        MenuSelectionManager.defaultManager().clearSelectedPath();
    } catch( NullPointerException npE ) {
        //#216184
        LOG.log( Level.FINE, null, npE );
    }
    if (isModal()) {
        prev = currentModalDialog;
        currentModalDialog = this;
        fireChangeEvent();
    }
    
    superShow();

    if( null != fullScreenWindow )
        getGraphicsConfiguration().getDevice().setFullScreenWindow( fullScreenWindow );
    
    if (currentModalDialog != prev) {
        currentModalDialog = prev;
        fireChangeEvent();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:35,代碼來源:NbPresenter.java

示例8: presetJavahl

import org.openide.util.Utilities; //導入方法依賴的package包/類
private void presetJavahl() {
    if(Utilities.isUnix() && !Utilities.isMac() ) { // javahl for mac is already bundled
        presetJavahlUnix();
    } else if(Utilities.isWindows()) {
        presetJavahlWindows();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:JavaHlClientAdapterFactory.java

示例9: 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

示例10: SvnFileNode

import org.openide.util.Utilities; //導入方法依賴的package包/類
public SvnFileNode(File file) {
    this.file = file;
    File norm = FileUtil.normalizeFile(file);
    if (Utilities.isMac() || Utilities.isUnix()) {
        FileInformation fi = Subversion.getInstance().getStatusCache().getStatus(file);
        FileInformation fiNorm = Subversion.getInstance().getStatusCache().getStatus(norm);
        if (fi.getStatus() != fiNorm.getStatus()) {
            norm = null;
        }
    }
    normalizedFile = norm;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:SvnFileNode.java

示例11: getStringRep4Unixes

import org.openide.util.Utilities; //導入方法依賴的package包/類
/** Only here for fix #41477:, called from layer.xml:
 * For KDE on unixes, Ctrl+TAB is occupied by OS,
 * so we also register Ctrl+BACk_QUOTE as recent view list action shortcut.
 * For other OS's, Ctrl+TAB is the only default, because we create link
 * not pointing to anything by returning null
 */
public static String getStringRep4Unixes() {
    if (Utilities.isUnix() && !Utilities.isMac()) {
        return "Actions/Window/org-netbeans-core-windows-actions-RecentViewListAction.instance"; //NOI18N
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:RecentViewListAction.java

示例12: getGlobalConfigPath

import org.openide.util.Utilities; //導入方法依賴的package包/類
/**
 * Return the path for the systemwide command lines configuration directory 
 */
private static String getGlobalConfigPath () {
    if(Utilities.isUnix()) {
        return "/etc/subversion";               // NOI18N
    } else if (Utilities.isWindows()){
        return WINDOWS_GLOBAL_CONFIG_DIR;
    } 
    return "";                                  // NOI18N
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:SvnConfigFiles.java

示例13: runFailure

import org.openide.util.Utilities; //導入方法依賴的package包/類
/** Intended to be called by the thread which failed to start the server. 
 * It decides whether try to start server on next port or show appropriate
 * error message.
 */
void runFailure(Throwable t) {
    running = false;
    if (t instanceof IncompatibleClassChangeError) {
        // likely there is a wrong servlet API version on CLASSPATH
        DialogDisplayer.getDefault ().notify(new NotifyDescriptor.Message(
           NbBundle.getMessage (HttpServerSettings.class, "MSG_HTTP_SERVER_incompatbleClasses"),
           NotifyDescriptor.Message.WARNING_MESSAGE));
    }
    else if (t instanceof java.net.BindException) {
        // can't open socket - we can retry
        currentRetries ++;
        if (currentRetries <= MAX_START_RETRIES) {
            setPort(getPort() + 1);
            setRunning(true);
        }
        else {
            currentRetries = 0;
            DialogDisplayer.getDefault ().notify(new NotifyDescriptor.Message(
                                           NbBundle.getMessage (HttpServerSettings.class, "MSG_HTTP_SERVER_START_FAIL"),
                                           NotifyDescriptor.Message.WARNING_MESSAGE));
            int p = getPort ();
            if (p < 1024 && inited && Utilities.isUnix()) {
                DialogDisplayer.getDefault ().notify(new NotifyDescriptor.Message(
                                           NbBundle.getMessage (HttpServerSettings.class, "MSG_onlyRootOnUnix"),
                                           NotifyDescriptor.WARNING_MESSAGE));
            }

        }
    }
    else {
        // unknown problem
        DialogDisplayer.getDefault ().notify(new NotifyDescriptor.Message(
           NbBundle.getMessage (HttpServerSettings.class, "MSG_HTTP_SERVER_START_FAIL_unknown"),
           NotifyDescriptor.Message.WARNING_MESSAGE));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:41,代碼來源:HttpServerSettings.java

示例14: testHardLockExclusion

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void testHardLockExclusion() throws Throwable {
    if (Utilities.isUnix() && new File("/bin/ln").exists()) {
        File fold1 = testFile.getParentFile();
        File fold2 = new File(fold1.getParentFile(), fold1.getName() + "XXX");
        fold2.delete();
        assertTrue(fold1.exists());
        assertFalse(fold2.exists());
        ProcessBuilder pb = new ProcessBuilder("/bin/ln","-s",fold1.getAbsolutePath(), fold2.getAbsolutePath());
        try {
            pb.start().waitFor();
        } catch(Throwable th) {
            //System.out.println("");
            th.printStackTrace();
            throw th;
        }
         assertTrue(fold2.exists());
        File f1 = new File(fold1, testFile.getName());
        File f2 = new File(fold2, testFile.getName());
        FileObject fo1 = FileBasedFileSystem.getFileObject(f1);
        FileObject fo2 = FileBasedFileSystem.getFileObject(f2);
        assertNotNull(fo1);
        assertNotNull(fo2);
        for (int i = 0; i < 5; i++) {
            LockForFile lock = (LockForFile) fo1.lock();
            assertFalse(lock.isHardLocked());
            try {
                fo2.lock();
                fail();
            } catch (Exception iex) {
            }
            assertTrue(lock.isHardLocked());
            lock.releaseLock();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:36,代碼來源:LockForFileTest.java

示例15: isInstalled

import org.openide.util.Utilities; //導入方法依賴的package包/類
public boolean isInstalled() {
    return Utilities.isUnix() && Utils.isValidExecutable(LAMPP)
            && Utils.isValidExecutable(GKSU);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:LinuxXAMPPInstallation.java


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