当前位置: 首页>>代码示例>>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;未经允许,请勿转载。