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


Java SystemUtils.IS_OS_MAC屬性代碼示例

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


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

示例1: setNodeHeight

/**
 * Sets the node height used for drawing.
 * <p>
 * Also updates the font size used for drawing sequences within nodes.
 *
 * @param nodeHeight the node height
 */
public final void setNodeHeight(final double nodeHeight) {
    this.nodeHeight = nodeHeight;
    this.snpHeight = nodeHeight * SNP_HEIGHT_FACTOR;

    final Text text = new Text("X");
    text.setFont(new Font(DEFAULT_NODE_FONT, 1));

    final double font1PHeight = text.getLayoutBounds().getHeight();

    final String font;

    if (SystemUtils.IS_OS_MAC) {
        font = DEFAULT_MAC_NODE_FONT;
    } else {
        font = DEFAULT_NODE_FONT;
    }

    final double fontSize = DEFAULT_NODE_FONT_HEIGHT_SCALAR * nodeHeight / font1PHeight;
    this.nodeFont = new Font(font, fontSize);
    text.setFont(nodeFont);

    this.charWidth = text.getLayoutBounds().getWidth();
    this.charHeight = text.getLayoutBounds().getHeight();
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:31,代碼來源:NodeDrawingToolkit.java

示例2: init

@PostConstruct
public void init() {

	if (SystemUtils.IS_OS_LINUX) {
		usersPath = environment.getProperty("image.path.linux.users");
		formsPath = environment.getProperty("image.path.linux.forms");

	} else if (SystemUtils.IS_OS_MAC) {
		usersPath = environment.getProperty("image.path.mac.users");
		formsPath = environment.getProperty("image.path.mac.forms");

	} else if (SystemUtils.IS_OS_WINDOWS) {
		usersPath = environment.getProperty("image.path.windows.users");
		formsPath = environment.getProperty("image.path.windows.forms");
	}

	userContext = environment.getProperty("image.context.user");
	formContext = environment.getProperty("image.context.form");
}
 
開發者ID:edylle,項目名稱:pathological-reports,代碼行數:19,代碼來源:ImagePathProperties.java

示例3: getSteamDir

public static File getSteamDir() throws RegistryException, IOException {
    if (null == steamDir) {
        if(SystemUtils.IS_OS_WINDOWS) {
            steamDir = test(new File(WindowsRegistry.getInstance().readString(HKey.HKCU, "Software\\Valve\\Steam", "SteamPath")));
        } else if(SystemUtils.IS_OS_MAC) {
            steamDir = test(new File(SystemUtils.getUserHome()+"/Library/Application Support/Steam"));
        } else if(SystemUtils.IS_OS_LINUX) {
            ArrayList<File> fl = new ArrayList<>();
            fl.add(new File(SystemUtils.getUserHome()+"/.steam/steam"));
            fl.add(new File(SystemUtils.getUserHome()+"/.steam/Steam"));
            fl.add(new File(SystemUtils.getUserHome()+"/.local/share/steam"));
            fl.add(new File(SystemUtils.getUserHome()+"/.local/share/Steam"));
            steamDir = test(fl);
        }
    }
    return steamDir;
}
 
開發者ID:Idrinths-Stellaris-Mods,項目名稱:Mod-Tools,代碼行數:17,代碼來源:DirectoryLookup.java

示例4: getConfigBasePathForAll

/**
 * 獲得全平台的基礎路徑<br>
 * 真正的跨平台!
 * @author Administrator
 * @return
 */
public static String getConfigBasePathForAll()
{
    String ret = "";
    //根據操作係統決定真正的配置路徑
    if (SystemUtils.IS_OS_WINDOWS)
    {
        ret = FileKit.getMyConfigBasePathForWindows();
    }
    else if (SystemUtils.IS_OS_LINUX)
    {
        ret = CONFIG_BASEPATH_LINUX;
    }
    else if (SystemUtils.IS_OS_MAC)
    {
        ret = CONFIG_BASEPATH_MAC;
    }
    else
    {
        //其他情況下,都是類Unix的係統,因此均采用Linux的路徑設置
        ret = CONFIG_BASEPATH_LINUX;
    }
    return ret;
}
 
開發者ID:lnwazg,項目名稱:kit,代碼行數:29,代碼來源:FileKit.java

示例5: getEditor

public String[] getEditor() {
    if (StringUtils.isEmpty(this.editor)) {
        if (SystemUtils.IS_OS_WINDOWS) {
            return new String[]{"notepad.exe"};
        }
        if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) {
            return new String[]{"vim"};
        }
        return new String[]{"vim"};
    } else {
        return BashUtils.parseArguments(this.editor);
    }
}
 
開發者ID:avast,項目名稱:hdfs-shell,代碼行數:13,代碼來源:EditCommands.java

示例6: fillOS

private static String fillOS(){
    String os = null;
    if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) os = "mac";
    else if (SystemUtils.IS_OS_UNIX) os = "linux";
    else if (SystemUtils.IS_OS_WINDOWS) os = "windows";

    return os;
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:8,代碼來源:DefaultTagsListeners.java

示例7: updateStage

public static void updateStage(){
	String mode = Main.getProperties().getString("character.layer_mode");
	if(mode == null){
		if(SystemUtils.IS_OS_MAC) mode = "SEPARATE";
		else mode = "ALWAYS_TOP";
	}
	updateStage(mode);
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:8,代碼來源:OverlayStage.java

示例8: getModDir

public static File getModDir() throws IOException {
    if (null == modDir) {
        if(SystemUtils.IS_OS_WINDOWS) {
            modDir = test(new File(SystemUtils.getUserHome() + "\\Documents\\Paradox Interactive\\Stellaris\\mod"));
        } else if(SystemUtils.IS_OS_MAC) {
            modDir = test(new File(SystemUtils.getUserHome() + "/Documents/Paradox Interactive/Stellaris/mod"));
        } else if(SystemUtils.IS_OS_LINUX) {
            modDir = test(new File(SystemUtils.getUserHome() + "/.local/share/Paradox Interactive/Stellaris/mod"));
        }
    }
    return modDir;
}
 
開發者ID:Idrinths-Stellaris-Mods,項目名稱:Mod-Tools,代碼行數:12,代碼來源:DirectoryLookup.java

示例9: updatePath

private static void updatePath() {
    if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_LINUX) {
        Map<String, String> env = System.getenv();
        String path = env.get("PATH");
        Map<String, String> envNew = new HashMap<>(env);
        envNew.put("PATH", path + ":/usr/local/bin");
        try {
            Utils.setEnv(envNew);
        } catch (Exception ex) {
            throw new EntityCommunicationException(ex);
        }
    }
}
 
開發者ID:tascape,項目名稱:reactor,代碼行數:13,代碼來源:Reactor.java

示例10: capture

public static BufferedImage capture(int width, int height, Consumer<Graphics2D> painter)
        throws Exception {
    JFrame[] f = new JFrame[1];
    Point[] p = new Point[1];
    SwingUtilities.invokeAndWait(() -> {
        f[0] = new JFrame();

        JComponent c = new MyComponent(painter);

        f[0].add(c);
        c.setSize(width + 10, height + 10);
        f[0].setSize(width + 100, height + 100); // giving some space
        // for frame border effects,
        // e.g. rounded frame
        c.setLocation(50, 50);
        f[0].setVisible(true);
        p[0] = c.getLocationOnScreen();
    });

    Rectangle screenRect;
    Robot r = new Robot();
    while (!Color.black.equals(r.getPixelColor(p[0].x, p[0].y))) {
        Thread.sleep(100);
    }
    screenRect = new Rectangle(p[0].x + 5, p[0].y + 5, width, height);

    BufferedImage result = SystemUtils.IS_OS_MAC ?
            captureScreen(f[0], screenRect) : r.createScreenCapture(screenRect);
    SwingUtilities.invokeAndWait(f[0]::dispose);
    return result;
}
 
開發者ID:JetBrains,項目名稱:jdk8u_jdk,代碼行數:31,代碼來源:RenderUtil.java

示例11: getRecorder

public static IVideoRecorder getRecorder(RecorderType recorderType) {
    if (recorderType.equals(RecorderType.FFMPEG)) {
        if (SystemUtils.IS_OS_WINDOWS) {
            return new WindowsFFmpegRecorder();
        } else if (SystemUtils.IS_OS_MAC) {
            return new MacFFmpegRecorder();
        }
        return new LinuxFFmpegRecorder();
    }
    return new MonteRecorder();
}
 
開發者ID:SergeyPirogov,項目名稱:video-recorder-java,代碼行數:11,代碼來源:RecorderFactory.java

示例12: getURL

private static URL getURL(String version) {
  StringBuilder url = new StringBuilder();
  url.append("https://releases.hashicorp.com/vault/").append(version).append("/vault_").append(version).append("_");

  if (SystemUtils.IS_OS_MAC) {
    url.append("darwin_");
  } else if (SystemUtils.IS_OS_LINUX) {
    url.append("linux_");
  }  else if (SystemUtils.IS_OS_WINDOWS) {
    url.append("windows_");
  } else {
    throw new IllegalStateException("Unsupported operating system");
  }

  if (ArchUtils.getProcessor().is64Bit()) {
    url.append("amd64.zip");
  } else {
    url.append("386.zip");
  }

  System.out.println("Downloading " + url.toString());
  try {
    return new URL(url.toString());
  } catch (Exception e) {
    throw new RuntimeException(e);
  }

}
 
開發者ID:vert-x3,項目名稱:vertx-config,代碼行數:28,代碼來源:VaultDownloader.java

示例13: DockerComposeRuntime

public DockerComposeRuntime(Carnotzet carnotzet, String instanceId, CommandRunner commandRunner) {
	// Due to limitations in docker for mac and windows, mapping local ports to container ports is the preferred technique for those users.
	// https://docs.docker.com/docker-for-mac/networking/#i-cannot-ping-my-containers
	this(carnotzet, instanceId, commandRunner, SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_WINDOWS);
}
 
開發者ID:swissquote,項目名稱:carnotzet,代碼行數:5,代碼來源:DockerComposeRuntime.java

示例14: ChromeWebDriverFactory

public ChromeWebDriverFactory() {
  super( //
      BrowserType.CHROME, //
      (targetDirectory) -> {
        final String extension = getExecutableExtension(true);
        final Pattern executablePattern =
            Pattern.compile("chromedriver-(?<version>.*)" + extension);
        final File[] files =
            targetDirectory.listFiles(new PatternFilenameFilter(executablePattern));
        if (files == null || files.length != 1) {
          return Optional.empty();
        }
        final File executable = files[0];
        final Matcher executableMatcher = executablePattern.matcher(executable.getName());
        if (!executableMatcher.find()) {
          throw new IllegalStateException(
              String.format("Unable to determine version of executable %s", executable));
        }
        final String version = executableMatcher.group("version");
        return Optional
            .of(new DownloadWebDriverExecutable.WebDriverExecutable(executable, version));
      }, //
      () -> getString(LATEST_RELEASE_URL), //
      (version, targetDirectory) -> {
        final String system;
        if (SystemUtils.IS_OS_WINDOWS) {
          system = "win32";
        } else if (SystemUtils.IS_OS_MAC) {
          system = "mac64";
        } else if (SystemUtils.IS_OS_LINUX) {
          final StringBuilder linuxBuilder = new StringBuilder("linux");
          // TODO this property does not reflect the OS architecture, it is the VM`s "bitness"
          if (SystemUtils.OS_ARCH.contains("64")) {
            linuxBuilder.append("64");
          } else {
            linuxBuilder.append("32");
          }
          system = linuxBuilder.toString();
        } else {
          throw new UnsupportedOperationException(
              String.format("Unsupported operation system: %s %s", SystemUtils.OS_NAME,
                  SystemUtils.OS_VERSION));
        }
        LOGGER.debug("System '{}' detected.", system);
        final String downloadUrl =
            DOWNLOAD_URL + String.format("/%s/chromedriver_%s.zip", version, system);
        LOGGER.debug("Download chromedriver from {}", downloadUrl);
        downloadZipAndExtract(downloadUrl, targetDirectory);
        final File chromeDriverFile = new File(targetDirectory,
            String.format("chromedriver%s", getExecutableExtension(false)));
        final File chromeDriverFileWithVersion = new File(targetDirectory,
            String.format("chromedriver-%s%s", version, getExecutableExtension(false)));
        if (!chromeDriverFile.renameTo(chromeDriverFileWithVersion)) {
          throw new RuntimeException();
        }
        if (!chromeDriverFileWithVersion.setExecutable(true, false)) {
          throw new RuntimeException();
        }
        return new DownloadWebDriverExecutable.WebDriverExecutable(chromeDriverFileWithVersion,
            version);
      }, //
      ChromeDriverService.CHROME_DRIVER_EXE_PROPERTY //
  );
}
 
開發者ID:klaushauschild1984,項目名稱:selenium-toys,代碼行數:64,代碼來源:ChromeWebDriverFactory.java

示例15: newWebDriver

/**
 * Construct the {@link WebDriver} instance to be used.
 *
 * @param browser The web browser to use.
 */
private static WebDriver newWebDriver(final Browser browser) {
    final String driver, os;

    // Determine driver
    switch (browser) {
        case FIREFOX:
            driver = "gecko";
            break;
        case CHROME:
            driver = "chrome";
            break;
        default:
            throw new IllegalArgumentException("Invalid browser: " + browser);
    }

    // Determine os
    if (SystemUtils.IS_OS_WINDOWS) {
        os = "win.exe";
    } else if (SystemUtils.IS_OS_MAC) {
        os = "mac";
    } else if (SystemUtils.IS_OS_LINUX) {
        os = "linux";
    } else {
        throw new UnsupportedOperationException("Unsupported OS: " + SystemUtils.OS_NAME);
    }

    // Install driver file into temp directory
    InputStream src = null;
    OutputStream dest = null;
    try {
        // Create temp file
        File tmp = FB2GHUtils.createTempFile(driver + "driver-" + os);

        // Initialize streams
        src = GHAttachmentUploader.class.getResourceAsStream(driver + "driver-" + os);
        dest = new FileOutputStream(tmp);

        // Copy driver to temp file
        IOUtils.copy(src, dest);
        if (!tmp.setExecutable(true)) {
            logger.warn("Failed to set access permissions of file: {}", tmp);
        }

        // Set driver property
        String key = "webdriver." + driver + ".driver";
        String value = URLDecoder.decode(tmp.getAbsolutePath(), "UTF-8");
        System.setProperty(key, value);
        logger.info("System property '{}' was set to '{}'.", key, value);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    } finally {
        IOUtils.closeQuietly(src);
        IOUtils.closeQuietly(dest);
    }

    // Return WebDriver
    switch (browser) {
        case FIREFOX:
            return new FirefoxDriver();
        case CHROME:
            return new ChromeDriver();
        default:
            throw new IllegalArgumentException("Invalid browser: " + browser);
    }
}
 
開發者ID:sudiamanj,項目名稱:fogbugz-to-github,代碼行數:70,代碼來源:GHAttachmentUploader.java


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