Example usage for org.apache.commons.lang SystemUtils IS_OS_MAC

List of usage examples for org.apache.commons.lang SystemUtils IS_OS_MAC

Introduction

In this page you can find the example usage for org.apache.commons.lang SystemUtils IS_OS_MAC.

Prototype

boolean IS_OS_MAC

To view the source code for org.apache.commons.lang SystemUtils IS_OS_MAC.

Click Source Link

Document

Is true if this is Mac.

The field will return false if OS_NAME is null.

Usage

From source file:com.jstar.eclipse.preferences.PreferenceInitializer.java

public void initializeDefaultPreferences() {
    IPreferenceStore preferences = Activator.getDefault().getPreferenceStore();
    if (SystemUtils.IS_OS_MAC) {
        preferences.setDefault(PreferenceConstants.SOOT_CLASSPATH_CLASSES,
                Utils.getInstance().getClassesJar().getAbsolutePath());
        preferences.setDefault(PreferenceConstants.SOOT_CLASSPATH_UI,
                Utils.getInstance().getUIJar().getAbsolutePath());
    } else {//  w  ww  .  ja  va 2  s  . c  o m
        preferences.setDefault(PreferenceConstants.SOOT_CLASSPATH_RT,
                Utils.getInstance().getRtJar().getAbsolutePath());
    }
}

From source file:com.siemens.oss.omniproperties.builders.Os.java

@Override
public String build() throws IOException {
    if (SystemUtils.IS_OS_LINUX) {
        return "linux";
    } else if (SystemUtils.IS_OS_MAC) {
        return "mac";
    } else if (SystemUtils.IS_OS_WINDOWS) {
        return "windows";
    }/*from  w  ww. ja va  2  s . c  o m*/
    return "unknown";
}

From source file:de.erdesignerng.visual.Java3DUtils.java

public static void initializeLibraryPath() throws Exception {
    File theJava3DFile = new File("java3d");
    File theJava3DLibraryFile = null;
    if (SystemUtils.IS_OS_WINDOWS) {
        if (VM_32_BIT) {
            theJava3DLibraryFile = new File(theJava3DFile, "win32");
        } else {//from  w  w w  . j ava  2  s  . co  m
            theJava3DLibraryFile = new File(theJava3DFile, "win64");
        }
    }
    if (SystemUtils.IS_OS_LINUX) {
        if (VM_32_BIT) {
            theJava3DLibraryFile = new File(theJava3DFile, "linux32");
        } else {
            theJava3DLibraryFile = new File(theJava3DFile, "linux64");
        }
    }
    if (SystemUtils.IS_OS_MAC) {
        theJava3DLibraryFile = new File(theJava3DFile, "macos-universal");
    }
    if (theJava3DLibraryFile != null) {
        addLibraryPath(theJava3DLibraryFile.getAbsolutePath());
    }
}

From source file:com.jstar.eclipse.preferences.JStarPreferencePage.java

public void createFieldEditors() {
    addField(new FileFieldEditor(PreferenceConstants.JSTAR_PATH, "&jStar executable:", getFieldEditorParent()));
    addField(new DirectoryFieldEditor(PreferenceConstants.JSTAR_LOGIC_LIBRARY_PREFERENCE,
            "&jStar Logic Library:", getFieldEditorParent()));
    addField(new DirectoryFieldEditor(PreferenceConstants.JSTAR_ABS_LIBRARY_PREFERENCE, "&jStar Abs Library:",
            getFieldEditorParent()));// w w  w.j a  v a  2  s.c o m
    addField(new DirectoryFieldEditor(PreferenceConstants.JSTAR_SPECS_LIBRARY_PREFERENCE,
            "&jStar Specs Library:", getFieldEditorParent()));

    if (SystemUtils.IS_OS_MAC) {
        addField(new FileFieldEditor(PreferenceConstants.SOOT_CLASSPATH_CLASSES, "&classes.jar:",
                getFieldEditorParent()));
        addField(
                new FileFieldEditor(PreferenceConstants.SOOT_CLASSPATH_UI, "&ui.jar:", getFieldEditorParent()));
    } else {
        addField(
                new FileFieldEditor(PreferenceConstants.SOOT_CLASSPATH_RT, "&rt.jar:", getFieldEditorParent()));
    }

    addField(new FileFieldEditor(PreferenceConstants.SMT_PATH_PREFERENCE, "&smt solver executable:",
            getFieldEditorParent()));
    addField(new StringFieldEditor(PreferenceConstants.SMT_ARGUMENTS_PREFERENCE, "&smt solver arguments:",
            getFieldEditorParent()));

    addField(new BooleanFieldEditor(PreferenceConstants.VERIFY_AFTER_SAVING, "Verify after saving the file",
            getFieldEditorParent()));
}

From source file:musite.MusiteMain.java

private static void setupLookAndFeel() {
    try {/* ww  w .  jav  a 2  s.com*/
        if (SystemUtils.IS_OS_WINDOWS) {
            /*
             * For Windows: just use platform default look & feel.
             */
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } else if (SystemUtils.IS_OS_MAC) {
            /*
             * For Mac: move menue bar to OS X default bar (next to Apple
             * icon)
             */
            System.setProperty("apple.laf.useScreenMenuBar", "true");
        } else {
            /*
             * For Unix platforms, use JGoodies Looks
             */
            UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
            Plastic3DLookAndFeel.set3DEnabled(true);
            Plastic3DLookAndFeel.setCurrentTheme(new com.jgoodies.looks.plastic.theme.SkyBluer());
            Plastic3DLookAndFeel.setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE);
            Plastic3DLookAndFeel.setHighContrastFocusColorsEnabled(true);

            Options.setDefaultIconSize(new Dimension(18, 18));
            Options.setHiResGrayFilterEnabled(true);
            Options.setPopupDropShadowEnabled(true);
            Options.setUseSystemFonts(true);

            UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);
            UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.kurento.test.selenium.MixerTst.java

private WebDriver createDriver(Class<? extends WebDriver> driverClass) {
    WebDriver driver = null;//from   www.  java 2 s .  c o m
    if (driverClass.equals(FirefoxDriver.class)) {
        driver = new FirefoxDriver();

    } else if (driverClass.equals(ChromeDriver.class)) {
        String chromedriver = null;
        if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_LINUX) {
            chromedriver = "chromedriver";
        } else if (SystemUtils.IS_OS_WINDOWS) {
            chromedriver = "chromedriver.exe";
        }
        System.setProperty("webdriver.chrome.driver",
                new File("target/webdriver/" + chromedriver).getAbsolutePath());
        ChromeOptions options = new ChromeOptions();
        driver = new ChromeDriver(options);
    }
    return driver;
}

From source file:com.jstar.eclipse.preferences.PreferenceConstants.java

public static String getSootClassPath() {
    if (SystemUtils.IS_OS_MAC) {
        return getSootClassPathClasses() + File.pathSeparator + getSootClassPathUi();
    } else {/* w  w w. j a  v  a2 s.  c om*/
        return getSootClassPathRt();
    }
}

From source file:com.zilotti.utils.NetworkUtils.java

/**
 * Provides the full path to the hosts file of the current
 * operational system.//from  w  w w.  j  ava 2  s  . co m
 *  
 * @return
 */
public static File getSystemHostsFilePath() {
    if (SystemUtils.IS_OS_LINUX)
        return new File("/etc/hosts");

    if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX)
        return new File("/private/etc/hosts");

    if (SystemUtils.IS_OS_WINDOWS) {
        // TODO: Implement on Windows environment
        File[] roots = FileSystemView.getFileSystemView().getRoots();
        for (File root : roots)
            System.out.println(root.getPath());

        return new File("c:/Windows/system32/drivers/etc/hosts");
    }

    throw new RuntimeException("Operational System not supported: " + System.getProperty("os.name"));
}

From source file:gov.nasa.jpf.symbc.tree.visualizer.DOTVisualizerListener.java

private void outputVisualization(String path) {
    File file = new File(path);
    try {//from   w  w w . j a  va2  s.co m
        FileOutputStream fo = new FileOutputStream(file);
        graph.printGraph(fo);
        fo.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    if (format != OUTPUT_FORMAT.DOT) {
        if ((SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_MAC)) {
            try {
                convertDotFile(file, format);
                file.delete();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:ddf.content.plugin.video.TestVideoThumbnailPlugin.java

private void setUpMockBundleContext() {
    mockBundleContext = mock(BundleContext.class);

    final Bundle mockBundle = mock(Bundle.class);
    doReturn(mockBundle).when(mockBundleContext).getBundle();

    String ffmpegResourcePath;/*from www  . j  ava2  s.c  o  m*/
    URL ffmpegBinaryUrl;

    if (SystemUtils.IS_OS_LINUX) {
        ffmpegResourcePath = "linux/ffmpeg";
    } else if (SystemUtils.IS_OS_MAC) {
        ffmpegResourcePath = "osx/ffmpeg";
    } else if (SystemUtils.IS_OS_WINDOWS) {
        ffmpegResourcePath = "windows/ffmpeg.exe";
    } else if (SystemUtils.IS_OS_SOLARIS) {
        ffmpegResourcePath = "solaris/ffmpeg";
    } else {
        fail("Platform is not Linux, Mac, or Windows. No FFmpeg binaries are provided for this platform.");
        return;
    }

    ffmpegBinaryUrl = getClass().getClassLoader().getResource(ffmpegResourcePath);

    doReturn(ffmpegBinaryUrl).when(mockBundle).getEntry(ffmpegResourcePath);
}