mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
[external system] remove unused code which causes UI freezes (IDEA-324651)
It looks like 'getExternalDependenciesList' wasn't used since 45ad15bc36d29ca1, so the relevant code can be safely removed. This will fix UI freezes caused by calling ArtifactUtil.processPackagingElements on EDT. GitOrigin-RevId: 04ab3c9e643f33ffa7aa03aa5906653c8a1b8718
This commit is contained in:
committed by
intellij-monorepo-bot
parent
77d74b8f88
commit
de2cfc9b36
@@ -3,14 +3,11 @@ package com.intellij.openapi.externalSystem.project;
|
||||
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ModifiableArtifactModel;
|
||||
import com.intellij.packaging.elements.PackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElementResolvingContext;
|
||||
import com.intellij.packaging.ui.ManifestFileConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
*/
|
||||
@@ -18,7 +15,5 @@ public interface ArtifactExternalDependenciesImporter {
|
||||
@Nullable
|
||||
ManifestFileConfiguration getManifestFile(@NotNull Artifact artifact, @NotNull PackagingElementResolvingContext context);
|
||||
|
||||
List<PackagingElement<?>> getExternalDependenciesList(@NotNull Artifact artifact);
|
||||
|
||||
void applyChanges(ModifiableArtifactModel artifactModel, PackagingElementResolvingContext context);
|
||||
}
|
||||
|
||||
@@ -17,29 +17,15 @@ package com.intellij.openapi.externalSystem.service.project;
|
||||
|
||||
import com.intellij.openapi.externalSystem.project.ArtifactExternalDependenciesImporter;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.ManifestFilesInfo;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ModifiableArtifactModel;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElementResolvingContext;
|
||||
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
|
||||
import com.intellij.packaging.impl.artifacts.PackagingElementPath;
|
||||
import com.intellij.packaging.impl.artifacts.PackagingElementProcessor;
|
||||
import com.intellij.packaging.impl.elements.ArtifactElementType;
|
||||
import com.intellij.packaging.impl.elements.ArtifactPackagingElement;
|
||||
import com.intellij.packaging.ui.ManifestFileConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ArtifactExternalDependenciesImporterImpl implements ArtifactExternalDependenciesImporter {
|
||||
private final ManifestFilesInfo myManifestFiles = new ManifestFilesInfo();
|
||||
private final Map<Artifact, List<PackagingElement<?>>> myExternalDependencies = new HashMap<>();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@@ -48,42 +34,8 @@ public class ArtifactExternalDependenciesImporterImpl implements ArtifactExterna
|
||||
return myManifestFiles.getManifestFile(artifact.getRootElement(), artifact.getArtifactType(), context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PackagingElement<?>> getExternalDependenciesList(@NotNull Artifact artifact) {
|
||||
List<PackagingElement<?>> elements = myExternalDependencies.get(artifact);
|
||||
if (elements == null) {
|
||||
elements = new ArrayList<>();
|
||||
myExternalDependencies.put(artifact, elements);
|
||||
}
|
||||
return elements;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyChanges(ModifiableArtifactModel artifactModel, final PackagingElementResolvingContext context) {
|
||||
myManifestFiles.saveManifestFiles();
|
||||
final List<Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>>> elementsToInclude =
|
||||
new ArrayList<>();
|
||||
for (Artifact artifact : artifactModel.getArtifacts()) {
|
||||
ArtifactUtil.processPackagingElements(artifact, ArtifactElementType.ARTIFACT_ELEMENT_TYPE,
|
||||
new PackagingElementProcessor<>() {
|
||||
@Override
|
||||
public boolean process(@NotNull ArtifactPackagingElement artifactPackagingElement,
|
||||
@NotNull PackagingElementPath path) {
|
||||
final Artifact included = artifactPackagingElement.findArtifact(context);
|
||||
final CompositePackagingElement<?> parent = path.getLastParent();
|
||||
if (parent != null && included != null) {
|
||||
final List<PackagingElement<?>> elements = myExternalDependencies.get(included);
|
||||
if (elements != null) {
|
||||
elementsToInclude.add(Pair.create(parent, elements));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, context, false);
|
||||
}
|
||||
|
||||
for (Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>> pair : elementsToInclude) {
|
||||
pair.getFirst().addOrFindChildren(pair.getSecond());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user