mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-191229 rewrite TrackingPathMacroSubstitutor in kotlin
GitOrigin-RevId: f2896077bb0acff4c30d3ad06d604f816af8a10a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e2941fb6d5
commit
b21dd94e70
@@ -44,6 +44,6 @@ public class JavaPathMacroCollectorTest extends LightJavaCodeInsightFixtureTestC
|
||||
</recent_temporary>
|
||||
</component>
|
||||
""";
|
||||
assertTrue(PathMacrosCollector.getMacroNames(JDOMUtil.load(text)).isEmpty());
|
||||
assertTrue(PathMacrosCollector.Companion.getMacroNames(JDOMUtil.load(text)).isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
*/
|
||||
public class PathMacrosCollectorTest extends UsefulTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
@@ -37,7 +34,7 @@ public class PathMacrosCollectorTest extends UsefulTestCase {
|
||||
root.addContent(new Text("$Revision 1.23$"));
|
||||
root.addContent(new Text("file://$root$/some/path/just$file$name.txt"));
|
||||
|
||||
final Set<String> macros = PathMacrosCollector.getMacroNames(root, null, new PathMacrosImpl(false));
|
||||
final Set<String> macros = PathMacrosCollector.Companion.getMacroNames(root, null, new PathMacrosImpl(false));
|
||||
UsefulTestCase.assertSameElements(macros, "MACro1", "macro4", "mac_ro6", "macr.o7", "mac-ro8", "root");
|
||||
}
|
||||
|
||||
@@ -48,7 +45,7 @@ public class PathMacrosCollectorTest extends UsefulTestCase {
|
||||
configuration.setAttribute("value2", "file://$root$/some/path/just$file$name.txt");
|
||||
root.addContent(configuration);
|
||||
|
||||
final Set<String> macros = PathMacrosCollector.getMacroNames(root, new PathMacroFilter() {
|
||||
final Set<String> macros = PathMacrosCollector.Companion.getMacroNames(root, new PathMacroFilter() {
|
||||
@Override
|
||||
public boolean recursePathMacros(@NotNull Attribute attribute) {
|
||||
return "value".equals(attribute.getName());
|
||||
@@ -64,12 +61,12 @@ public class PathMacrosCollectorTest extends UsefulTestCase {
|
||||
testTag.setAttribute("ignore", "$PATH$");
|
||||
root.addContent(testTag);
|
||||
|
||||
final Set<String> macros = PathMacrosCollector.getMacroNames(root, null, new PathMacrosImpl(false));
|
||||
final Set<String> macros = PathMacrosCollector.Companion.getMacroNames(root, null, new PathMacrosImpl(false));
|
||||
assertEquals(2, macros.size());
|
||||
assertTrue(macros.contains("MACRO"));
|
||||
assertTrue(macros.contains("PATH"));
|
||||
|
||||
final Set<String> filtered = PathMacrosCollector.getMacroNames(root, new PathMacroFilter() {
|
||||
final Set<String> filtered = PathMacrosCollector.Companion.getMacroNames(root, new PathMacroFilter() {
|
||||
@Override
|
||||
public boolean skipPathMacros(@NotNull Attribute attribute) {
|
||||
return "ignore".equals(attribute.getName());
|
||||
|
||||
@@ -4,12 +4,15 @@ f:com.intellij.application.options.PathMacroExpandableProtocolBean
|
||||
- <init>():V
|
||||
f:com.intellij.application.options.PathMacrosCollector
|
||||
- com.intellij.openapi.components.PathMacroMap
|
||||
- sf:Companion:com.intellij.application.options.PathMacrosCollector$Companion
|
||||
- sf:MACRO_FILTER_EXTENSION_POINT_NAME:com.intellij.openapi.extensions.ExtensionPointName
|
||||
- sf:MACRO_PATTERN:java.util.regex.Pattern
|
||||
- s:getMacroNames(org.jdom.Element):java.util.Set
|
||||
- equals(java.lang.Object):Z
|
||||
- hashCode():I
|
||||
- substitute(java.lang.String,Z):java.lang.String
|
||||
- substituteRecursively(java.lang.String,Z):java.lang.CharSequence
|
||||
f:com.intellij.application.options.PathMacrosCollector$Companion
|
||||
- f:getMacroNames(org.jdom.Element):java.util.Set
|
||||
f:com.intellij.application.options.ReplacePathToMacroMap
|
||||
- com.intellij.openapi.components.PathMacroMap
|
||||
- <init>():V
|
||||
|
||||
+10
-32
@@ -1,39 +1,17 @@
|
||||
/*
|
||||
* Copyright 2000-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.components;
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.components
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
@Internal
|
||||
interface TrackingPathMacroSubstitutor : PathMacroSubstitutor {
|
||||
fun getUnknownMacros(componentName: String?): Set<String>
|
||||
|
||||
@ApiStatus.Internal
|
||||
public interface TrackingPathMacroSubstitutor extends PathMacroSubstitutor {
|
||||
@NotNull
|
||||
Set<String> getUnknownMacros(@Nullable String componentName);
|
||||
fun getComponents(macros: Collection<String>): Set<String>
|
||||
|
||||
// Mutable set
|
||||
@NotNull
|
||||
Set<String> getComponents(@NotNull Collection<String> macros);
|
||||
fun addUnknownMacros(componentName: String, unknownMacros: Collection<String>)
|
||||
|
||||
void addUnknownMacros(@NotNull String componentName, @NotNull Collection<String> unknownMacros);
|
||||
fun invalidateUnknownMacros(macros: Set<String>)
|
||||
|
||||
void invalidateUnknownMacros(@NotNull Set<String> macros);
|
||||
|
||||
void reset();
|
||||
fun reset()
|
||||
}
|
||||
|
||||
+1
-3
@@ -32,9 +32,7 @@ object ComponentStorageUtil {
|
||||
pathMacroSubstitutor?.expandPaths(rootElement)
|
||||
|
||||
var children = rootElement.getChildren(COMPONENT)
|
||||
if (children.isEmpty() &&
|
||||
rootElement.name == COMPONENT &&
|
||||
rootElement.getAttributeValue(NAME) != null) {
|
||||
if (children.isEmpty() && rootElement.name == COMPONENT && rootElement.getAttributeValue(NAME) != null) {
|
||||
// must be modifiable
|
||||
children = SmartList(rootElement)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user