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


Java PlatformUtils类代码示例

本文整理汇总了Java中com.intellij.util.PlatformUtils的典型用法代码示例。如果您正苦于以下问题:Java PlatformUtils类的具体用法?Java PlatformUtils怎么用?Java PlatformUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: decorate

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Nullable
public static IdeFrameDecorator decorate(@NotNull IdeFrameImpl frame) {
  if (SystemInfo.isMac) {
    return new MacMainFrameDecorator(frame, PlatformUtils.isAppCode());
  }
  else if (SystemInfo.isWindows) {
    return new WinMainFrameDecorator(frame);
  }
  else if (SystemInfo.isXWindow) {
    if (X11UiUtil.isFullScreenSupported()) {
      return new EWMHFrameDecorator(frame);
    }
  }

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

示例2: runStartupWizard

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
static void runStartupWizard() {
  ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance();

  String stepsProvider = appInfo.getCustomizeIDEWizardStepsProvider();
  if (stepsProvider != null) {
    CustomizeIDEWizardDialog.showCustomSteps(stepsProvider);
    PluginManagerCore.invalidatePlugins();
    return;
  }

  if (PlatformUtils.isIntelliJ()) {
    new CustomizeIDEWizardDialog().show();
    PluginManagerCore.invalidatePlugins();
    return;
  }

  List<ApplicationInfoEx.PluginChooserPage> pages = appInfo.getPluginChooserPages();
  if (!pages.isEmpty()) {
    StartupWizard startupWizard = new StartupWizard(pages);
    startupWizard.setCancelText("Skip");
    startupWizard.show();
    PluginManagerCore.invalidatePlugins();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:StartupUtil.java

示例3: createSouthPanel

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Override
protected JComponent createSouthPanel() {
  final JPanel buttonPanel = new JPanel(new GridBagLayout());
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.insets.right = 5;
  gbc.fill = GridBagConstraints.BOTH;
  gbc.gridx = 0;
  gbc.gridy = 0;
  if (!PlatformUtils.isCLion()) {
    buttonPanel.add(mySkipButton, gbc);
    gbc.gridx++;
  }
  buttonPanel.add(myBackButton, gbc);
  gbc.gridx++;
  gbc.weightx = 1;
  buttonPanel.add(Box.createHorizontalGlue(), gbc);
  gbc.gridx++;
  gbc.weightx = 0;
  buttonPanel.add(myNextButton, gbc);
  buttonPanel.setBorder(BorderFactory.createEmptyBorder(8, 0, 0, 0));
  myButtonWrapper.add(buttonPanel, BUTTONS);
  myButtonWrapper.add(new JLabel(), NO_BUTTONS);
  myButtonWrapperLayout.show(myButtonWrapper, BUTTONS);
  return myButtonWrapper;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:CustomizeIDEWizardDialog.java

示例4: FindSettingsImpl

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
public FindSettingsImpl() {
  recentFileMasks.add("*.properties");
  recentFileMasks.add("*.html");
  recentFileMasks.add("*.jsp");
  recentFileMasks.add("*.xml");
  recentFileMasks.add("*.java");
  recentFileMasks.add("*.js");
  recentFileMasks.add("*.as");
  recentFileMasks.add("*.css");
  recentFileMasks.add("*.mxml");
  if (PlatformUtils.isPyCharm()) {
    recentFileMasks.add("*.py");
  }
  else if (PlatformUtils.isRubyMine()) {
    recentFileMasks.add("*.rb");
  }
  else if (PlatformUtils.isPhpStorm()) {
    recentFileMasks.add("*.php");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:FindSettingsImpl.java

示例5: getPluginResourcesRootName

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Nullable
private String getPluginResourcesRootName(VirtualFile resourcesDir) throws IOException {
  PluginId ownerPluginId = getOwner(resourcesDir);
  if (ownerPluginId == null) return null;

  if (PluginManagerCore.CORE_PLUGIN_ID.equals(ownerPluginId.getIdString())) {
    return PlatformUtils.getPlatformPrefix();
  }

  IdeaPluginDescriptor plugin = PluginManager.getPlugin(ownerPluginId);
  if (plugin != null) {
    return plugin.getName();
  }

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

示例6: visitPyFile

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Override
public void visitPyFile(PyFile node) {
  super.visitPyFile(node);
  if (PlatformUtils.isPyCharm()) {
    final Module module = ModuleUtilCore.findModuleForPsiElement(node);
    if (module != null) {
      final Sdk sdk = PythonSdkType.findPythonSdk(module);
      if (sdk == null) {
        registerProblem(node, "No Python interpreter configured for the project", new ConfigureInterpreterFix());
      }
      else if (PythonSdkType.isInvalid(sdk)) {
        registerProblem(node, "Invalid Python interpreter selected for the project", new ConfigureInterpreterFix());
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PyInterpreterInspection.java

示例7: addLibrariesFromModule

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
private static void addLibrariesFromModule(Module module, Collection<String> list) {
  final OrderEntry[] entries = ModuleRootManager.getInstance(module).getOrderEntries();
  for (OrderEntry entry : entries) {
    if (entry instanceof LibraryOrderEntry) {
      final String name = ((LibraryOrderEntry)entry).getLibraryName();
      if (name != null && name.endsWith(LibraryContributingFacet.PYTHON_FACET_LIBRARY_NAME_SUFFIX)) {
        // skip libraries from Python facet
        continue;
      }
      for (VirtualFile root : ((LibraryOrderEntry)entry).getRootFiles(OrderRootType.CLASSES)) {
        final Library library = ((LibraryOrderEntry)entry).getLibrary();
        if (!PlatformUtils.isPyCharm()) {
          addToPythonPath(root, list);
        }
        else if (library instanceof LibraryImpl) {
          final PersistentLibraryKind<?> kind = ((LibraryImpl)library).getKind();
          if (kind == PythonLibraryType.getInstance().getKind()) {
            addToPythonPath(root, list);
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PythonCommandLineState.java

示例8: validateProjectView

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Override
public boolean validateProjectView(
    @Nullable Project project,
    BlazeContext context,
    ProjectViewSet projectViewSet,
    WorkspaceLanguageSettings workspaceLanguageSettings) {
  boolean typescriptActive = workspaceLanguageSettings.isLanguageActive(LanguageClass.TYPESCRIPT);

  if (typescriptActive && !PlatformUtils.isIdeaUltimate()) {
    IssueOutput.error("IntelliJ Ultimate needed for Typescript support.").submit(context);
    return false;
  }

  // Must have either both typescript and ts_config_rules or neither
  if (typescriptActive ^ !getTsConfigTargets(projectViewSet).isEmpty()) {
    invalidProjectViewError(context, Blaze.getBuildSystemProvider(project));
    return false;
  }

  return true;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:22,代码来源:BlazeTypescriptSyncPlugin.java

示例9: testJavascriptLanguageAvailableForUltimateEdition

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Test
public void testJavascriptLanguageAvailableForUltimateEdition() {
  TestUtils.setPlatformPrefix(testDisposable, PlatformUtils.IDEA_PREFIX);
  ProjectViewSet projectViewSet =
      ProjectViewSet.builder()
          .add(
              ProjectView.builder()
                  .add(
                      ScalarSection.builder(WorkspaceTypeSection.KEY)
                          .set(WorkspaceType.JAVASCRIPT))
                  .add(
                      ListSection.builder(AdditionalLanguagesSection.KEY)
                          .add(LanguageClass.JAVASCRIPT))
                  .build())
          .build();
  WorkspaceLanguageSettings workspaceLanguageSettings =
      LanguageSupport.createWorkspaceLanguageSettings(projectViewSet);
  errorCollector.assertNoIssues();
  assertThat(workspaceLanguageSettings)
      .isEqualTo(
          new WorkspaceLanguageSettings(
              WorkspaceType.JAVASCRIPT,
              ImmutableSet.of(LanguageClass.JAVASCRIPT, LanguageClass.GENERIC)));
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:25,代码来源:BlazeJavascriptSyncPluginTest.java

示例10: testJavascriptWorkspaceTypeUnavailableForCommunityEdition

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Test
public void testJavascriptWorkspaceTypeUnavailableForCommunityEdition() {
  TestUtils.setPlatformPrefix(testDisposable, PlatformUtils.IDEA_CE_PREFIX);
  ProjectViewSet projectViewSet =
      ProjectViewSet.builder()
          .add(
              ProjectView.builder()
                  .add(
                      ScalarSection.builder(WorkspaceTypeSection.KEY)
                          .set(WorkspaceType.JAVASCRIPT))
                  .build())
          .build();
  WorkspaceLanguageSettings workspaceLanguageSettings =
      LanguageSupport.createWorkspaceLanguageSettings(projectViewSet);
  LanguageSupport.validateLanguageSettings(context, workspaceLanguageSettings);
  errorCollector.assertIssues("Workspace type 'javascript' is not supported by this plugin");
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:18,代码来源:BlazeJavascriptSyncPluginTest.java

示例11: testTypescriptLanguageAvailableInUltimateEdition

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Test
public void testTypescriptLanguageAvailableInUltimateEdition() {
  TestUtils.setPlatformPrefix(testDisposable, PlatformUtils.IDEA_PREFIX);
  ProjectViewSet projectViewSet =
      ProjectViewSet.builder()
          .add(
              ProjectView.builder()
                  .add(ScalarSection.builder(WorkspaceTypeSection.KEY).set(WorkspaceType.JAVA))
                  .add(
                      ListSection.builder(AdditionalLanguagesSection.KEY)
                          .add(LanguageClass.TYPESCRIPT))
                  .build())
          .build();
  WorkspaceLanguageSettings workspaceLanguageSettings =
      LanguageSupport.createWorkspaceLanguageSettings(projectViewSet);
  errorCollector.assertNoIssues();
  assertThat(workspaceLanguageSettings)
      .isEqualTo(
          new WorkspaceLanguageSettings(
              WorkspaceType.JAVA,
              ImmutableSet.of(
                  LanguageClass.TYPESCRIPT, LanguageClass.GENERIC, LanguageClass.JAVA)));
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:24,代码来源:BlazeTypescriptSyncPluginTest.java

示例12: testTypescriptNotLanguageAvailableInCommunityEdition

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Test
public void testTypescriptNotLanguageAvailableInCommunityEdition() {
  TestUtils.setPlatformPrefix(testDisposable, PlatformUtils.IDEA_CE_PREFIX);
  ProjectViewSet projectViewSet =
      ProjectViewSet.builder()
          .add(
              ProjectView.builder()
                  .add(ScalarSection.builder(WorkspaceTypeSection.KEY).set(WorkspaceType.JAVA))
                  .add(
                      ListSection.builder(AdditionalLanguagesSection.KEY)
                          .add(LanguageClass.TYPESCRIPT))
                  .build())
          .build();
  WorkspaceLanguageSettings workspaceLanguageSettings =
      LanguageSupport.createWorkspaceLanguageSettings(projectViewSet);
  LanguageSupport.validateLanguageSettings(context, workspaceLanguageSettings);
  errorCollector.assertIssues("Language 'typescript' is not supported by this plugin");
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:19,代码来源:BlazeTypescriptSyncPluginTest.java

示例13: testUsefulErrorMessageInCommunityEdition

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Test
public void testUsefulErrorMessageInCommunityEdition() {
  TestUtils.setPlatformPrefix(getTestRootDisposable(), PlatformUtils.IDEA_CE_PREFIX);
  setProjectView(
      "directories:",
      "  common/jslayout",
      "targets:",
      "  //common/jslayout/...:all",
      "workspace_type: javascript");

  workspace.createDirectory(new WorkspacePath("common/jslayout"));

  BlazeSyncParams syncParams =
      new BlazeSyncParams.Builder("Full Sync", BlazeSyncParams.SyncMode.FULL)
          .addProjectViewTargets(true)
          .build();
  runBlazeSync(syncParams);
  errorCollector.assertIssues("IntelliJ Ultimate needed for Javascript support.");
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:20,代码来源:JavascriptSyncTest.java

示例14: GoogleUsageTracker

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
/**
 * Constructs a usage tracker configured with analytics and plugin name configured from its
 * environment.
 */
public GoogleUsageTracker() {
  analyticsId = UsageTrackerManager.getInstance().getAnalyticsProperty();

  AccountPluginInfoService pluginInfo = ServiceManager.getService(AccountPluginInfoService.class);
  externalPluginName = pluginInfo.getExternalPluginName();
  userAgent = pluginInfo.getUserAgent();
  String intellijPlatformName = PlatformUtils.getPlatformPrefix();
  String intellijPlatformVersion = ApplicationInfo.getInstance().getStrictVersion();
  String cloudToolsPluginVersion = pluginInfo.getPluginVersion();
  Map<String, String> systemMetadataMap =
      ImmutableMap.of(
          PLATFORM_NAME_KEY, METADATA_ESCAPER.escape(intellijPlatformName),
          PLATFORM_VERSION_KEY, METADATA_ESCAPER.escape(intellijPlatformVersion),
          JDK_VERSION_KEY, METADATA_ESCAPER.escape(JDK_VERSION_VALUE),
          OPERATING_SYSTEM_KEY, METADATA_ESCAPER.escape(OPERATING_SYSTEM_VALUE),
          PLUGIN_VERSION_KEY, METADATA_ESCAPER.escape(cloudToolsPluginVersion));

  systemMetadataKeyValues = METADATA_JOINER.join(systemMetadataMap);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:24,代码来源:GoogleUsageTracker.java

示例15: getIcon

import com.intellij.util.PlatformUtils; //导入依赖的package包/类
@Nullable
private Icon getIcon(VirtualFile file, Project project) {
  final String path = file.getPath();
  final long stamp = file.getModificationStamp();
  Pair<Long, Icon> iconInfo = iconsCache.get(path);
  if (iconInfo == null || iconInfo.getFirst() < stamp) {
    try {
      final Icon icon = createOrFindBetterIcon(file, PlatformUtils.isIdeaProject(project));
      iconInfo = new Pair<Long, Icon>(stamp, hasProperSize(icon) ? icon : null);
      iconsCache.put(file.getPath(), iconInfo);
    }
    catch (Exception e) {//
      iconInfo = null;
      iconsCache.remove(path);
    }
  }
  return iconInfo == null ? null : iconInfo.getSecond();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:IconLineMarkerProvider.java


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