public class ExternalSystemApiUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<java.lang.Object> |
ORDER_AWARE_COMPARATOR |
static java.lang.String |
PATH_SEPARATOR |
Modifier and Type | Method and Description |
---|---|
static void |
addBundle(PathsList classPath,
java.lang.String bundlePath,
java.lang.Class<?> contextClass)
Configures given classpath to reference target i18n bundle file(s).
|
static void |
addToInvokeLater(java.lang.Runnable runnable)
Adds runnable to Event Dispatch Queue
if we aren't in UnitTest of Headless environment mode
|
static java.lang.String |
buildErrorMessage(java.lang.Throwable e)
unwraps given exception if possible and builds error message for it. |
static <T> T |
doWriteAction(Computable<T> task) |
static void |
doWriteAction(java.lang.Runnable task) |
static void |
executeOnEdt(boolean synchronous,
java.lang.Runnable task) |
static <T> T |
executeOnEdt(Computable<T> task) |
static void |
executeProjectChangeAction(boolean synchronous,
DisposeAwareProjectChange task) |
static void |
executeProjectChangeAction(DisposeAwareProjectChange task) |
static java.lang.String |
extractNameFromPath(java.lang.String path) |
static <T> DataNode<T> |
find(DataNode<?> node,
Key<T> key) |
static <T> DataNode<T> |
find(DataNode<?> node,
Key<T> key,
BooleanFunction<? super DataNode<T>> predicate) |
static <T> java.util.Collection<DataNode<T>> |
findAll(DataNode<?> parent,
Key<T> key) |
static java.util.Collection<DataNode<?>> |
findAllRecursively(java.util.Collection<? extends DataNode<?>> nodes) |
static java.util.Collection<DataNode<?>> |
findAllRecursively(java.util.Collection<? extends DataNode<?>> nodes,
BooleanFunction<? super DataNode<?>> predicate) |
static java.util.Collection<DataNode<?>> |
findAllRecursively(DataNode<?> node,
BooleanFunction<? super DataNode<?>> predicate) |
static <T> java.util.Collection<DataNode<T>> |
findAllRecursively(DataNode<?> node,
Key<T> key) |
static DataNode<?> |
findFirstRecursively(java.util.Collection<? extends DataNode<?>> nodes,
BooleanFunction<? super DataNode<?>> predicate) |
static DataNode<?> |
findFirstRecursively(DataNode<?> parentNode,
BooleanFunction<? super DataNode<?>> predicate) |
static <T> DataNode<T> |
findParent(DataNode<?> node,
Key<T> key) |
static <T> DataNode<T> |
findParent(DataNode<?> node,
Key<T> key,
BooleanFunction<? super DataNode<T>> predicate) |
static DataNode<ProjectData> |
findProjectData(Project project,
ProjectSystemId systemId,
java.lang.String projectPath) |
static ExternalProjectInfo |
findProjectInfo(Project project,
ProjectSystemId systemId,
java.lang.String projectPath) |
static java.util.Collection<TaskData> |
findProjectTasks(Project project,
ProjectSystemId systemId,
java.lang.String projectPath) |
static java.util.List<ExternalSystemManager<?,?,?,?,?>> |
getAllManagers() |
static <T> java.util.Collection<DataNode<T>> |
getChildren(DataNode<?> node,
Key<T> key) |
static <S extends ExternalSystemExecutionSettings> |
getExecutionSettings(Project project,
java.lang.String linkedProjectPath,
ProjectSystemId externalSystemId) |
static java.lang.String |
getExternalModuleType(Module module) |
static java.lang.String |
getExternalProjectGroup(Module module) |
static java.lang.String |
getExternalProjectId(Module module) |
static java.lang.String |
getExternalProjectPath(Module module) |
static java.lang.String |
getExternalProjectVersion(Module module) |
static java.lang.String |
getExternalRootProjectPath(Module module) |
static java.lang.String |
getLibraryName(Library library) |
static java.lang.String |
getLocalFileSystemPath(VirtualFile file) |
static <S extends AbstractExternalSystemLocalSettings> |
getLocalSettings(Project project,
ProjectSystemId externalSystemId) |
static ExternalSystemManager<?,?,?,?,?> |
getManager(ProjectSystemId externalSystemId) |
static java.lang.String |
getProjectRepresentationName(java.lang.String targetProjectPath,
java.lang.String rootProjectPath) |
static java.lang.String |
getRootProjectPath(java.lang.String externalProjectPath,
ProjectSystemId externalSystemId,
Project project)
There is a possible case that external project linked to an ide project is a multi-project, i.e.
|
static AbstractExternalSystemSettings |
getSettings(Project project,
ProjectSystemId externalSystemId) |
static MultiMap<Key<?>,DataNode<?>> |
group(java.util.Collection<? extends DataNode<?>> nodes) |
static <K,V> MultiMap<DataNode<K>,DataNode<V>> |
groupBy(java.util.Collection<? extends DataNode<V>> nodes,
java.lang.Class<K> moduleDataClass) |
static <K,V> MultiMap<DataNode<K>,DataNode<V>> |
groupBy(java.util.Collection<? extends DataNode<V>> nodes,
Key<K> key) |
static boolean |
isExternalSystemAwareModule(ProjectSystemId systemId,
Module module) |
static boolean |
isExternalSystemAwareModule(java.lang.String systemId,
Module module) |
static boolean |
isExternalSystemLibrary(Library library,
ProjectSystemId externalSystemId) |
static boolean |
isInProcessMode(ProjectSystemId externalSystemId)
Historically we prefer to work with third-party api not from ide process but from dedicated slave process (there is a risk
that third-party api has bugs which might make the whole ide process corrupted, e.g.
|
static boolean |
isOneToOneMapping(Project ideProject,
ProjectData projectData,
Module[] modules)
Allows to answer if given ide project has 1-1 mapping with the given external project, i.e.
|
static boolean |
isRelated(Library library,
LibraryData libraryData) |
static java.lang.String |
normalizePath(java.lang.String s) |
static void |
orderAwareSort(java.util.List<?> data) |
static MultiMap<Key<?>,DataNode<?>> |
recursiveGroup(java.util.Collection<DataNode<?>> nodes) |
static java.lang.String |
stacktraceAsString(java.lang.Throwable throwable) |
static void |
subscribe(Project project,
ProjectSystemId systemId,
ExternalSystemSettingsListener listener) |
static void |
subscribe(Project project,
ProjectSystemId systemId,
ExternalSystemSettingsListener listener,
Disposable parentDisposable) |
static java.lang.String |
toCanonicalPath(java.lang.String path) |
static ProjectModelExternalSource |
toExternalSource(ProjectSystemId systemId) |
static void |
visit(DataNode<?> originalNode,
java.util.function.Consumer<? super DataNode<?>> consumer) |
public static final java.lang.String PATH_SEPARATOR
public static final java.util.Comparator<java.lang.Object> ORDER_AWARE_COMPARATOR
public static java.lang.String extractNameFromPath(java.lang.String path)
public static java.lang.String getLibraryName(Library library)
public static boolean isRelated(Library library, LibraryData libraryData)
public static boolean isExternalSystemLibrary(Library library, ProjectSystemId externalSystemId)
public static void orderAwareSort(java.util.List<?> data)
public static java.lang.String toCanonicalPath(java.lang.String path)
path
- target pathpublic static java.lang.String getLocalFileSystemPath(VirtualFile file)
public static ExternalSystemManager<?,?,?,?,?> getManager(ProjectSystemId externalSystemId)
public static java.util.List<ExternalSystemManager<?,?,?,?,?>> getAllManagers()
public static MultiMap<Key<?>,DataNode<?>> recursiveGroup(java.util.Collection<DataNode<?>> nodes)
public static MultiMap<Key<?>,DataNode<?>> group(java.util.Collection<? extends DataNode<?>> nodes)
public static <K,V> MultiMap<DataNode<K>,DataNode<V>> groupBy(java.util.Collection<? extends DataNode<V>> nodes, java.lang.Class<K> moduleDataClass)
public static <K,V> MultiMap<DataNode<K>,DataNode<V>> groupBy(java.util.Collection<? extends DataNode<V>> nodes, Key<K> key)
public static <T> java.util.Collection<DataNode<T>> getChildren(DataNode<?> node, Key<T> key)
public static <T> DataNode<T> find(DataNode<?> node, Key<T> key, BooleanFunction<? super DataNode<T>> predicate)
public static <T> DataNode<T> findParent(DataNode<?> node, Key<T> key, BooleanFunction<? super DataNode<T>> predicate)
public static void visit(DataNode<?> originalNode, java.util.function.Consumer<? super DataNode<?>> consumer)
public static <T> java.util.Collection<DataNode<T>> findAllRecursively(DataNode<?> node, Key<T> key)
public static java.util.Collection<DataNode<?>> findAllRecursively(java.util.Collection<? extends DataNode<?>> nodes)
public static java.util.Collection<DataNode<?>> findAllRecursively(DataNode<?> node, BooleanFunction<? super DataNode<?>> predicate)
public static java.util.Collection<DataNode<?>> findAllRecursively(java.util.Collection<? extends DataNode<?>> nodes, BooleanFunction<? super DataNode<?>> predicate)
public static DataNode<?> findFirstRecursively(DataNode<?> parentNode, BooleanFunction<? super DataNode<?>> predicate)
public static DataNode<?> findFirstRecursively(java.util.Collection<? extends DataNode<?>> nodes, BooleanFunction<? super DataNode<?>> predicate)
public static void executeProjectChangeAction(DisposeAwareProjectChange task)
public static void executeProjectChangeAction(boolean synchronous, DisposeAwareProjectChange task)
public static void executeOnEdt(boolean synchronous, java.lang.Runnable task)
public static <T> T executeOnEdt(Computable<T> task)
public static <T> T doWriteAction(Computable<T> task)
public static void doWriteAction(java.lang.Runnable task)
public static void addToInvokeLater(java.lang.Runnable runnable)
runnable
- Runnablepublic static void addBundle(PathsList classPath, java.lang.String bundlePath, java.lang.Class<?> contextClass)
classPath
- process classpathbundlePath
- path to the target bundle filecontextClass
- class from the same content root as the target bundle filepublic static java.lang.String normalizePath(java.lang.String s)
public static boolean isOneToOneMapping(Project ideProject, ProjectData projectData, Module[] modules)
ideProject
- target ide projectprojectData
- target external projectmodules
- the list of modules to check (during import this contains uncommitted modules from the modifiable model)true
if given ide project has 1-1 mapping to the given external project;
false
otherwisepublic static java.lang.String getProjectRepresentationName(java.lang.String targetProjectPath, java.lang.String rootProjectPath)
public static java.lang.String getRootProjectPath(java.lang.String externalProjectPath, ProjectSystemId externalSystemId, Project project)
externalProjectPath
- external sub-project's config pathexternalSystemId
- target external systemproject
- target ide projectnull
if it's not possible to find a root project's config path on the basis of the
given pathpublic static java.lang.String buildErrorMessage(java.lang.Throwable e)
unwraps
given exception if possible and builds error message for it.e
- exception to processpublic static java.lang.String stacktraceAsString(java.lang.Throwable throwable)
public static AbstractExternalSystemSettings getSettings(Project project, ProjectSystemId externalSystemId) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static <S extends AbstractExternalSystemLocalSettings> S getLocalSettings(Project project, ProjectSystemId externalSystemId) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static <S extends ExternalSystemExecutionSettings> S getExecutionSettings(Project project, java.lang.String linkedProjectPath, ProjectSystemId externalSystemId) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static boolean isInProcessMode(ProjectSystemId externalSystemId)
externalSystemId
- target external systemtrue
if the ide is configured to work with external system api from the ide process;
false
otherwisepublic static ProjectModelExternalSource toExternalSource(ProjectSystemId systemId)
public static boolean isExternalSystemAwareModule(ProjectSystemId systemId, Module module)
public static boolean isExternalSystemAwareModule(java.lang.String systemId, Module module)
public static java.lang.String getExternalProjectPath(Module module)
public static java.lang.String getExternalRootProjectPath(Module module)
public static java.lang.String getExternalProjectId(Module module)
public static java.lang.String getExternalProjectGroup(Module module)
public static java.lang.String getExternalProjectVersion(Module module)
public static java.lang.String getExternalModuleType(Module module)
public static void subscribe(Project project, ProjectSystemId systemId, ExternalSystemSettingsListener listener)
public static void subscribe(Project project, ProjectSystemId systemId, ExternalSystemSettingsListener listener, Disposable parentDisposable)
public static java.util.Collection<TaskData> findProjectTasks(Project project, ProjectSystemId systemId, java.lang.String projectPath)
public static DataNode<ProjectData> findProjectData(Project project, ProjectSystemId systemId, java.lang.String projectPath)
public static ExternalProjectInfo findProjectInfo(Project project, ProjectSystemId systemId, java.lang.String projectPath)