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


Java Utilities.isMac方法代碼示例

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


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

示例1: testRenameFileChangeCase_FO

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void testRenameFileChangeCase_FO () throws Exception {
    // prepare
    File fromFile = createFile("file");
    File toFile = new File(getWorkTreeDir(), "FILE");
    commit(fromFile);
    
    // move
    renameFO(fromFile, toFile.getName());
    
    // test
    if (Utilities.isWindows() || Utilities.isMac()) {
        assertTrue(Arrays.asList(toFile.getParentFile().list()).contains(toFile.getName()));
        assertFalse(Arrays.asList(fromFile.getParentFile().list()).contains(fromFile.getName()));
    } else {
        assertFalse(fromFile.exists());
        assertTrue(toFile.exists());
        assertEquals(FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY, getCache().refresh(fromFile).getStatus());
        assertEquals(FileInformation.STATUS_VERSIONED_ADDEDLOCALLY, getCache().refresh(toFile).getStatus());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:InterceptorTest.java

示例2: inEQtestReadListOfSubmitButtonsWithAmpersand

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void inEQtestReadListOfSubmitButtonsWithAmpersand() throws Exception {
    String page = "<html><body><form action='http://xyz.cz' method='POST'>" +
        "<input type='hidden' name='submit' value=\"&amp;Send Feedback\"/>" +
        "\n" +
        "</form></body></html>";
    
    InputStream is = new ByteArrayInputStream(page.getBytes());
    JButton def = new JButton("Default");
    Object[] buttons = parseButtons(is, def);
    is.close();
    
    assertNotNull("buttons parsed", buttons);
    assertEquals("There is one button", 2, buttons.length);
    assertEquals("Second is default", def, buttons[1]);
    assertEquals("It is a button", JButton.class, buttons[0].getClass());
    JButton b = (JButton)buttons[0];
    assertEquals("It is named", "Send Feedback", b.getText());
    assertEquals("It url attribute is set", "http://xyz.cz", b.getClientProperty("url"));
    if (Utilities.isMac()) {
        assertEquals("Mnemonics", 0, b.getMnemonic());
        assertEquals("Mnemonic index", -1, b.getDisplayedMnemonicIndex());
    } else {
        assertEquals("Mnemonics", 'S', b.getMnemonic());
        assertEquals("Mnemonic index", 0, b.getDisplayedMnemonicIndex());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:InstallerTest.java

示例3: runProcess

import org.openide.util.Utilities; //導入方法依賴的package包/類
private Process runProcess(String command, String args) throws DatabaseException {

        if ( Utilities.isMac() && command.endsWith(".app") ) {  // NOI18N
            // The command is actually the first argument, with /usr/bin/open
            // as the actual command.  Put the .app file path in quotes to
            // deal with spaces in the path.
            args = "\"" + command + "\" " + args; // NOI18N
            command = "/usr/bin/open"; // NOI18N
        }
        try {
            NbProcessDescriptor desc = new NbProcessDescriptor(command, args);
            Process proc = desc.exec();

            new ExecSupport().displayProcessOutputs(proc);
            return proc;
        } catch ( Exception e ) {
            throw new DatabaseException(e);
        }

    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:MySQLDatabaseServer.java

示例4: testRenameFolderChangeCase_DO

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

示例5: testRenameFileChangeCase_DO

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void testRenameFileChangeCase_DO () throws Exception {
    // prepare
    File fromFile = createFile("file");
    File toFile = new File(getWorkTreeDir(), "FILE");
    commit(fromFile);
    
    // move
    renameDO(fromFile, toFile.getName());
    
    // test
    if (Utilities.isWindows() || Utilities.isMac()) {
        assertTrue(Arrays.asList(toFile.getParentFile().list()).contains(toFile.getName()));
        assertFalse(Arrays.asList(fromFile.getParentFile().list()).contains(fromFile.getName()));
    } else {
        assertFalse(fromFile.exists());
        assertTrue(toFile.exists());
        assertEquals(FileInformation.STATUS_VERSIONED_REMOVEDLOCALLY, getCache().refresh(fromFile).getStatus());
        assertEquals(FileInformation.STATUS_VERSIONED_ADDEDLOCALLY, getCache().refresh(toFile).getStatus());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:InterceptorTest.java

示例6: isDeviceAvailable

import org.openide.util.Utilities; //導入方法依賴的package包/類
@Override
public boolean isDeviceAvailable(String deviceName) {
    String p = "";
    if ( Utilities.isWindows() ) {
        p = deviceName;
    } else if ( Utilities.isMac() || Utilities.isUnix() ) {
        p = deviceName.substring( DEV_PREFFIX.length() );
    }
    
    Enumeration<CommPortIdentifier> portIdentifiers = CommPortIdentifier.getPortIdentifiers();
    while (portIdentifiers.hasMoreElements()) {
        CommPortIdentifier cpi = portIdentifiers.nextElement();
        if ( p.equals(cpi.getName()) ) {
            return isPortAvailable(cpi);
        }
    }

    return false;
}
 
開發者ID:chipKIT32,項目名稱:chipKIT-importer,代碼行數:20,代碼來源:DefaultSerialMonitorConfigModel.java

示例7: invokeSelected

import org.openide.util.Utilities; //導入方法依賴的package包/類
private void invokeSelected() {
    PopupUtil.hidePopup();
    if (Utilities.isMac()) {
        // see issue #115106
        component.requestFocus();
    }
    Object value = jList1.getSelectedValue();
    if (value instanceof CodeDeleter) {
        ((CodeDeleter) value).invoke();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:RemoveSurroundingCodePanel.java

示例8: isValidPath

import org.openide.util.Utilities; //導入方法依賴的package包/類
private static boolean isValidPath(String path, boolean isDirectory, boolean emptyOK) {
    if ( isEmpty(path) ) {
        return emptyOK;
    }
    File file = new File(path).getAbsoluteFile();
    if ( ! file.exists() ) {
        return false;
    }
    
    return (isDirectory && file.isDirectory()) || 
            (!isDirectory && file.isFile()) ||
            (Utilities.isMac() && !isDirectory && path.endsWith(".app"));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:Utils.java

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

示例10: getColor

import org.openide.util.Utilities; //導入方法依賴的package包/類
public Color getColor() {
    if (Utilities.isMac()) {
        Color c1 = UIManager.getColor("controlShadow"); // NOI18N
        Color c2 = UIManager.getColor("control"); // NOI18N
        return new Color((c1.getRed() + c2.getRed()) / 2,
                (c1.getGreen() + c2.getGreen()) / 2,
                (c1.getBlue() + c2.getBlue()) / 2);
    } else {
        return UIManager.getColor("controlShadow"); // NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:TerminalContainerTopComponent.java

示例11: getImplementation

import org.openide.util.Utilities; //導入方法依賴的package包/類
public ExtBrowserImpl getImplementation() {
    String pName = extBrowserFactory.getBrowserExecutable().getProcessName().toUpperCase();
            
    if (pName != null) {
        
        // Windows -> DDE browser if it is Mozilla, or Netscape 4.x or Netscape 7.x or Internet Explorer
        // Netscape6 is also simple command-line
        if (Utilities.isWindows()) {
            if (pName.indexOf("IEXPLORE.EXE") > -1 ||       // NOI18N
                pName.indexOf("NETSCP.EXE") > -1 ||         // NOI18N
                pName.indexOf("MOZILLA.EXE") > -1 ||        // NOI18N
                pName.indexOf("FIREFOX.EXE") > -1 ||        // NOI18N
                pName.indexOf("NETSCAPE.EXE") > -1) {       // NOI18N
                    if (ddeImpl == null) {
                        ddeImpl = new NbDdeBrowserImpl(extBrowserFactory);
                    }
                    return ddeImpl;
            }

        // Unix (but not MacOSX) -> if Netscape or Mozilla, create Unix browser
        } else if (Utilities.isUnix() && !Utilities.isMac()) {
            if (pName.indexOf("MOZILLA") > -1 ||            // NOI18N
                pName.indexOf("NETSCAPE") > -1 || 
                pName.indexOf("FIREFOX") > -1) {           // NOI18N
                    if (unixImpl == null) {
                        unixImpl = new UnixBrowserImpl(extBrowserFactory);
                    }
                    return unixImpl;
            }
        }
    }
    
    // otherwise simple command-line browser
    if (simpleImpl == null) {
        simpleImpl = new SimpleExtBrowserImpl(extBrowserFactory);
    }
    return simpleImpl;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:39,代碼來源:DelegatingWebBrowserImpl.java

示例12: testCategoriesAreReclaimable

import org.openide.util.Utilities; //導入方法依賴的package包/類
public void testCategoriesAreReclaimable() throws Exception {
    if (Utilities.isMac()) { //#238765 apparently something is different on mac and the setup of the test is not  correct. I could not find what that is, so just disabled the test
        return;
    }
    final Reference<?>[] refs = new Reference<?>[4];
    
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            Category test1 = Category.create("test1", "test1", null);
            Category test2 = Category.create("test2", "test3", null, test1);
            Category test3 = Category.create("test3", "test3", null);
            refs[1] = new WeakReference<Object>(test1);
            refs[2] = new WeakReference<Object>(test2);
            refs[3] = new WeakReference<Object>(test3);
            Dialog d = ProjectCustomizer.createCustomizerDialog(new Category[] {test2, test3}, new CategoryComponentProvider() {
                public JComponent create(Category category) {
                    return new JPanel();
                }
            }, null, new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    //ignore
                }
            }, HelpCtx.DEFAULT_HELP);
            d.dispose();
            refs[0] = new WeakReference<Object>(d);
        }
    });
    
    for (Reference<?> ref : refs) {
        assertGC("Is reclaimable", ref);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:ProjectCustomizerTest.java

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

示例14: testMinimumHeight

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

示例15: getAvailableDeviceNames

import org.openide.util.Utilities; //導入方法依賴的package包/類
@Override
public String[] getAvailableDeviceNames() {
    if ( Utilities.isWindows() ) return getAvailablePortNames();
    if ( Utilities.isMac() || Utilities.isUnix() ) {
        String[] portNames = getAvailablePortNames();
        String[] deviceNames = new String[portNames.length];
        int i=0;
        for ( String p : portNames ) {
            deviceNames[i++] = DEV_PREFFIX + p;
        }
        return deviceNames;
    }
    throw new UnsupportedOperationException("Getting port device names is not available on this platform!");
}
 
開發者ID:chipKIT32,項目名稱:chipKIT-importer,代碼行數:15,代碼來源:DefaultSerialMonitorConfigModel.java


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