[fragments] maven reimport

GitOrigin-RevId: 71e03f90163864de0ef0b8ddeaddabcedcda78bc
This commit is contained in:
Alexander Bubenchikov
2024-05-24 15:18:39 +02:00
committed by intellij-monorepo-bot
parent 43c39b29af
commit edd8e727fe
4 changed files with 15 additions and 23 deletions

View File

@@ -13,6 +13,7 @@ import java.util.function.Function;
public class MavenWorkspaceMap implements Serializable {
private final Map<MavenId, Data> myMapping = new HashMap<MavenId, Data>();
private final Map<String, Serializable> myAdditionalContext = new HashMap<>();
public void register(@NotNull MavenId id, @NotNull File file) {
register(id, file, null);
@@ -24,6 +25,19 @@ public class MavenWorkspaceMap implements Serializable {
}
}
public void addContext(String id, Serializable contextData) {
myAdditionalContext.put(id, contextData);
}
public @Nullable Serializable getAdditionalContext(String id) {
return myAdditionalContext.get(id);
}
@NotNull
public Set<String> getAvailableContextIds() {
return myAdditionalContext.keySet();
}
public void unregister(@NotNull MavenId id) {
for (MavenId each : getAllIDs(id)) {
myMapping.remove(each);

View File

@@ -1,18 +1,9 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.maven.project.preimport
import org.jdom.Element
import org.jetbrains.idea.maven.project.MavenProject
import org.jetbrains.idea.maven.utils.MavenJDOMUtil
import java.nio.charset.Charset
import java.nio.file.Path
interface MavenStructureProjectVisitor {
suspend fun readXml(rootProjectFile: Path): Element? {
return MavenJDOMUtil.read(rootProjectFile, Charset.defaultCharset(), null)
}
fun child(aggregatorProjectFile: Path, moduleName: String): Path?
fun map(allProjects: ArrayList<MavenProject>) {
TODO("Not yet implemented")
}

View File

@@ -8,19 +8,6 @@ import java.nio.charset.Charset
import java.nio.file.Path
class SimpleStructureProjectVisitor : MavenStructureProjectVisitor {
override suspend fun readXml(rootProjectFile: Path): Element? {
return MavenJDOMUtil.read(rootProjectFile, Charset.defaultCharset(), null)
}
override fun child(aggregatorProjectFile: Path, moduleName: String): Path? {
val resolve = aggregatorProjectFile.parent.resolve(moduleName)
var file = resolve.toFile()
if (file.isDirectory) {
file = file.resolve("pom.xml")
}
if (file.isFile) return file.toPath();
return null
}
override fun map(allProjects: ArrayList<MavenProject>) {
}

View File

@@ -11,7 +11,7 @@ import com.intellij.internal.statistic.eventLog.events.VarargEventId
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
import com.intellij.openapi.project.Project
internal object MavenActionsUsagesCollector : CounterUsagesCollector() {
object MavenActionsUsagesCollector : CounterUsagesCollector() {
override fun getGroup(): EventLogGroup = GROUP
private val GROUP = EventLogGroup("build.maven.actions", 4)