|
3 | 3 | * |
4 | 4 | * https://mcdev.io/ |
5 | 5 | * |
6 | | - * Copyright (C) 2025 minecraft-dev |
| 6 | + * Copyright (C) 2026 minecraft-dev |
7 | 7 | * |
8 | 8 | * This program is free software: you can redistribute it and/or modify |
9 | 9 | * it under the terms of the GNU Lesser General Public License as published |
@@ -32,14 +32,12 @@ import com.demonwav.mcdev.util.runWriteActionAndWait |
32 | 32 | import com.google.common.collect.HashMultimap |
33 | 33 | import com.intellij.facet.Facet |
34 | 34 | import com.intellij.facet.FacetManager |
| 35 | +import com.intellij.facet.FacetType |
35 | 36 | import com.intellij.facet.FacetTypeId |
36 | 37 | import com.intellij.facet.FacetTypeRegistry |
37 | 38 | import com.intellij.ide.projectView.ProjectView |
38 | | -import com.intellij.openapi.application.runReadAction |
39 | 39 | import com.intellij.openapi.application.runWriteAction |
40 | 40 | import com.intellij.openapi.module.Module |
41 | | -import com.intellij.openapi.module.ModuleGrouper |
42 | | -import com.intellij.openapi.module.ModuleManager |
43 | 41 | import com.intellij.openapi.roots.ModuleRootManager |
44 | 42 | import com.intellij.openapi.vfs.VirtualFile |
45 | 43 | import com.intellij.psi.PsiClass |
@@ -220,14 +218,14 @@ class MinecraftFacet( |
220 | 218 | fun findFile(path: String, type: SourceType): VirtualFile? { |
221 | 219 | try { |
222 | 220 | return findFile0(path, type) |
223 | | - } catch (ignored: RefreshRootsException) { |
| 221 | + } catch (_: RefreshRootsException) { |
224 | 222 | } |
225 | 223 |
|
226 | 224 | updateRoots() |
227 | 225 |
|
228 | 226 | return try { |
229 | 227 | findFile0(path, type) |
230 | | - } catch (ignored: RefreshRootsException) { |
| 228 | + } catch (_: RefreshRootsException) { |
231 | 229 | // Well we tried our best |
232 | 230 | null |
233 | 231 | } |
@@ -261,32 +259,6 @@ class MinecraftFacet( |
261 | 259 |
|
262 | 260 | fun getInstance(module: Module) = FacetManager.getInstance(module).getFacetByType(ID) |
263 | 261 |
|
264 | | - fun getChildInstances(module: Module) = runReadAction run@{ |
265 | | - val instance = getInstance(module) |
266 | | - if (instance != null) { |
267 | | - return@run setOf(instance) |
268 | | - } |
269 | | - |
270 | | - val project = module.project |
271 | | - val manager = ModuleManager.getInstance(project) |
272 | | - val grouper = ModuleGrouper.instanceFor(project) |
273 | | - |
274 | | - val result = mutableSetOf<MinecraftFacet>() |
275 | | - |
276 | | - val modulePath = grouper.getModuleAsGroupPath(module) ?: return@run result |
277 | | - |
278 | | - for (m in manager.modules) { |
279 | | - val path = grouper.getGroupPath(m) |
280 | | - if (modulePath != path) { |
281 | | - continue |
282 | | - } |
283 | | - |
284 | | - val facet = getInstance(m) ?: continue |
285 | | - result.add(facet) |
286 | | - } |
287 | | - return@run result |
288 | | - } |
289 | | - |
290 | 262 | fun <T : AbstractModule> getInstance(module: Module, type: AbstractModuleType<T>) = |
291 | 263 | getInstance(module)?.getModuleOfType(type) |
292 | 264 |
|
|
0 commit comments