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

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

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

Utilities.isWindows介绍

[英]Test whether NetBeans is running on some variant of Windows.
[中]测试NetBeans是否在某些Windows变体上运行。

代码示例

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

/** Compute the system name of this filesystem for a given root directory.
* <P>
* The default implementation simply returns the filename separated by slashes.
* @see FileSystem#setSystemName
* @param rootFile root directory for the filesystem
* @return system name for the filesystem
*/
protected String computeSystemName(File rootFile) {
  String retVal = rootFile.getAbsolutePath().replace(File.separatorChar, '/');
  return ((Utilities.isWindows() || (Utilities.getOperatingSystem() == Utilities.OS_OS2))) ? retVal.toLowerCase()
                                               : retVal;
}

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

/** @return size of the screen. The size is modified for Windows OS
 * - some points are subtracted to reflect a presence of the taskbar
 *
 * @deprecated this method is almost useless in multiple monitor configuration
 *
 * @see #getUsableScreenBounds()
 * @see #findCenterBounds(Dimension)
 */
@Deprecated
public static Dimension getScreenSize() {
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  if (isWindows() && !Boolean.getBoolean("netbeans.no.taskbar")) {
    screenSize.height -= TYPICAL_WINDOWS_TASKBAR_HEIGHT;
  } else if (isMac()) {
    screenSize.height -= TYPICAL_MACOSX_MENU_HEIGHT;
  }
  return screenSize;
}

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

/** #26521, 114976 - ignore not readable and windows' locked files. */
private static void handleIOException(FileObject fo, IOException ioe) throws IOException {
  if (fo.canRead()) {
    if (!Utilities.isWindows() || !(ioe instanceof FileNotFoundException) || !fo.isValid() || !fo.getName().toLowerCase().contains("ntuser")) {//NOI18N
      throw ioe;
    }
  }
}

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

private static File normalizeFileImpl(File file) {
  // XXX should use NIO in JDK 7; see #6358641
  Parameters.notNull("file", file);  //NOI18N
  File retFile;
  LOG.log(Level.FINE, "FileUtil.normalizeFile for {0}", file); // NOI18N
  long now = System.currentTimeMillis();
  if ((Utilities.isWindows() || (Utilities.getOperatingSystem() == Utilities.OS_OS2))) {
    retFile = normalizeFileOnWindows(file);
  } else if (Utilities.isMac()) {
    retFile = normalizeFileOnMac(file);
  } else {
    retFile = normalizeFileOnUnixAlike(file);
  }
  File ret = (file.getPath().equals(retFile.getPath())) ? file : retFile;
  long took = System.currentTimeMillis() - now;
  if (took > 500) {
    LOG.log(Level.WARNING, "FileUtil.normalizeFile({0}) took {1} ms. Result is {2}", new Object[]{file, took, ret});
  }
  return ret;
}

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

if ((Utilities.isWindows() || (Utilities.getOperatingSystem() == Utilities.OS_OS2)) || Utilities.isMac()) {

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

/**
 * On some platform this method makes a short audible beep, use it when user 
 * tries to invoke an action that's disabled.
 * Some platforms, e.g. MS Windows do not emit any sound in such cases.
 * @since 8.39
 */
public static void disabledActionBeep() {
  if( isWindows() ) {
    //no sound on MS Windows
    return;
  }
  Toolkit.getDefaultToolkit().beep();
}

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

/** @return size of the screen. The size is modified for Windows OS
 * - some points are subtracted to reflect a presence of the taskbar
 *
 * @deprecated this method is almost useless in multiple monitor configuration
 *
 * @see #getUsableScreenBounds()
 * @see #findCenterBounds(Dimension)
 */
@Deprecated
public static Dimension getScreenSize() {
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  if (isWindows() && !Boolean.getBoolean("netbeans.no.taskbar")) {
    screenSize.height -= TYPICAL_WINDOWS_TASKBAR_HEIGHT;
  } else if (isMac()) {
    screenSize.height -= TYPICAL_MACOSX_MENU_HEIGHT;
  }
  return screenSize;
}

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

private File getJavaExecutable() {
  String javaPath = System.getProperty("java.home") + File.separatorChar +
      "bin" + File.separatorChar + (Utilities.isWindows() ? "java.exe" : "java");
  File javaExe = new File(javaPath);
  if(!javaExe.exists()) {
    LOGGER.log(Level.SEVERE, "Unable to locate java executable: " + javaPath);
  }
  return javaExe;
}

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

protected static String quoteExecutable(String orig) {
  StringBuilder sb = new StringBuilder();
  String escapeChars = Utilities.isWindows() ? " \"'()" : " \"'()!"; // NOI18N
  for (char c : orig.toCharArray()) {
    if (escapeChars.indexOf(c) >= 0) { // NOI18N
      sb.append('\\');
    }
    sb.append(c);
  }
  return sb.toString();
}

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

@Override
  protected boolean isWindowsImpl(FileSystem fs) {
    for (CndFileSystemProvider provider : cache) {
      return provider.isWindowsImpl(fs);
    }
    return Utilities.isWindows();
  }        
}

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

@Override
public String toString() {
  String n = getName();
  if (Utilities.isWindows() && n.endsWith(".exe")) { // NOI18N
    return n.substring(0, n.length() - 4);
  } else {
    return n;
  }
}

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

/** Creates a new instance of UEIEmulatorConfigurator */
public UEIEmulatorConfiguratorImpl(String platformPath) {
  this.platformPath = FileUtil.normalizeFile(new File(platformPath)).getPath();
  this.process = platformPath + File.separatorChar + "bin" + File.separatorChar + "emulator"; // NOI18N
  if (Utilities.isWindows())
    this.process += ".exe"; //NOI18N
}

代码示例来源:origin: org.netbeans.api/org-netbeans-spi-quicksearch

static Color getComboBorderColor () {
  Color shadow = UIManager.getColor(
      Utilities.isWindows() ? "Nb.ScrollPane.Border.color" : "TextField.shadow");
  return shadow != null ? shadow : getPopupBorderColor();
}

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

/**
 * On Windows and Mac platforms files are the same if the paths equal with ignored case
 */
private boolean equalPathsIgnoreCase(File srcFile, File dstFile) {
  return Utilities.isWindows() && srcFile.equals(dstFile) || Utilities.isMac() && srcFile.getPath().equalsIgnoreCase(dstFile.getPath());
}

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

/** Compute the system name of this filesystem for a given root directory.
* <P>
* The default implementation simply returns the filename separated by slashes.
* @see FileSystem#setSystemName
* @param rootFile root directory for the filesystem
* @return system name for the filesystem
*/
protected String computeSystemName (File rootFile) {        
  String retVal = rootFile.getAbsolutePath ().replace(File.separatorChar, '/');
  return ((Utilities.isWindows () || (Utilities.getOperatingSystem () == Utilities.OS_OS2))) ? retVal.toLowerCase() : retVal;
}

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

public static Set<File> traverseRegistry() {
  final Set<File> files = new HashSet<File>();
  if (ok && Utilities.isWindows()) {
    traverseRegistry(HKEY_LOCAL_MACHINE, files);
    traverseRegistry(HKEY_CURRENT_USER, files);
  }
  return files;
}

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

/** Creates new form SonyEricssonCustomizerPanel */
public SonyEricssonCustomizerPanel() {
  initComponents();
  if (!Utilities.isWindows()) {
    remove(jButton1);
    lError.setText(NbBundle.getMessage(SonyEricssonCustomizerPanel.class, "ERR_WindowsOnly"));
  } else testSDK();
}

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

private AllLibraryFileFilter() {
  filters.add(ElfStaticLibraryFileFilter.getInstance());
  if (Utilities.isWindows()) {
    filters.add(PeDynamicLibraryFileFilter.getInstance());
    filters.add(PeStaticLibraryFileFilter.getInstance());
  } else if (Utilities.getOperatingSystem() == Utilities.OS_MAC) {
    filters.add(MacOSXDynamicLibraryFileFilter.getInstance());
  } else {
    filters.add(ElfDynamicLibraryFileFilter.getInstance());
  }
}

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

private String getDevNull(ExecutionEnvironment execEnv, CompilerSet compilerSet) {
    if (execEnv.isLocal() && Utilities.isWindows()){
      if (!compilerSet.getCompilerFlavor().isCygwinCompiler()) {
        return "NUL"; // NOI18N
      }
    }
    return "/dev/null"; // NOI18N
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-client-tools-api

private static String[] getLocationsForOS() {
  if (Utilities.isWindows()) { // NOI18N
    return getUserPaths(WIN32_PROFILES_LOCATIONS);
  } else if (Utilities.isMac()) {
    return getUserPaths(MACOSX_PROFILES_LOCATIONS);
  } else {
    // assuming that linux/unix/sunos firefox paths are equivalent
    return getUserPaths(LINUX_PROFILES_LOCATIONS);
  }
}

相关文章

微信公众号

最新文章

更多