当前位置: 首页>>代码示例>>Java>>正文


Java SystemInfo.isLinux方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.SystemInfo.isLinux方法的典型用法代码示例。如果您正苦于以下问题:Java SystemInfo.isLinux方法的具体用法?Java SystemInfo.isLinux怎么用?Java SystemInfo.isLinux使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.SystemInfo的用法示例。


在下文中一共展示了SystemInfo.isLinux方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: focusOnIdeFrame

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private void focusOnIdeFrame(@Nullable JFrame ideFrame) {
    if (ideFrame != null) {
        if (SystemInfo.isLinux) {
            if (!ideFrame.isFocused()) {
                ideFrame.toFront();
                ideFrame.requestFocus();
            }
        } else {
            ideFrame.requestFocus();
        }
        if (sourceComponent != null) {
            sourceComponent.requestFocusInWindow();
        }
        try {
            Thread.sleep(200);
        } catch (InterruptedException e) {
            // Ignore
        }
    }
}
 
开发者ID:dyadix,项目名称:typengo,代码行数:21,代码来源:CommandInputForm.java

示例2: testWatchRootRecreation

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public void testWatchRootRecreation() throws Exception {
  File rootDir = createTestDir(myTempDirectory, "root");
  File file1 = createTestFile(rootDir, "file1.txt", "abc");
  File file2 = createTestFile(rootDir, "file2.txt", "123");
  refresh(rootDir);

  LocalFileSystem.WatchRequest request = watch(rootDir);
  try {
    myAccept = true;
    assertTrue(FileUtil.delete(rootDir));
    assertTrue(rootDir.mkdir());
    if (SystemInfo.isLinux) TimeoutUtil.sleep(1500);  // implementation specific
    assertTrue(file1.createNewFile());
    assertTrue(file2.createNewFile());
    assertEvent(VFileContentChangeEvent.class, file1.getPath(), file2.getPath());
  }
  finally {
    unwatch(request);
    delete(rootDir);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:FileWatcherTest.java

示例3: getAttributes

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
protected FileAttributes getAttributes(@NotNull String path) throws Exception {
  Memory buffer = new Memory(256);
  int res = SystemInfo.isLinux ? myLibC.__lxstat64(STAT_VER, path, buffer) : myLibC.lstat(path, buffer);
  if (res != 0) return null;

  int mode = getModeFlags(buffer) & LibC.S_MASK;
  boolean isSymlink = (mode & LibC.S_IFMT) == LibC.S_IFLNK;
  if (isSymlink) {
    if (!loadFileStatus(path, buffer)) {
      return FileAttributes.BROKEN_SYMLINK;
    }
    mode = getModeFlags(buffer) & LibC.S_MASK;
  }

  boolean isDirectory = (mode & LibC.S_IFMT) == LibC.S_IFDIR;
  boolean isSpecial = !isDirectory && (mode & LibC.S_IFMT) != LibC.S_IFREG;
  long size = buffer.getLong(myOffsets[OFF_SIZE]);
  long mTime1 = SystemInfo.is32Bit ? buffer.getInt(myOffsets[OFF_TIME]) : buffer.getLong(myOffsets[OFF_TIME]);
  long mTime2 = myCoarseTs ? 0 : SystemInfo.is32Bit ? buffer.getInt(myOffsets[OFF_TIME] + 4) : buffer.getLong(myOffsets[OFF_TIME] + 8);
  long mTime = mTime1 * 1000 + mTime2 / 1000000;

  boolean writable = ownFile(buffer) ? (mode & LibC.WRITE_MASK) != 0 : myLibC.access(path, LibC.W_OK) == 0;

  return new FileAttributes(isDirectory, isSpecial, isSymlink, false, size, mTime, writable);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:FileSystemUtil.java

示例4: setScaleFactor

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public static void setScaleFactor(float scale) {
  if (SystemProperties.has("hidpi") && !SystemProperties.is("hidpi")) {
    return;
  }

  if (scale < 1.25f) scale = 1.0f;
  else if (scale < 1.5f) scale = 1.25f;
  else if (scale < 1.75f) scale = 1.5f;
  else if (scale < 2f) scale = 1.75f;
  else scale = 2.0f;

  if (SystemInfo.isLinux && scale == 1.25f) {
    //Default UI font size for Unity and Gnome is 15. Scaling factor 1.25f works badly on Linux
    scale = 1f;
  }
  SCALE_FACTOR = scale;
  IconLoader.setScale(scale);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JBUI.java

示例5: findErrorSolution

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Nullable
private static String findErrorSolution(@NotNull PyExecutionException e, @Nullable String cause, @Nullable Sdk sdk) {
  if (cause != null) {
    if (StringUtil.containsIgnoreCase(cause, "SyntaxError")) {
      final LanguageLevel languageLevel = PythonSdkType.getLanguageLevelForSdk(sdk);
      return "Make sure that you use a version of Python supported by this package. Currently you are using Python " +
             languageLevel + ".";
    }
  }

  if (SystemInfo.isLinux && (containsInOutput(e, "pyconfig.h") || containsInOutput(e, "Python.h"))) {
    return "Make sure that you have installed Python development packages for your operating system.";
  }

  if ("pip".equals(e.getCommand()) && sdk != null) {
    return "Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' " +
           "installed for your Python interpreter located at '" + sdk.getHomePath() + "'.";
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PyPackageManagementService.java

示例6: getLinkText

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private static String getLinkText() {
  // TODO ARM support?
  if (SystemInfo.isMac) {
    return "Mac OS X x64";
  }
  else if (SystemInfo.isLinux) {
    return SystemInfo.is32Bit ? "Linux x86" : "Linux x64";
  }
  else if (SystemInfo.isWindows) {
    return SystemInfo.is32Bit ? "Windows x86" : "Windows x64";
  }
  else {
    return SystemInfo.OS_NAME;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:JdkLocationStep.java

示例7: getExecutableName

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Nullable
private static String getExecutableName(final boolean withSubDir) {
  if (SystemInfo.isWindows) return (withSubDir ? "win" + File.separator : "") + (SystemInfo.isAMD64 ? "fsnotifier64.exe" : "fsnotifier.exe");
  if (SystemInfo.isMac) return (withSubDir ? "mac" + File.separator : "") + "fsnotifier";
  if (SystemInfo.isLinux) return (withSubDir ? "linux" + File.separator : "") +
                                 ("arm".equals(SystemInfo.OS_ARCH) ? (SystemInfo.is32Bit ? "fsnotifier-arm" : null)
                                                                   : (SystemInfo.isAMD64 ? "fsnotifier64" : "fsnotifier"));
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:NativeFileWatcherImpl.java

示例8: Splash

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public Splash(String imageName, final Color textColor) {
  super((Frame)null, false);

  setUndecorated(true);
  if (!(SystemInfo.isLinux && SystemInfo.isJavaVersionAtLeast("1.7"))) {
    setResizable(false);
  }
  setFocusableWindowState(false);

  Icon originalImage = IconLoader.getIcon(imageName);
  myImage = new SplashImage(originalImage, textColor);
  myLabel = new JLabel(myImage) {
    @Override
    protected void paintComponent(Graphics g) {
      super.paintComponent(g);
      mySplashIsVisible = true;
      myProgressLastPosition = 0;
      paintProgress(g);
    }
  };
  Container contentPane = getContentPane();
  contentPane.setLayout(new BorderLayout());
  contentPane.add(myLabel, BorderLayout.CENTER);
  Dimension size = getPreferredSize();
  setSize(size);
  pack();
  setLocationInTheCenterOfScreen();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:Splash.java

示例9: getMessage

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public static String getMessage(final NativeLogReader.CallInfo callInfo) {
  if (SystemInfo.isMac) {
    return forMac(callInfo);
  }
  if (SystemInfo.isWindows) {
    return forWindows(callInfo);
  }
  if (SystemInfo.isLinux) {
    return forLinux(callInfo);
  }
  // no assumptions on expected result code
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:SvnNativeCallsTranslator.java

示例10: DarculaLaf

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public DarculaLaf() {
  try {
    if (SystemInfo.isWindows || SystemInfo.isLinux) {
      base = new IdeaLaf();
    } else {
      final String name = UIManager.getSystemLookAndFeelClassName();
      base = (BasicLookAndFeel)Class.forName(name).newInstance();
    }
  }
  catch (Exception e) {
    log(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DarculaLaf.java

示例11: JnaUnixMediatorImpl

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private JnaUnixMediatorImpl() throws Exception {
  if (SystemInfo.isLinux) {
    if ("arm".equals(SystemInfo.OS_ARCH)) {
      if (SystemInfo.is32Bit) {
        myOffsets = LINUX_ARM;
      } else {
        throw new IllegalStateException("AArch64 architecture is not supported");
      }
    }
    else if ("ppc".equals(SystemInfo.OS_ARCH)) {
      myOffsets = SystemInfo.is32Bit ? LNX_PPC32 : LNX_PPC64;
    }
    else {
      myOffsets = SystemInfo.is32Bit ? LINUX_32 : LINUX_64;
    }
  }
  else if (SystemInfo.isMac | SystemInfo.isFreeBSD) {
    myOffsets = SystemInfo.is32Bit ? BSD_32 : BSD_64;
  }
  else if (SystemInfo.isSolaris) {
    myOffsets = SystemInfo.is32Bit ? SUN_OS_32 : SUN_OS_64;
  }
  else {
    throw new IllegalStateException("Unsupported OS/arch: " + SystemInfo.OS_NAME + "/" + SystemInfo.OS_ARCH);
  }

  myLibC = (LibC)Native.loadLibrary("c", LibC.class);
  myUid = myLibC.getuid();
  myGid = myLibC.getgid();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:FileSystemUtil.java

示例12: init

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
protected void init() {
  boolean createAvd = myMode.shouldCreateAvd();
  if (myMode == FirstRunWizardMode.NEW_INSTALL) {
    addStep(new InstallationTypeWizardStep(KEY_CUSTOM_INSTALL));
  }
  addStep(new SelectThemeStep(KEY_CUSTOM_INSTALL));
  String pathString = mySdkLocation.getAbsolutePath();
  myState.put(KEY_SDK_INSTALL_LOCATION, pathString);

  myComponentTree = createComponentTree(myMode, myState, createAvd);
  myComponentTree.init(myProgressStep);
  mySdkComponentsStep = new SdkComponentsStep(myComponentTree, KEY_CUSTOM_INSTALL, KEY_SDK_INSTALL_LOCATION, myMode);
  addStep(mySdkComponentsStep);

  SdkManager manager = SdkManager.createManager(pathString, new NullLogger());
  myComponentTree.init(myProgressStep);
  myComponentTree.updateState(manager);
  for (DynamicWizardStep step : myComponentTree.createSteps()) {
    addStep(step);
  }
  if (SystemInfo.isLinux && myMode != FirstRunWizardMode.INSTALL_HANDOFF) {
    addStep(new LinuxHaxmInfoStep());
  }
  if (myMode != FirstRunWizardMode.INSTALL_HANDOFF) {
    addStep(new InstallSummaryStep(KEY_CUSTOM_INSTALL, KEY_SDK_INSTALL_LOCATION, new Supplier<Collection<RemotePkgInfo>>() {
      @Override
      public Collection<RemotePkgInfo> get() {
        return myComponentInstaller.getPackagesToInstallInfos(myState.get(KEY_SDK_INSTALL_LOCATION), myComponentTree.getChildrenToInstall());
      }
    }));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:InstallComponentsPath.java

示例13: calculateScaleFactor

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private static float calculateScaleFactor() {
  if (SystemInfo.isMac) {
    return 1.0f;
  }

  if (SystemProperties.has("hidpi") && !SystemProperties.is("hidpi")) {
    return 1.0f;
  }

  if (SystemInfo.isLinux) {
    final int dpi = getSystemDPI();
    if (dpi < 120) return 1f;
    if (dpi < 144) return 1.25f;
    if (dpi < 168) return 1.5f;
    if (dpi < 192) return 1.75f;
    return 2f;
  }

  int size = -1;
  try {
    if (SystemInfo.isWindows) {
      size = (Integer)Toolkit.getDefaultToolkit().getDesktopProperty("win.system.font.height");
    }
  } catch (Exception e) {//
  }
  if (size == -1) {
    size = Fonts.label().getSize();
  }
  if (size <= 13) return 1.0f;
  if (size <= 16) return 1.25f;
  if (size <= 18) return 1.5f;
  if (size < 24)  return 1.75f;

  return 2.0f;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:JBUI.java

示例14: getSdkDownloadUrl

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
/**
 * @return URL for the Android SDK download for the current platform, or {@code null} if the platform was not recognized.
 */
@Nullable
public static String getSdkDownloadUrl() {
  if (SystemInfo.isLinux) {
    return "https://dl.google.com/android/android-sdk_r22.6.2-linux.tgz";
  }
  else if (SystemInfo.isWindows) {
    return "https://dl.google.com/android/android-sdk_r22.6.2-windows.zip";
  }
  else if (SystemInfo.isMac) {
    return "https://dl.google.com/android/android-sdk_r22.6.2-macosx.zip";
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AndroidSdkUtils.java

示例15: createNewLibrary

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, VirtualFile contextDirectory) {
  VirtualFile initial = findFile(System.getenv(myEnvVariable));
  if (initial == null && GROOVY_FRAMEWORK_NAME.equals(myFrameworkName) && SystemInfo.isLinux) {
    initial = findFile("/usr/share/groovy");
  }

  final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false) {
    @Override
    public boolean isFileSelectable(VirtualFile file) {
      if (!super.isFileSelectable(file)) {
        return false;
      }
      return findManager(file) != null;
    }
  };
  descriptor.setTitle(myFrameworkName + " SDK");
  descriptor.setDescription("Choose a directory containing " + myFrameworkName + " distribution");
  final VirtualFile dir = FileChooser.chooseFile(descriptor, parentComponent, null, initial);
  if (dir == null) return null;

  final GroovyLibraryPresentationProviderBase provider = findManager(dir);
  if (provider == null) {
    return null;
  }

  final String path = dir.getPath();
  final String sdkVersion = provider.getSDKVersion(path);
  if (AbstractConfigUtils.UNDEFINED_VERSION.equals(sdkVersion)) {
    Messages.showErrorDialog(parentComponent,
                             "Looks like " + myFrameworkName + " distribution in specified path is broken. Cannot determine version.",
                             "Failed to Create Library");
    return null;
  }

  return new NewLibraryConfiguration(provider.getLibraryPrefix() + "-" + sdkVersion) {
    @Override
    public void addRoots(@NotNull LibraryEditor editor) {
      provider.fillLibrary(path, editor);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:GroovyLibraryDescription.java


注:本文中的com.intellij.openapi.util.SystemInfo.isLinux方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。