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


Java SystemInfo.isMac方法代码示例

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


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

示例1: testActivatingProfilesByOS

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public void testActivatingProfilesByOS() throws Exception {
  String os = SystemInfo.isWindows ? "windows" : SystemInfo.isMac ? "mac" : "unix";

  createProjectPom("<profiles>" +
                   "  <profile>" +
                   "    <id>one</id>" +
                   "    <activation>" +
                   "      <os><family>" + os + "</family></os>" +
                   "    </activation>" +
                   "  </profile>" +
                   "  <profile>" +
                   "    <id>two</id>" +
                   "    <activation>" +
                   "      <os><family>xxx</family></os>" +
                   "    </activation>" +
                   "  </profile>" +
                   "</profiles>");

  assertActiveProfiles("one");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MavenProjectReaderTest.java

示例2: shouldForceClassicVM

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
/**
 * for Target JDKs versions 1.2.x - 1.3.0 the Classic VM should be used for debugging
 */
private static boolean shouldForceClassicVM(Sdk jdk) {
  if (SystemInfo.isMac) {
    return false;
  }
  if (jdk == null) return false;

  String version = JdkUtil.getJdkMainAttribute(jdk, Attributes.Name.IMPLEMENTATION_VERSION);
  if (version != null) {
    if (version.compareTo("1.4") >= 0) {
      return false;
    }
    if (version.startsWith("1.2") && SystemInfo.isWindows) {
      return true;
    }
    version += ".0";
    if (version.startsWith("1.3.0") && SystemInfo.isWindows) {
      return true;
    }
    if ((version.startsWith("1.3.1_07") || version.startsWith("1.3.1_08")) && SystemInfo.isWindows) {
      return false; // fixes bug for these JDKs that it cannot start with -classic option
    }
  }

  return DebuggerSettings.getInstance().FORCE_CLASSIC_VM;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:DebuggerManagerImpl.java

示例3: getProfilesDirs

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private static File[] getProfilesDirs() {
  final String userHome = SystemProperties.getUserHome();
  if (SystemInfo.isMac) {
    return new File[] {
      new File(userHome, "Library" + File.separator + "Mozilla" + File.separator + "Firefox"),
      new File(userHome, "Library" + File.separator + "Application Support" + File.separator + "Firefox"),
    };
  }
  if (SystemInfo.isUnix) {
    return new File[] {new File(userHome, ".mozilla" + File.separator + "firefox")};
  }

  String localPath = "Mozilla" + File.separator + "Firefox";
  return new File[] {
    new File(System.getenv("APPDATA"), localPath),
    new File(userHome, "AppData" + File.separator + "Roaming" + File.separator + localPath),
    new File(userHome, "Application Data" + File.separator + localPath)
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FirefoxUtil.java

示例4: paintBorder

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
  final Graphics2D g2d = (Graphics2D) g.create();

  final Color background = UIUtil.getPanelBackground();

  g2d.setColor(background);
  g2d.fillRect(0, 0, width, height);

  Color topColor = UIUtil.isUnderDarcula() ? BORDER_TOP_COLOR.darker().darker() : BORDER_TOP_COLOR;
  if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
    topColor = Gray.xC9;
  }
  g2d.setColor(topColor);
  g2d.drawLine(0, 0, width, 0);

  if (!UIUtil.isUnderDarcula()) {
    g2d.setColor(BORDER_BOTTOM_COLOR);
    g2d.drawLine(0, height, width, height);
  }

  g2d.dispose();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:StatusBarUI.java

示例5: _init

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
protected void _init(@Nls(capitalization = Nls.Capitalization.Title) String title,
                     String message,
                     @NotNull String[] options,
                     int defaultOptionIndex,
                     int focusedOptionIndex,
                     @Nullable Icon icon,
                     @Nullable DoNotAskOption doNotAskOption) {
  setTitle(title);
  if (isMacSheetEmulation()) {
    setUndecorated(true);
  }
  myMessage = message;
  myOptions = options;
  myDefaultOptionIndex = defaultOptionIndex;
  myFocusedOptionIndex = focusedOptionIndex;
  myIcon = icon;
  if (!SystemInfo.isMac) {
    setButtonsAlignment(SwingConstants.CENTER);
  }
  setDoNotAskOption(doNotAskOption);
  init();
  if (isMacSheetEmulation()) {
    MacUtil.adjustFocusTraversal(myDisposable);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:Messages.java

示例6: getLanguageSettingsComponent

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Nullable
@Override
public LabeledComponent<JComponent> getLanguageSettingsComponent(@NotNull Course selectedCourse) {
  final Project project = ProjectManager.getInstance().getDefaultProject();
  PyConfigurableInterpreterList instance = PyConfigurableInterpreterList.getInstance(project);
  if (instance == null) {
    return null;
  }
  final List<Sdk> sdks = instance.getAllPythonSdks();
  VirtualEnvProjectFilter.removeAllAssociated(sdks);
  // by default we create new virtual env in project, we need to add this non-existing sdk to sdk list
  ProjectJdkImpl fakeSdk = createFakeSdk(selectedCourse);
  if (fakeSdk != null) {
    sdks.add(0, fakeSdk);
  }
  PythonSdkChooserCombo combo = new PythonSdkChooserCombo(project, sdks, sdk -> true);
  if (fakeSdk != null) {
    patchRenderer(fakeSdk, combo);
    combo.getComboBox().setSelectedItem(fakeSdk);
  }
  if (SystemInfo.isMac && !UIUtil.isUnderDarcula()) {
    combo.putClientProperty("JButton.buttonType", null);
  }
  combo.setButtonIcon(PythonIcons.Python.InterpreterGear);
  combo.addChangedListener(e -> {
    Sdk selectedSdk = (Sdk)combo.getComboBox().getSelectedItem();
    mySettings.setSdk(selectedSdk == fakeSdk ? null : selectedSdk);
  });
  return LabeledComponent.create(combo, "Interpreter", BorderLayout.WEST);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:31,代码来源:PyStudyDirectoryProjectGenerator.java

示例7: getPreferredSize

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
    final boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText());
    int width = isEmpty ? JBUI.scale(10) + getArrowIcon().getIconWidth() : super.getPreferredSize().width;
    if (isSmallVariant() && !((SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()))) {
        width += JBUI.scale(4);
        if (UIUtil.isUnderWin10LookAndFeel()) {
            width += JBUI.scale(8);
        }
    }
    return new Dimension(width, isSmallVariant() ? JBUI.scale(19) : super.getPreferredSize().height);
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:13,代码来源:ComboBoxAction.java

示例8: configureNdkTextField

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private void configureNdkTextField() {
  myNdkTextFieldWithButton.setTextFieldPreferredWidth(50);

  FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false) {
    @Override
    public void validateSelectedFiles(VirtualFile[] files) throws Exception {
      for (VirtualFile virtualFile : files) {
        File file = virtualToIoFile(virtualFile);
        ValidationResult validationResult = validateAndroidNdk(file, false);
        if (!validationResult.success) {
          String msg = validationResult.message;
          if (isEmpty(msg)) {
            msg = "Please choose a valid Android NDK directory.";
          }
          throw new IllegalArgumentException(msg);
        }
      }
    }
  };

  if (SystemInfo.isMac) {
    descriptor.withShowHiddenFiles(true);
  }
  descriptor.setTitle("Choose Android NDK Location");

  myNdkTextFieldWithButton.addBrowseFolderListener(null, new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
    "Select Android NDK Home", null, myNdkTextFieldWithButton, null, descriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:SelectNdkDialog.java

示例9: getPredefinedPath

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Nullable
private static VirtualFile getPredefinedPath() {
  String path = null;
  if (SystemInfo.isWindows) {
    List<String> suspiciousPaths = new ArrayList<String>();
    String programFiles = "C:\\Program Files";

    String sb20 = "\\JavaFX Scene Builder 2.0\\JavaFX Scene Builder 2.0.exe";
    String sb11 = "\\JavaFX Scene Builder 1.1\\JavaFX Scene Builder 1.1.exe";
    String sb10 = "\\JavaFX Scene Builder 1.0\\bin\\scenebuilder.exe";

    fillPaths(programFiles, suspiciousPaths, sb20, sb11, sb10);
    fillPaths(programFiles + " (x86)", suspiciousPaths, sb20, sb11, sb10);

    path = findFirstThatExist(ArrayUtil.toStringArray(suspiciousPaths));
  }
  else if (SystemInfo.isMac) {
    path = findFirstThatExist("/Applications/JavaFX Scene Builder 2.0.app",
                              "/Applications/JavaFX Scene Builder 1.1.app",
                              "/Applications/JavaFX Scene Builder 1.0.app");
  }
  else if (SystemInfo.isUnix) {
    path = findFirstThatExist("/opt/JavaFXSceneBuilder2.0/JavaFXSceneBuilder2.0", "/opt/JavaFXSceneBuilder1.1/JavaFXSceneBuilder1.1");
  }

  return path != null ? LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(path)) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:SceneBuilderInfo.java

示例10: setSelected

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
public void setSelected(@Nullable AnActionEvent e, boolean selected) {

  if (e == null) return;
  boolean macMainMenu = SystemInfo.isMac && ActionPlaces.isMainMenuOrActionSearch(e.getPlace());

  if (!selected && !macMainMenu) {
    return;
  }

  final Project project = findProject();
  if (project == null) {
    return;
  }
  final JFrame projectFrame = WindowManager.getInstance().getFrame(project);
  final int frameState = projectFrame.getExtendedState();

  if (macMainMenu && !(e.getInputEvent().getSource() instanceof ActionMenuItem) && (projectFrame.getExtendedState() & Frame.ICONIFIED) != 0) {
    // On Mac minimized window should not be restored this way
    return;
  }

  if (BitUtil.isSet(frameState, Frame.ICONIFIED)) {
    // restore the frame if it is minimized
    projectFrame.setExtendedState(frameState ^ Frame.ICONIFIED);
  }
  projectFrame.toFront();
  projectFrame.requestFocus();
  //ProjectUtil.focusProjectWindow(project, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ProjectWindowAction.java

示例11: createSingleFileOrExecutableAppDescriptor

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public static FileChooserDescriptor createSingleFileOrExecutableAppDescriptor() {
  return new FileChooserDescriptor(true, false, false, false, false, false) {
    @Override
    public boolean isFileSelectable(VirtualFile file) {
      return super.isFileSelectable(file) || SystemInfo.isMac && file.isDirectory() && "app".equals(file.getExtension());
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FileChooserDescriptorFactory.java

示例12: setMargin

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private static void setMargin(JButton button) {
  // Aqua LnF does a good job of setting proper margin between buttons. Setting them specifically causes them be 'square' style instead of
  // 'rounded', which is expected by apple users.
  if (!SystemInfo.isMac && BUTTON_MARGINS != null) {
    button.setMargin(BUTTON_MARGINS);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:FirstRunWizardHost.java

示例13: createJButtonForAction

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
/**
 * Creates <code>JButton</code> for the specified action. If the button has not <code>null</code>
 * value for <code>DialogWrapper.DEFAULT_ACTION</code> key then the created button will be the
 * default one for the dialog.
 *
 * @param action action for the button
 * @return button with action specified
 * @see com.intellij.openapi.ui.DialogWrapper#DEFAULT_ACTION
 */
protected JButton createJButtonForAction(Action action) {
  JButton button = new JButton(action);
  String text = button.getText();

  if (SystemInfo.isMac) {
    button.putClientProperty("JButton.buttonType", "text");
  }

  if (text != null) {
    int mnemonic = 0;
    StringBuilder plainText = new StringBuilder();
    for (int i = 0; i < text.length(); i++) {
      char ch = text.charAt(i);
      if (ch == '_' || ch == '&') {
        if (i >= text.length()) {
          break;
        }
        ch = text.charAt(i);
        if (ch != '_' && ch != '&') {
          // Mnemonic is case insensitive.
          int vk = ch;
          if (vk >= 'a' && vk <= 'z') {
            vk -= 'a' - 'A';
          }
          mnemonic = vk;
        }
      }
      plainText.append(ch);
    }
    button.setText(plainText.toString());
    button.setMnemonic(mnemonic);
    setMargin(button);
  }
  myActionToButtonMap.put(action, button);
  return button;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:46,代码来源:FirstRunWizardHost.java

示例14: getInsets

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
public Insets getInsets() {
  Insets insets = super.getInsets();
  if (SystemInfo.isMac && UIUtil.isUnderAquaLookAndFeel() && isEditable) {
    insets.right += 2;
  }
  return insets;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ComboBox.java

示例15: getActionName

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@NotNull
public static String getActionName() {
    return SystemInfo.isMac ? "Reveal Project in Finder" : "Show Project in " + ShowFilePathAction.getFileManagerName();
}
 
开发者ID:beansoftapp,项目名称:react-native-console,代码行数:5,代码来源:LocateInFinderAction.java


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