mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
IJPL-159596 prefer SynchronizedClearableLazy
GitOrigin-RevId: 0409e7a776832a4f30e02106edc390dbddd8bf52
This commit is contained in:
committed by
intellij-monorepo-bot
parent
24f3b86d83
commit
1ed0c32b06
@@ -132,6 +132,7 @@ f:com.intellij.openapi.extensions.ExtensionPointName$Companion
|
||||
f:com.intellij.openapi.extensions.ExtensionPointUtil
|
||||
- s:createKeyedExtensionDisposable(java.lang.Object,com.intellij.openapi.extensions.ExtensionPoint):com.intellij.openapi.Disposable
|
||||
- s:dropLazyValueOnChange(com.intellij.openapi.util.ClearableLazyValue,com.intellij.openapi.extensions.ExtensionPointName,com.intellij.openapi.Disposable):com.intellij.openapi.util.ClearableLazyValue
|
||||
- s:dropLazyValueOnChange(com.intellij.util.concurrency.SynchronizedClearableLazy,com.intellij.openapi.extensions.ExtensionPointName,com.intellij.openapi.Disposable):java.util.function.Supplier
|
||||
f:com.intellij.openapi.extensions.Extensions
|
||||
- s:findExtension(com.intellij.openapi.extensions.ExtensionPointName,java.lang.Class):java.lang.Object
|
||||
- s:getArea(com.intellij.openapi.extensions.AreaInstance):com.intellij.openapi.extensions.ExtensionsArea
|
||||
|
||||
@@ -7,14 +7,15 @@ import com.intellij.openapi.extensions.impl.ExtensionPointImpl;
|
||||
import com.intellij.openapi.util.ClearableLazyValue;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.KeyedLazyInstance;
|
||||
import com.intellij.util.concurrency.SynchronizedClearableLazy;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class ExtensionPointUtil {
|
||||
|
||||
private ExtensionPointUtil() { }
|
||||
|
||||
public static @NotNull <V extends ClearableLazyValue<?>> V dropLazyValueOnChange(@NotNull V lazyValue,
|
||||
@@ -24,6 +25,13 @@ public final class ExtensionPointUtil {
|
||||
return lazyValue;
|
||||
}
|
||||
|
||||
public static <T> @NotNull Supplier<T> dropLazyValueOnChange(@NotNull SynchronizedClearableLazy<T> lazyValue,
|
||||
@NotNull ExtensionPointName<?> extensionPointName,
|
||||
@Nullable Disposable parentDisposable) {
|
||||
extensionPointName.addChangeListener(lazyValue::drop, parentDisposable);
|
||||
return lazyValue;
|
||||
}
|
||||
|
||||
@Internal
|
||||
public static @NotNull <T> Disposable createExtensionDisposable(@NotNull T extensionObject,
|
||||
@NotNull ExtensionPointName<T> extensionPointName) {
|
||||
|
||||
@@ -4,7 +4,6 @@ package com.intellij.util.gist.storage;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -14,12 +13,14 @@ import com.intellij.openapi.vfs.VirtualFileWithId;
|
||||
import com.intellij.openapi.vfs.newvfs.AttributeInputStream;
|
||||
import com.intellij.openapi.vfs.newvfs.AttributeOutputStream;
|
||||
import com.intellij.openapi.vfs.newvfs.FileAttribute;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.VFSAttributesStorage;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.FSRecords;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.FSRecordsImpl;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.VFSAttributesStorage;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.log.VfsLog;
|
||||
import com.intellij.serviceContainer.AlreadyDisposedException;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
import com.intellij.util.concurrency.SynchronizedClearableLazy;
|
||||
import com.intellij.util.containers.CollectionFactory;
|
||||
import com.intellij.util.containers.FactoryMap;
|
||||
import com.intellij.util.io.DataExternalizer;
|
||||
@@ -33,13 +34,11 @@ import org.jetbrains.annotations.VisibleForTesting;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import static com.intellij.util.SystemProperties.getIntProperty;
|
||||
import static com.intellij.util.io.IOUtil.KiB;
|
||||
import static java.nio.file.StandardOpenOption.*;
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Implementation stores small gists (<= {@link #MAX_GIST_SIZE_TO_STORE_IN_ATTRIBUTES} in VFS file attributes,
|
||||
@@ -54,12 +53,12 @@ public final class GistStorageImpl extends GistStorage {
|
||||
* Value should be < {@link VFSAttributesStorage#MAX_ATTRIBUTE_VALUE_SIZE}
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public static final int MAX_GIST_SIZE_TO_STORE_IN_ATTRIBUTES = getIntProperty("idea.gist.max-size-to-store-in-attributes", 50 * KiB);
|
||||
public static final int MAX_GIST_SIZE_TO_STORE_IN_ATTRIBUTES = SystemProperties.getIntProperty("idea.gist.max-size-to-store-in-attributes", 50 * IOUtil.KiB);
|
||||
|
||||
private static final String HUGE_GISTS_DIR_NAME = "huge-gists";
|
||||
|
||||
/** `{caches}/huge-gists/{FSRecords.createdTimestamp}/' */
|
||||
private static final NotNullLazyValue<Path> DIR_FOR_HUGE_GISTS = NotNullLazyValue.atomicLazy(() -> {
|
||||
private static final Supplier<Path> DIR_FOR_HUGE_GISTS = new SynchronizedClearableLazy<>(() -> {
|
||||
final String vfsStamp = Long.toString(FSRecords.getCreationTimestamp());
|
||||
Path gistsDir = FSRecords.getCacheDir().resolve(HUGE_GISTS_DIR_NAME + "/" + vfsStamp);
|
||||
try {
|
||||
@@ -95,7 +94,7 @@ public final class GistStorageImpl extends GistStorage {
|
||||
// remove {caches}/huge-gists/{fsrecords-timestamp} dirs there {fsrecords-timestamp} != FSRecords.getCreatedTimestamp()
|
||||
AppExecutorUtil.getAppScheduledExecutorService().schedule(
|
||||
GistStorageImpl::cleanupAncientGistsDirs,
|
||||
1, MINUTES
|
||||
1, TimeUnit.MINUTES
|
||||
);
|
||||
}
|
||||
|
||||
@@ -247,7 +246,7 @@ public final class GistStorageImpl extends GistStorage {
|
||||
//looks like data corruption: if gist value was indeed null, we would have stored it as VALUE_KIND_NULL
|
||||
throw new IOException("Gist file [" + gistPath + "] doesn't exist -> looks like data corruption?");
|
||||
}
|
||||
try (DataInputStream gistStream = new DataInputStream(Files.newInputStream(gistPath, READ))) {
|
||||
try (DataInputStream gistStream = new DataInputStream(Files.newInputStream(gistPath, StandardOpenOption.READ))) {
|
||||
return GistData.valid(
|
||||
externalizer.read(gistStream),
|
||||
gistRecord.gistStamp
|
||||
@@ -468,7 +467,7 @@ public final class GistStorageImpl extends GistStorage {
|
||||
IOUtil.writeUTF(attributeStream, gistFileSuffix);
|
||||
|
||||
Path gistPath = dedicatedGistFilePath(file, gistFileSuffix);
|
||||
try (DataOutputStream gistFileStream = new DataOutputStream(Files.newOutputStream(gistPath, WRITE, CREATE))) {
|
||||
try (DataOutputStream gistFileStream = new DataOutputStream(Files.newOutputStream(gistPath, StandardOpenOption.WRITE, StandardOpenOption.CREATE))) {
|
||||
gistFileStream.write(outputStream.getInternalBuffer(), 0, outputStream.size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21869,7 +21869,6 @@ a:com.intellij.remote.ui.CreateRemoteSdkDialog
|
||||
- com.intellij.remote.ui.RemoteSdkEditorContainer
|
||||
- pf:myExistingSdks:java.util.Collection
|
||||
- pf:myProject:com.intellij.openapi.project.Project
|
||||
- pf:mySdkFactoryProvider:com.intellij.openapi.util.NotNullLazyValue
|
||||
- <init>(com.intellij.openapi.project.Project,java.util.Collection):V
|
||||
- <init>(java.awt.Component,java.util.Collection):V
|
||||
- p:createCenterPanel():javax.swing.JComponent
|
||||
|
||||
@@ -12,12 +12,12 @@ import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.ValidationInfo;
|
||||
import com.intellij.openapi.util.NlsContexts;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.remote.RemoteSdkAdditionalData;
|
||||
import com.intellij.remote.RemoteSdkException;
|
||||
import com.intellij.remote.RemoteSdkFactoryImpl;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import com.intellij.util.concurrency.SynchronizedClearableLazy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
@@ -25,13 +25,14 @@ import org.jetbrains.annotations.TestOnly;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class CreateRemoteSdkDialog<T extends RemoteSdkAdditionalData> extends DialogWrapper implements RemoteSdkEditorContainer {
|
||||
private static final Logger LOG = Logger.getInstance(CreateRemoteSdkDialog.class);
|
||||
protected final @Nullable Project myProject;
|
||||
private CreateRemoteSdkForm<T> myInterpreterForm;
|
||||
private Sdk mySdk;
|
||||
protected final NotNullLazyValue<RemoteSdkFactoryImpl<T>> mySdkFactoryProvider = NotNullLazyValue.atomicLazy(this::createRemoteSdkFactory);
|
||||
private final Supplier<RemoteSdkFactoryImpl<T>> sdkFactoryProvider = new SynchronizedClearableLazy<>(this::createRemoteSdkFactory);
|
||||
private @Nullable T myOriginalData;
|
||||
protected final Collection<Sdk> myExistingSdks;
|
||||
|
||||
@@ -50,7 +51,7 @@ public abstract class CreateRemoteSdkDialog<T extends RemoteSdkAdditionalData> e
|
||||
protected abstract @NotNull RemoteSdkFactoryImpl<T> createRemoteSdkFactory();
|
||||
|
||||
protected RemoteSdkFactoryImpl<T> getSdkFactory() {
|
||||
return mySdkFactoryProvider.getValue();
|
||||
return sdkFactoryProvider.get();
|
||||
}
|
||||
|
||||
private @NotNull CreateRemoteSdkForm<T> getInterpreterForm() {
|
||||
@@ -103,7 +104,6 @@ public abstract class CreateRemoteSdkDialog<T extends RemoteSdkAdditionalData> e
|
||||
return getSdkFactory().createRemoteSdk(myProject, data, getInterpreterForm().getSdkName(), myExistingSdks);
|
||||
}
|
||||
|
||||
|
||||
private @Nullable Sdk saveUnfinished() {
|
||||
final T data;
|
||||
try {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.concurrency.SynchronizedClearableLazy;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -13,21 +13,12 @@ import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class MemTester {
|
||||
private MemTester() { }
|
||||
|
||||
/**
|
||||
* Checks if userspace memtester is supported on this platform and can be launched.
|
||||
*
|
||||
* @return true if memtester can be launched, otherwise false
|
||||
*/
|
||||
public static boolean isSupported() {
|
||||
return ourMemTesterSupported.getValue();
|
||||
}
|
||||
|
||||
private static Boolean isRunning = false;
|
||||
|
||||
private static final NotNullLazyValue<Boolean> ourMemTesterSupported = NotNullLazyValue.atomicLazy(() -> {
|
||||
private static final Supplier<Boolean> ourMemTesterSupported = new SynchronizedClearableLazy<>(() -> {
|
||||
String problem;
|
||||
|
||||
if (SystemInfo.isWindows) {
|
||||
@@ -52,6 +43,17 @@ public final class MemTester {
|
||||
}
|
||||
});
|
||||
|
||||
private static Boolean isRunning = false;
|
||||
|
||||
/**
|
||||
* Checks if userspace memtester is supported on this platform and can be launched.
|
||||
*
|
||||
* @return true if memtester can be launched, otherwise false
|
||||
*/
|
||||
public static boolean isSupported() {
|
||||
return ourMemTesterSupported.get();
|
||||
}
|
||||
|
||||
private static String checkMemTester(String memtesterName) {
|
||||
Path memtester = PathManager.findBinFile(memtesterName);
|
||||
return memtester != null && Files.isExecutable(memtester) ? null : "not an executable file: " + memtester;
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.platform.workspace.jps;
|
||||
|
||||
import com.intellij.openapi.util.ClearableLazyValue;
|
||||
import com.intellij.platform.diagnostic.telemetry.PlatformScopesKt;
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.SharedMetrics;
|
||||
import com.intellij.util.concurrency.SynchronizedClearableLazy;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public final class JpsMetrics extends SharedMetrics {
|
||||
private static final @NotNull ClearableLazyValue<JpsMetrics> _instance = ClearableLazyValue.createAtomic(() -> new JpsMetrics());
|
||||
private static final @NotNull Supplier<JpsMetrics> _instance = new SynchronizedClearableLazy<>(() -> new JpsMetrics());
|
||||
|
||||
private JpsMetrics() { super(PlatformScopesKt.JPS); }
|
||||
|
||||
public static JpsMetrics getInstance() {
|
||||
return _instance.getValue();
|
||||
return _instance.get();
|
||||
}
|
||||
|
||||
public static final String jpsSyncSpanName = "jps.sync";
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.plugins.groovy;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionUtilCore;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.util.NullableLazyValue;
|
||||
import com.intellij.openapi.util.io.StreamUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.util.concurrency.SynchronizedClearableLazy;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -24,211 +23,207 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.intellij.openapi.util.NullableLazyValue.atomicLazyNullable;
|
||||
final class MavenGroovyPolyglotPomMemberContributor extends NonCodeMembersContributor {
|
||||
private static final Supplier<Collection<Contributor>> contributors = new SynchronizedClearableLazy<>(() -> {
|
||||
List<Contributor> list = new ArrayList<>();
|
||||
list.add(new Contributor("/maven/dsl/groovy/pom.groovy", ""));
|
||||
list.add(new Contributor("/maven/dsl/groovy/model.groovy", "project"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/modelBase.groovy",
|
||||
"project", "project->profiles->profile"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/parent.groovy", "project->parent"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/organization.groovy", "project->organization"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/licenses.groovy", "project->licenses"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/license.groovy", "project->licenses->license"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/developers.groovy", "project->developers"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/developer.groovy", "project->developers->developer"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/contributor.groovy",
|
||||
"project->developers->developer", "project->contributors->contributor"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/contributors.groovy", "project->contributors"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/modules.groovy", "project->modules"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/dependencyManagement.groovy",
|
||||
"project->dependencyManagement",
|
||||
"project->profiles->profile->dependencyManagement"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/distributionManagement.groovy",
|
||||
"project->distributionManagement",
|
||||
"project->profiles->profile->distributionManagement"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/site.groovy",
|
||||
"project->distributionManagement->site",
|
||||
"project->profiles->profile->distributionManagement->site"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/relocation.groovy",
|
||||
"project->distributionManagement->relocation",
|
||||
"project->profiles->profile->distributionManagement->relocation"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/deploymentRepository.groovy",
|
||||
"project->distributionManagement->repository",
|
||||
"project->profiles->profile->distributionManagement->repository",
|
||||
"project->distributionManagement->snapshotRepository",
|
||||
"project->profiles->profile->distributionManagement->snapshotRepository"));
|
||||
|
||||
|
||||
public final class MavenGroovyPolyglotPomMemberContributor extends NonCodeMembersContributor {
|
||||
list.add(new Contributor("/maven/dsl/groovy/dependencies.groovy",
|
||||
"project->dependencies",
|
||||
"project->dependencyManagement->dependencies",
|
||||
"project->profiles->profile->dependencies",
|
||||
"project->profiles->profile->dependencyManagement->dependencies",
|
||||
"project->build->pluginManagement->plugins->plugin->dependencies",
|
||||
"project->build->plugins->plugin->dependencies",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->dependencies",
|
||||
"project->profiles->profile->build->plugins->plugin->dependencies"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/dependency.groovy",
|
||||
"project->dependencies->dependency",
|
||||
"project->dependencyManagement->dependencies->dependency",
|
||||
"project->profiles->profile->dependencies->dependency",
|
||||
"project->profiles->profile->dependencyManagement->dependencies->dependency",
|
||||
"project->build->plugins->plugin->dependencies->dependency",
|
||||
"project->build->pluginManagement->plugins->plugin->dependencies->dependency",
|
||||
"project->profiles->profile->build->plugins->plugin->dependencies->dependency",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->dependencies->dependency"));
|
||||
|
||||
private static final NotNullLazyValue<Collection<Contributor>> contributors =
|
||||
NotNullLazyValue.atomicLazy(() -> {
|
||||
List<Contributor> list = new ArrayList<>();
|
||||
list.add(new Contributor("/maven/dsl/groovy/pom.groovy", ""));
|
||||
list.add(new Contributor("/maven/dsl/groovy/model.groovy", "project"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/modelBase.groovy",
|
||||
"project", "project->profiles->profile"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/parent.groovy", "project->parent"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/organization.groovy", "project->organization"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/licenses.groovy", "project->licenses"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/license.groovy", "project->licenses->license"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/exclusions.groovy",
|
||||
"project->dependencies->dependency->exclusions",
|
||||
"project->dependencyManagement->dependencies->dependency->exclusions",
|
||||
"project->profiles->profile->dependencies->dependency->exclusions",
|
||||
"project->profiles->profile->dependencyManagement->dependencies->dependency->exclusions",
|
||||
"project->build->plugins->plugin->dependencies->dependency->exclusions",
|
||||
"project->build->pluginManagement->plugins->plugin->dependencies->dependency->exclusions",
|
||||
"project->profiles->profile->build->plugins->plugin->dependencies->dependency->exclusions",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->dependencies->dependency->exclusions"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/exclusion.groovy",
|
||||
"project->dependencies->dependency->exclusions->exclusion",
|
||||
"project->dependencyManagement->dependencies->dependency->exclusions->exclusion",
|
||||
"project->profiles->profile->dependencies->dependency->exclusions->exclusion",
|
||||
"project->profiles->profile->dependencyManagement->dependencies->dependency->exclusions->exclusion",
|
||||
"project->build->plugins->plugin->dependencies->dependency->exclusions->exclusion",
|
||||
"project->build->pluginManagement->plugins->plugin->dependencies->dependency->exclusions->exclusion",
|
||||
"project->profiles->profile->build->plugins->plugin->dependencies->dependency->exclusions->exclusion",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->dependencies->dependency->exclusions->exclusion"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/developers.groovy", "project->developers"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/developer.groovy", "project->developers->developer"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/contributor.groovy",
|
||||
"project->developers->developer", "project->contributors->contributor"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/contributors.groovy", "project->contributors"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/repositories.groovy",
|
||||
"project->repositories",
|
||||
"project->profiles->profile->repositories"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/pluginRepositories.groovy",
|
||||
"project->pluginRepositories",
|
||||
"project->profiles->profile->pluginRepositories"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/repository.groovy",
|
||||
"project->repositories->repository",
|
||||
"project->distributionManagement->repository",
|
||||
"project->distributionManagement->snapshotRepository",
|
||||
"project->pluginRepositories->pluginRepository",
|
||||
"project->profiles->profile->repositories->repository",
|
||||
"project->profiles->profile->pluginRepositories->pluginRepository",
|
||||
"project->profiles->profile->distributionManagement->repository",
|
||||
"project->profiles->profile->distributionManagement->snapshotRepository"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/repositoryPolicy.groovy",
|
||||
"project->repositories->repository->releases",
|
||||
"project->repositories->repository->snapshots",
|
||||
"project->distributionManagement->repository->releases",
|
||||
"project->distributionManagement->repository->snapshots",
|
||||
"project->distributionManagement->snapshotRepository->releases",
|
||||
"project->distributionManagement->snapshotRepository->snapshots",
|
||||
"project->pluginRepositories->pluginRepository->releases",
|
||||
"project->pluginRepositories->pluginRepository->snapshots",
|
||||
"project->profiles->profile->repositories->repository->releases",
|
||||
"project->profiles->profile->repositories->repository->snapshots",
|
||||
"project->profiles->profile->distributionManagement->repository->releases",
|
||||
"project->profiles->profile->distributionManagement->repository->snapshots",
|
||||
"project->profiles->profile->distributionManagement->snapshotRepository->releases",
|
||||
"project->profiles->profile->distributionManagement->snapshotRepository->snapshots",
|
||||
"project->profiles->profile->pluginRepositories->pluginRepository->releases",
|
||||
"project->profiles->profile->pluginRepositories->pluginRepository->snapshots"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/modules.groovy", "project->modules"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/build.groovy",
|
||||
"project->build",
|
||||
"project->profiles->profile->build"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/extensions.groovy",
|
||||
"project->build->extensions",
|
||||
"project->profiles->profile->build->extensions"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/extension.groovy",
|
||||
"project->build->extensions->extension",
|
||||
"project->profiles->profile->build->extensions->extension"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/resources.groovy",
|
||||
"project->build->resources",
|
||||
"project->profiles->profile->build->resources"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/testResources.groovy",
|
||||
"project->build->testResources",
|
||||
"project->profiles->profile->build->testResources"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/resource.groovy",
|
||||
"project->build->resources->resource",
|
||||
"project->build->testResources->testResource",
|
||||
"project->profiles->profile->build->resources->resource",
|
||||
"project->profiles->profile->build->testResources->testResource"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/dependencyManagement.groovy",
|
||||
"project->dependencyManagement",
|
||||
"project->profiles->profile->dependencyManagement"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/distributionManagement.groovy",
|
||||
"project->distributionManagement",
|
||||
"project->profiles->profile->distributionManagement"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/site.groovy",
|
||||
"project->distributionManagement->site",
|
||||
"project->profiles->profile->distributionManagement->site"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/relocation.groovy",
|
||||
"project->distributionManagement->relocation",
|
||||
"project->profiles->profile->distributionManagement->relocation"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/pluginConfiguration.groovy",
|
||||
"project->build",
|
||||
"project->profiles->profile->build"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/pluginContainer.groovy",
|
||||
"project->build",
|
||||
"project->build->pluginManagement",
|
||||
"project->profiles->profile->build",
|
||||
"project->profiles->profile->build->pluginManagement"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/plugins.groovy",
|
||||
"project->build->plugins",
|
||||
"project->build->pluginManagement->plugins",
|
||||
"project->profiles->profile->build->plugins",
|
||||
"project->profiles->profile->build->pluginManagement->plugins",
|
||||
"project->reporting->plugins",
|
||||
"project->profiles->profile->reporting->plugins"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/plugin.groovy",
|
||||
"project->build->plugins->plugin",
|
||||
"project->build->pluginManagement->plugins->plugin",
|
||||
"project->profiles->profile->build->plugins->plugin",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/configurationContainer.groovy",
|
||||
"project->build->plugins->plugin",
|
||||
"project->build->plugins->plugin->executions->execution",
|
||||
"project->build->pluginManagement->plugins->plugin",
|
||||
"project->build->pluginManagement->plugins->plugin->executions->execution",
|
||||
"project->reporting->plugins->plugin",
|
||||
"project->reporting->plugins->plugin->reportSets->reportSet",
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/deploymentRepository.groovy",
|
||||
"project->distributionManagement->repository",
|
||||
"project->profiles->profile->distributionManagement->repository",
|
||||
"project->distributionManagement->snapshotRepository",
|
||||
"project->profiles->profile->distributionManagement->snapshotRepository"));
|
||||
"project->profiles->profile->build->plugins->plugin",
|
||||
"project->profiles->profile->build->plugins->plugin->executions->execution",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->executions->execution",
|
||||
"project->profiles->profile->reporting->plugins->plugin",
|
||||
"project->profiles->profile->reporting->plugins->plugin->reportSets->reportSet"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/executions.groovy",
|
||||
"project->build->plugins->plugin->executions",
|
||||
"project->build->pluginManagement->plugins->plugin->executions",
|
||||
"project->profiles->profile->build->plugins->plugin->executions",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->executions"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/pluginExecution.groovy",
|
||||
"project->build->plugins->plugin->executions->execution",
|
||||
"project->build->pluginManagement->plugins->plugin->executions->execution",
|
||||
"project->profiles->profile->build->plugins->plugin->executions->execution",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->executions->execution"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/dependencies.groovy",
|
||||
"project->dependencies",
|
||||
"project->dependencyManagement->dependencies",
|
||||
"project->profiles->profile->dependencies",
|
||||
"project->profiles->profile->dependencyManagement->dependencies",
|
||||
"project->build->pluginManagement->plugins->plugin->dependencies",
|
||||
"project->build->plugins->plugin->dependencies",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->dependencies",
|
||||
"project->profiles->profile->build->plugins->plugin->dependencies"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/dependency.groovy",
|
||||
"project->dependencies->dependency",
|
||||
"project->dependencyManagement->dependencies->dependency",
|
||||
"project->profiles->profile->dependencies->dependency",
|
||||
"project->profiles->profile->dependencyManagement->dependencies->dependency",
|
||||
"project->build->plugins->plugin->dependencies->dependency",
|
||||
"project->build->pluginManagement->plugins->plugin->dependencies->dependency",
|
||||
"project->profiles->profile->build->plugins->plugin->dependencies->dependency",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->dependencies->dependency"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/reporting.groovy", "project->reporting", "project->profiles->profile->reporting"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/reportPlugin.groovy",
|
||||
"project->reporting->plugins->plugin",
|
||||
"project->profiles->profile->reporting->plugins->plugin"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/reportSets.groovy",
|
||||
"project->reporting->plugins->plugin->reportSets",
|
||||
"project->profiles->profile->reporting->plugins->plugin->reportSets"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/reportSet.groovy",
|
||||
"project->reporting->plugins->plugin->reportSets->reportSet",
|
||||
"project->profiles->profile->reporting->plugins->plugin->reportSets->reportSet"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/exclusions.groovy",
|
||||
"project->dependencies->dependency->exclusions",
|
||||
"project->dependencyManagement->dependencies->dependency->exclusions",
|
||||
"project->profiles->profile->dependencies->dependency->exclusions",
|
||||
"project->profiles->profile->dependencyManagement->dependencies->dependency->exclusions",
|
||||
"project->build->plugins->plugin->dependencies->dependency->exclusions",
|
||||
"project->build->pluginManagement->plugins->plugin->dependencies->dependency->exclusions",
|
||||
"project->profiles->profile->build->plugins->plugin->dependencies->dependency->exclusions",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->dependencies->dependency->exclusions"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/exclusion.groovy",
|
||||
"project->dependencies->dependency->exclusions->exclusion",
|
||||
"project->dependencyManagement->dependencies->dependency->exclusions->exclusion",
|
||||
"project->profiles->profile->dependencies->dependency->exclusions->exclusion",
|
||||
"project->profiles->profile->dependencyManagement->dependencies->dependency->exclusions->exclusion",
|
||||
"project->build->plugins->plugin->dependencies->dependency->exclusions->exclusion",
|
||||
"project->build->pluginManagement->plugins->plugin->dependencies->dependency->exclusions->exclusion",
|
||||
"project->profiles->profile->build->plugins->plugin->dependencies->dependency->exclusions->exclusion",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->dependencies->dependency->exclusions->exclusion"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/profiles.groovy", "project->profiles"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/profile.groovy", "project->profiles->profile"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/activation.groovy", "project->profiles->profile->activation"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/os.groovy", "project->profiles->profile->activation->os"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/property.groovy",
|
||||
"project->profiles->profile->activation->property"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/activationFile.groovy", "project->profiles->profile->activation->file"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/repositories.groovy",
|
||||
"project->repositories",
|
||||
"project->profiles->profile->repositories"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/pluginRepositories.groovy",
|
||||
"project->pluginRepositories",
|
||||
"project->profiles->profile->pluginRepositories"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/repository.groovy",
|
||||
"project->repositories->repository",
|
||||
"project->distributionManagement->repository",
|
||||
"project->distributionManagement->snapshotRepository",
|
||||
"project->pluginRepositories->pluginRepository",
|
||||
"project->profiles->profile->repositories->repository",
|
||||
"project->profiles->profile->pluginRepositories->pluginRepository",
|
||||
"project->profiles->profile->distributionManagement->repository",
|
||||
"project->profiles->profile->distributionManagement->snapshotRepository"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/repositoryPolicy.groovy",
|
||||
"project->repositories->repository->releases",
|
||||
"project->repositories->repository->snapshots",
|
||||
"project->distributionManagement->repository->releases",
|
||||
"project->distributionManagement->repository->snapshots",
|
||||
"project->distributionManagement->snapshotRepository->releases",
|
||||
"project->distributionManagement->snapshotRepository->snapshots",
|
||||
"project->pluginRepositories->pluginRepository->releases",
|
||||
"project->pluginRepositories->pluginRepository->snapshots",
|
||||
"project->profiles->profile->repositories->repository->releases",
|
||||
"project->profiles->profile->repositories->repository->snapshots",
|
||||
"project->profiles->profile->distributionManagement->repository->releases",
|
||||
"project->profiles->profile->distributionManagement->repository->snapshots",
|
||||
"project->profiles->profile->distributionManagement->snapshotRepository->releases",
|
||||
"project->profiles->profile->distributionManagement->snapshotRepository->snapshots",
|
||||
"project->profiles->profile->pluginRepositories->pluginRepository->releases",
|
||||
"project->profiles->profile->pluginRepositories->pluginRepository->snapshots"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/build.groovy",
|
||||
"project->build",
|
||||
"project->profiles->profile->build"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/extensions.groovy",
|
||||
"project->build->extensions",
|
||||
"project->profiles->profile->build->extensions"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/extension.groovy",
|
||||
"project->build->extensions->extension",
|
||||
"project->profiles->profile->build->extensions->extension"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/resources.groovy",
|
||||
"project->build->resources",
|
||||
"project->profiles->profile->build->resources"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/testResources.groovy",
|
||||
"project->build->testResources",
|
||||
"project->profiles->profile->build->testResources"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/resource.groovy",
|
||||
"project->build->resources->resource",
|
||||
"project->build->testResources->testResource",
|
||||
"project->profiles->profile->build->resources->resource",
|
||||
"project->profiles->profile->build->testResources->testResource"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/pluginConfiguration.groovy",
|
||||
"project->build",
|
||||
"project->profiles->profile->build"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/pluginContainer.groovy",
|
||||
"project->build",
|
||||
"project->build->pluginManagement",
|
||||
"project->profiles->profile->build",
|
||||
"project->profiles->profile->build->pluginManagement"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/plugins.groovy",
|
||||
"project->build->plugins",
|
||||
"project->build->pluginManagement->plugins",
|
||||
"project->profiles->profile->build->plugins",
|
||||
"project->profiles->profile->build->pluginManagement->plugins",
|
||||
"project->reporting->plugins",
|
||||
"project->profiles->profile->reporting->plugins"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/plugin.groovy",
|
||||
"project->build->plugins->plugin",
|
||||
"project->build->pluginManagement->plugins->plugin",
|
||||
"project->profiles->profile->build->plugins->plugin",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/configurationContainer.groovy",
|
||||
"project->build->plugins->plugin",
|
||||
"project->build->plugins->plugin->executions->execution",
|
||||
"project->build->pluginManagement->plugins->plugin",
|
||||
"project->build->pluginManagement->plugins->plugin->executions->execution",
|
||||
"project->reporting->plugins->plugin",
|
||||
"project->reporting->plugins->plugin->reportSets->reportSet",
|
||||
|
||||
"project->profiles->profile->build->plugins->plugin",
|
||||
"project->profiles->profile->build->plugins->plugin->executions->execution",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->executions->execution",
|
||||
"project->profiles->profile->reporting->plugins->plugin",
|
||||
"project->profiles->profile->reporting->plugins->plugin->reportSets->reportSet"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/executions.groovy",
|
||||
"project->build->plugins->plugin->executions",
|
||||
"project->build->pluginManagement->plugins->plugin->executions",
|
||||
"project->profiles->profile->build->plugins->plugin->executions",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->executions"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/pluginExecution.groovy",
|
||||
"project->build->plugins->plugin->executions->execution",
|
||||
"project->build->pluginManagement->plugins->plugin->executions->execution",
|
||||
"project->profiles->profile->build->plugins->plugin->executions->execution",
|
||||
"project->profiles->profile->build->pluginManagement->plugins->plugin->executions->execution"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/reporting.groovy", "project->reporting", "project->profiles->profile->reporting"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/reportPlugin.groovy",
|
||||
"project->reporting->plugins->plugin",
|
||||
"project->profiles->profile->reporting->plugins->plugin"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/reportSets.groovy",
|
||||
"project->reporting->plugins->plugin->reportSets",
|
||||
"project->profiles->profile->reporting->plugins->plugin->reportSets"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/reportSet.groovy",
|
||||
"project->reporting->plugins->plugin->reportSets->reportSet",
|
||||
"project->profiles->profile->reporting->plugins->plugin->reportSets->reportSet"));
|
||||
|
||||
list.add(new Contributor("/maven/dsl/groovy/profiles.groovy", "project->profiles"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/profile.groovy", "project->profiles->profile"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/activation.groovy", "project->profiles->profile->activation"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/os.groovy", "project->profiles->profile->activation->os"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/property.groovy",
|
||||
"project->profiles->profile->activation->property"));
|
||||
list.add(new Contributor("/maven/dsl/groovy/activationFile.groovy", "project->profiles->profile->activation->file"));
|
||||
|
||||
return list;
|
||||
});
|
||||
return list;
|
||||
});
|
||||
|
||||
@Override
|
||||
public void processDynamicElements(@NotNull PsiType qualifierType,
|
||||
@@ -249,7 +244,7 @@ public final class MavenGroovyPolyglotPomMemberContributor extends NonCodeMember
|
||||
MultiMap<String, String> leafMap = MultiMap.createLinked();
|
||||
|
||||
String key = StringUtil.join(methodCallInfo, "->");
|
||||
for (Contributor contributor : contributors.getValue()) {
|
||||
for (Contributor contributor : contributors.get()) {
|
||||
contributor.populate(place.getProject(), multiMap, leafMap);
|
||||
}
|
||||
|
||||
@@ -272,15 +267,15 @@ public final class MavenGroovyPolyglotPomMemberContributor extends NonCodeMember
|
||||
}
|
||||
}
|
||||
|
||||
private static class Contributor {
|
||||
private static final class Contributor {
|
||||
private final String myClassSourcePath;
|
||||
private final String[] myPaths;
|
||||
private final NullableLazyValue<String> myClassSourceValue;
|
||||
private final Supplier<String> myClassSourceValue;
|
||||
|
||||
Contributor(@NotNull String classSourcePath, String... paths) {
|
||||
myClassSourcePath = classSourcePath;
|
||||
myPaths = paths;
|
||||
myClassSourceValue = atomicLazyNullable(() -> {
|
||||
myClassSourceValue = new SynchronizedClearableLazy<>(() -> {
|
||||
try (InputStream stream = MavenGroovyPolyglotPomMemberContributor.class.getResourceAsStream(myClassSourcePath)) {
|
||||
if (stream != null) {
|
||||
return StreamUtil.readText(new InputStreamReader(stream, StandardCharsets.UTF_8));
|
||||
@@ -292,7 +287,7 @@ public final class MavenGroovyPolyglotPomMemberContributor extends NonCodeMember
|
||||
}
|
||||
|
||||
public void populate(@NotNull Project project, @NotNull MultiMap<String, String> map, @NotNull MultiMap<String, String> leafMap) {
|
||||
String myClassSource = myClassSourceValue.getValue();
|
||||
String myClassSource = myClassSourceValue.get();
|
||||
if (myClassSource == null) return;
|
||||
|
||||
for (String path : myPaths) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.lang.html;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
@@ -7,8 +7,8 @@ import com.intellij.openapi.components.ComponentManager;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.ExtensionPointUtil;
|
||||
import com.intellij.openapi.extensions.PluginDescriptor;
|
||||
import com.intellij.openapi.util.ClearableLazyValue;
|
||||
import com.intellij.serviceContainer.BaseKeyedLazyInstance;
|
||||
import com.intellij.util.concurrency.SynchronizedClearableLazy;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -16,14 +16,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class HtmlCompatibleMetaLanguage extends MetaLanguage {
|
||||
public final class HtmlCompatibleMetaLanguage extends MetaLanguage {
|
||||
private static final ExtensionPointName<HtmlCompatibleLanguageEP> EP_NAME =
|
||||
new ExtensionPointName<>("com.intellij.html.compatibleLanguage");
|
||||
private static final ClearableLazyValue<Set<String>> LANGS = ExtensionPointUtil.dropLazyValueOnChange(
|
||||
ClearableLazyValue.create(
|
||||
() -> ContainerUtil.map2Set(EP_NAME.getExtensionList(), e -> e.language)
|
||||
), EP_NAME, null);
|
||||
private static final Supplier<Set<String>> LANGS = ExtensionPointUtil.dropLazyValueOnChange(
|
||||
new SynchronizedClearableLazy<>(() -> ContainerUtil.map2Set(EP_NAME.getExtensionList(), e -> e.language)), EP_NAME, null);
|
||||
|
||||
private HtmlCompatibleMetaLanguage() {
|
||||
super("HtmlCompatible");
|
||||
@@ -31,7 +30,7 @@ public class HtmlCompatibleMetaLanguage extends MetaLanguage {
|
||||
|
||||
@Override
|
||||
public boolean matchesLanguage(@NotNull Language language) {
|
||||
Set<String> langs = LANGS.getValue();
|
||||
Set<String> langs = LANGS.get();
|
||||
while (language != null) {
|
||||
if (langs.contains(language.getID())) return true;
|
||||
language = language.getBaseLanguage();
|
||||
@@ -40,8 +39,7 @@ public class HtmlCompatibleMetaLanguage extends MetaLanguage {
|
||||
}
|
||||
|
||||
@ApiStatus.Experimental
|
||||
public static class HtmlCompatibleLanguageEP extends BaseKeyedLazyInstance<String> {
|
||||
|
||||
public static final class HtmlCompatibleLanguageEP extends BaseKeyedLazyInstance<String> {
|
||||
@Attribute("language")
|
||||
public String language;
|
||||
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.xml;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.util.concurrency.SynchronizedClearableLazy;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class Html5SchemaProvider {
|
||||
private static final Logger LOG = Logger.getInstance(Html5SchemaProvider.class);
|
||||
private static final NotNullLazyValue<String> HTML5_SCHEMA_LOCATION = NotNullLazyValue.atomicLazy(() -> loadLocation(getInstance().getHtmlSchemaLocation(), "HTML5_SCHEMA"));
|
||||
private static final NotNullLazyValue<String> XHTML5_SCHEMA_LOCATION = NotNullLazyValue.atomicLazy(() -> loadLocation(getInstance().getXhtmlSchemaLocation(), "XHTML5_SCHEMA"));
|
||||
private static final NotNullLazyValue<String> CHARS_DTD_LOCATION = NotNullLazyValue.atomicLazy(() -> loadLocation(getInstance().getCharsLocation(), "CHARS_DTD"));
|
||||
private static final Supplier<String>
|
||||
HTML5_SCHEMA_LOCATION = new SynchronizedClearableLazy<>(() -> loadLocation(getInstance().getHtmlSchemaLocation(), "HTML5_SCHEMA"));
|
||||
private static final Supplier<String> XHTML5_SCHEMA_LOCATION = new SynchronizedClearableLazy<>(() -> loadLocation(getInstance().getXhtmlSchemaLocation(), "XHTML5_SCHEMA"));
|
||||
private static final Supplier<String> CHARS_DTD_LOCATION = new SynchronizedClearableLazy<>(() -> loadLocation(getInstance().getCharsLocation(), "CHARS_DTD"));
|
||||
|
||||
private static String loadLocation(URL url, String id) {
|
||||
String location = VfsUtilCore.urlToPath(VfsUtilCore.fixURLforIDEA(
|
||||
@@ -24,15 +26,15 @@ public abstract class Html5SchemaProvider {
|
||||
}
|
||||
|
||||
public static String getHtml5SchemaLocation() {
|
||||
return HTML5_SCHEMA_LOCATION.getValue();
|
||||
return HTML5_SCHEMA_LOCATION.get();
|
||||
}
|
||||
|
||||
public static String getXhtml5SchemaLocation() {
|
||||
return XHTML5_SCHEMA_LOCATION.getValue();
|
||||
return XHTML5_SCHEMA_LOCATION.get();
|
||||
}
|
||||
|
||||
public static String getCharsDtdLocation() {
|
||||
return CHARS_DTD_LOCATION.getValue();
|
||||
return CHARS_DTD_LOCATION.get();
|
||||
}
|
||||
|
||||
private static @NotNull Html5SchemaProvider getInstance() {
|
||||
|
||||
Reference in New Issue
Block a user