org.openide.util.Utilities.isUnix()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.openide.util.Utilities.isUnix()方法的一些代码示例,展示了Utilities.isUnix()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.isUnix()方法的具体详情如下:
包路径:org.openide.util.Utilities
类名称:Utilities
方法名:isUnix

Utilities.isUnix介绍

[英]Test whether NetBeans is running on some variant of Unix. Linux is included as well as the commercial vendors and Mac OS X.
[中]测试NetBeans是否在某些Unix变体上运行。包括Linux,以及商业供应商和Mac OS X。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

private static void dumpFDs() {
  if (Utilities.isUnix()) {
    String selfName = ManagementFactory.getRuntimeMXBean().getName().replaceAll("@.*", ""); // NOI18N
    LOGGER.log(Level.INFO, "Dumping file descriptors for pid {0}", selfName); // NOI18N
    int pid;
    try {
      pid = Integer.parseInt(selfName);
    } catch (NumberFormatException ex) {
      LOGGER.info("Cannot get pid"); // NOI18N
      return;
    }
    File descriptors = new File("/proc/" + pid + "/fd"); // NOI18N
    final File[] arr = descriptors.listFiles();
    String size = arr == null ? "nothing" : (arr.length + " files"); // NOI18N
    LOGGER.log(Level.INFO, "There is {0} in {1}", new Object[]{size, descriptors}); // NOI18N
    if (arr != null) {
      for (File fd : arr) {
        try {
          LOGGER.log(Level.INFO, "{0} -> {1}", new Object[]{fd, fd.getCanonicalFile()}); // NOI18N
        } catch (IOException ex) {
          LOGGER.log(Level.INFO, "{0}", fd); // NOI18N
        }
      }
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-util

} else if (isUnix()) {
  image = ImageUtilities.loadImage("org/openide/util/progress-cursor-motif.gif"); //NOI18N

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

} else if (isUnix()) {
  image = ImageUtilities.loadImage("org/openide/util/progress-cursor-motif.gif"); //NOI18N

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils

public static String naturalizeSlashes(String path) {
  if (Utilities.isUnix()) {
    return path.replace('\\', '/'); // NOI18N
  } else if (Utilities.isWindows()) {
    return path.replace('/', '\\'); // NOI18N
  } else {
    return path;
  }
}

代码示例来源:origin: org.gephi/desktop-branding

private boolean isDebug() {
  String homePath;
  if (Utilities.isMac() || Utilities.isUnix()) {
    homePath = System.getProperty("netbeans.home");
  } else {
    homePath = System.getProperty("user.dir");
  }
  //When launched within Netbeans
  if (homePath.contains("NetBeans")) {
    return true;
  }
  return false;
}

代码示例来源:origin: org.gephi/desktop-branding

private boolean canRestart() {
  return !Utilities.isMac() && !Utilities.isUnix();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial

/**
 * Return the path for the user command lines configuration directory 
 */
private static String getUserConfigPath() {        
  if(Utilities.isUnix()) {
    String path = System.getProperty("user.home") ;                     // NOI18N
    return path + "/.";                                // NOI18N
  } else if (Utilities.isWindows()){
    String userConfigPath = getUSERPROFILE();
    return userConfigPath.equals("")? "":  userConfigPath + File.separator; // NOI18N 
  } 
  return "";                                                              // NOI18N
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial

/**
 * Return the path for the systemwide command lines configuration directory 
 */
private static String getGlobalConfigPath () {
  if(Utilities.isUnix()) {
    return "/etc/mercurial";               // NOI18N
  } else if (Utilities.isWindows()){
    // <Mercurial Install>\Mercurial.ini
    String mercurialPath = HgModuleConfig.getDefault().getExecutableBinaryPath ();
    if(mercurialPath != null && !mercurialPath.equals("")){
      File ini = new File(mercurialPath, WINDOWS_HG_RC_FILE);
      if(ini != null && ini.exists() && ini.canRead()){
        return ini.getParentFile().getAbsolutePath();
      }
    }
    // C:\Mercurial\Mercurial.ini
    File ini = new File(WINDOWS_DEFAULT_MECURIAL_INI_PATH);// NOI18N
    if(ini != null && ini.exists() && ini.canRead()){
        return ini.getParentFile().getAbsolutePath();                
    }        
  } 
  return "";                                  // NOI18N
}

代码示例来源:origin: org.gephi/desktop-branding

if (Utilities.isMac() || Utilities.isUnix()) {
  homePath = System.getProperty("netbeans.home");
} else {

代码示例来源:origin: dcaoyuan/nbscala

if (Utilities.isUnix() && propertiesToFix.contains (key)) {
  try {
    String[] pathElements = value.split(File.pathSeparator);

代码示例来源:origin: org.gephi/desktop-branding

private void setLanguage(Language language) throws Exception {
  String homePath;
  if (Utilities.isMac() || Utilities.isUnix()) {
    homePath = System.getProperty("netbeans.home");
  } else {

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project

private SshFiles getDefaultSshFiles() {
  if (Utilities.isWindows()) {
    return getDefaultWindowsSshFiles();
  } else if (Utilities.isUnix()) {
    return getDefaultUnixSshFiles();
  }
  return UNKNOWN_SSH_FILES;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-libs-svnClientAdapter-javahl

private void presetJavahl() {
  if(Utilities.isUnix() && !Utilities.isMac() ) { // javahl for mac is already bundled
    presetJavahlUnix();
  } else if(Utilities.isWindows()) {
    presetJavahlWindows();
  }
}

代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-licensepanel

if (Utilities.isMac() || Utilities.isUnix()) // On Windows the license is shown by the installer

代码示例来源:origin: dcaoyuan/nbscala

private boolean isPlatformDir ( File f ) {
  //XXX: Workaround of hard NFS mounts on Solaris.
  final int osId = Utilities.getOperatingSystem();
  if (osId == Utilities.OS_SOLARIS || osId == Utilities.OS_SUNOS) {
    return false;
  }
  FileObject fo = (f != null) ? convertToValidDir(f) : null;
  if (fo != null) {
    //XXX: Workaround of /net folder on Unix, the folders in the root are not badged as platforms.
    // User can still select them.
    try {
      if (Utilities.isUnix() && (fo.getParent() == null || fo.getFileSystem().getRoot().equals(fo.getParent()))) {
        return false;
      }
    } catch (FileStateInvalidException e) {
      return false;
    }
    if (this.platformInstall.accept(fo)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: in.jlibs/org-openide-util

} else if (isUnix()) {
  image = loadImage("org/openide/util/progress-cursor-motif.gif"); //NOI18N

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

image = loadImage("org/openide/resources/progress-cursor-mac.gif");    //NOI18N
else if (isUnix()) {
  image = loadImage("org/openide/resources/progress-cursor-motif.gif");    //NOI18N

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-platform-ui

private boolean isPlatformDir ( File f ) {
  //XXX: Workaround of hard NFS mounts on Solaris.
  final int osId = Utilities.getOperatingSystem();
  if (osId == Utilities.OS_SOLARIS || osId == Utilities.OS_SUNOS) {
    return false;
  }
  FileObject fo = (f != null) ? convertToValidDir(f) : null;
  if (fo != null) {
    //XXX: Workaround of /net folder on Unix, the folders in the root are not badged as platforms.
    // User can still select them.
    try {
      if (Utilities.isUnix() && (fo.getParent() == null || fo.getFileSystem().getRoot().equals(fo.getParent()))) {
        return false;
      }
    } catch (FileStateInvalidException e) {
      return false;
    }
    if (this.platformInstall.accept(fo)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mobility-cldcplatform

private boolean isPlatformDir(File f) {
  //XXX: Workaround of hard NFS mounts on Solaris.
  final int osId = Utilities.getOperatingSystem();
  if (osId == Utilities.OS_SOLARIS || osId == Utilities.OS_SUNOS) {
    return false;
  }
  FileObject fo = (f != null) ? convertToValidDir(f) : null;
  if (fo != null) {
    //XXX: Workaround of /net folder on Unix, the folders in the root are not badged as platforms.
    // User can still select them.
    try {
      if (Utilities.isUnix() && (fo.getParent() == null ||
        fo.getFileSystem().getRoot().equals(fo.getParent()))) {
        return false;
      }
    } catch (FileStateInvalidException e) {
      return false;
    }
    return isPossibleJ2MEPlatform(FileUtil.toFile(fo));
  }
  return false;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project

/**
 * Get the OS dependent PHP environment.
 * @return the OS dependent PHP environment.
 */
public static PhpEnvironment get() {
  if (isSolaris()) {
    return new SolarisPhpEnvironment();
  } else if (Utilities.isWindows()) {
    return new WindowsPhpEnvironment();
  } else if (Utilities.isMac()) {
    return new MacPhpEnvironment();
  } else if (Utilities.isUnix()) {
    return new UnixPhpEnvironment();
  }
  return UNKNOWN_PHP_ENVIRONMENT;
}

相关文章

微信公众号

最新文章

更多