本文整理汇总了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;
}
示例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();
}
}
示例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;
}
示例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");
}
}
示例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;
}
示例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());
}
}
}
}
示例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);
}
}
}
}
}
}
示例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;
}
示例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)));
}
示例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");
}
示例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)));
}
示例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");
}
示例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.");
}
示例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);
}
示例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();
}