mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EP — ability to load for OS only (as it is already done for service components)
This commit is contained in:
+7
-28
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,7 +30,10 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
@@ -49,6 +52,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.intellij.openapi.extensions.Extensions.isComponentSuitableForOs;
|
||||
|
||||
public abstract class ComponentManagerImpl extends UserDataHolderBase implements ComponentManagerEx, Disposable {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.components.ComponentManager");
|
||||
|
||||
@@ -272,32 +277,6 @@ public abstract class ComponentManagerImpl extends UserDataHolderBase implements
|
||||
(!Boolean.parseBoolean(options.get("internal")) || ApplicationManager.getApplication().isInternal());
|
||||
}
|
||||
|
||||
static boolean isComponentSuitableForOs(@Nullable String os) {
|
||||
if (StringUtil.isEmpty(os)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (os.equals("mac")) {
|
||||
return SystemInfoRt.isMac;
|
||||
}
|
||||
else if (os.equals("linux")) {
|
||||
return SystemInfoRt.isLinux;
|
||||
}
|
||||
else if (os.equals("windows")) {
|
||||
return SystemInfoRt.isWindows;
|
||||
}
|
||||
else if (os.equals("unix")) {
|
||||
return SystemInfoRt.isUnix;
|
||||
}
|
||||
else if (os.equals("freebsd")) {
|
||||
return SystemInfoRt.isFreeBSD;
|
||||
}
|
||||
else {
|
||||
LOG.warn("Unknown OS " + os);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,8 @@ package com.intellij.openapi.extensions;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.extensions.impl.ExtensionsAreaImpl;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.SystemInfoRt;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -243,4 +245,30 @@ public class Extensions {
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isComponentSuitableForOs(@Nullable String os) {
|
||||
if (StringUtil.isEmpty(os)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (os.equals("mac")) {
|
||||
return SystemInfoRt.isMac;
|
||||
}
|
||||
else if (os.equals("linux")) {
|
||||
return SystemInfoRt.isLinux;
|
||||
}
|
||||
else if (os.equals("windows")) {
|
||||
return SystemInfoRt.isWindows;
|
||||
}
|
||||
else if (os.equals("unix")) {
|
||||
return SystemInfoRt.isUnix;
|
||||
}
|
||||
else if (os.equals("freebsd")) {
|
||||
return SystemInfoRt.isFreeBSD;
|
||||
}
|
||||
else {
|
||||
ourLogger.warn("Unknown OS " + os);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,6 +32,8 @@ import org.picocontainer.PicoContainer;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.intellij.openapi.extensions.Extensions.isComponentSuitableForOs;
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public class ExtensionsAreaImpl implements ExtensionsArea {
|
||||
private final LogProvider myLogger;
|
||||
@@ -137,6 +139,10 @@ public class ExtensionsAreaImpl implements ExtensionsArea {
|
||||
public void registerExtension(@NotNull final PluginDescriptor pluginDescriptor, @NotNull final Element extensionElement) {
|
||||
final PluginId pluginId = pluginDescriptor.getPluginId();
|
||||
|
||||
if (!isComponentSuitableForOs(extensionElement.getAttributeValue("os"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
String epName = extractEPName(extensionElement);
|
||||
|
||||
ExtensionComponentAdapter adapter;
|
||||
|
||||
@@ -17,13 +17,14 @@ package com.intellij.ide.passwordSafe.macOs
|
||||
|
||||
import com.intellij.ide.passwordSafe.LOG
|
||||
import com.intellij.openapi.util.SystemInfo
|
||||
import com.sun.jna.Native
|
||||
import com.sun.jna.Pointer
|
||||
|
||||
val isMacOsCredentialStoreSupported: Boolean
|
||||
get() = SystemInfo.isMacIntel64 && SystemInfo.isMacOSLeopard
|
||||
|
||||
private val LIBRARY by lazy {
|
||||
com.sun.jna.Native.loadLibrary("Security", MacOsKeychainLibrary::class.java) as MacOsKeychainLibrary
|
||||
Native.loadLibrary("Security", MacOsKeychainLibrary::class.java) as MacOsKeychainLibrary
|
||||
}
|
||||
|
||||
fun saveGenericPassword(serviceName: ByteArray, accountName: String, password: String) {
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ public class ServiceManagerImpl implements BaseComponent {
|
||||
}
|
||||
}
|
||||
|
||||
if (!ComponentManagerImpl.isComponentSuitableForOs(descriptor.os)) {
|
||||
if (!Extensions.isComponentSuitableForOs(descriptor.os)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -444,6 +444,6 @@
|
||||
<additionalTextAttributes scheme="Default" file="idea/FindViewColorsScheme.xml"/>
|
||||
<additionalTextAttributes scheme="Darcula" file="idea/FindViewColorsScheme.xml"/>
|
||||
|
||||
<credentialStore implementation="com.intellij.ide.passwordSafe.MacOsCredentialStoreFactory"/>
|
||||
<credentialStore implementation="com.intellij.ide.passwordSafe.MacOsCredentialStoreFactory" os="mac"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
|
||||
Reference in New Issue
Block a user