mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
json schema, rename to cross definitions
This commit is contained in:
@@ -79,7 +79,7 @@ public class JsonSchemaMappingsProjectConfiguration extends JsonSchemaMappingsCo
|
||||
if (schemaFile != null) mySchemaFiles.put(schemaFile, info);
|
||||
}
|
||||
if (refreshStaticProviders) {
|
||||
ServiceManager.getService(myProject, JsonSchemaService.class).refreshStaticProviders();
|
||||
ServiceManager.getService(myProject, JsonSchemaService.class).refreshCrossDefinitions();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ import java.util.List;
|
||||
|
||||
public interface JsonSchemaService {
|
||||
|
||||
void refreshStaticProviders();
|
||||
void refreshCrossDefinitions();
|
||||
|
||||
void ensureStaticProvidersInitialized();
|
||||
void ensureCrossDefinitionsInitialized();
|
||||
|
||||
class Impl {
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class JsonSchemaCrossDefinitions {
|
||||
}
|
||||
|
||||
public JsonSchemaObject findDefinition(@NotNull final String url, @NotNull final String relativePart, @NotNull final JsonSchemaObject rootObject) {
|
||||
ServiceManager.getService(myProject, JsonSchemaService.class).ensureStaticProvidersInitialized();
|
||||
ServiceManager.getService(myProject, JsonSchemaService.class).ensureCrossDefinitionsInitialized();
|
||||
final Map<String, JsonSchemaObject> map = myMap.get(url);
|
||||
if (map != null) {
|
||||
return JsonSchemaReader.findDefinition(myProject, relativePart, rootObject, map, false);
|
||||
|
||||
@@ -40,11 +40,11 @@ public class JsonSchemaServiceImpl implements JsonSchemaService {
|
||||
@Nullable
|
||||
private final Project myProject;
|
||||
private final ConcurrentMap<JsonSchemaFileProvider, JsonSchemaObjectCodeInsightWrapper> myWrappers = ContainerUtil.newConcurrentMap();
|
||||
private final AtomicBoolean myStaticProvidersInitialized;
|
||||
private final AtomicBoolean myCrossDefinitionsInitialized;
|
||||
|
||||
public JsonSchemaServiceImpl(@Nullable Project project) {
|
||||
myProject = project;
|
||||
myStaticProvidersInitialized = new AtomicBoolean();
|
||||
myCrossDefinitionsInitialized = new AtomicBoolean();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -106,7 +106,7 @@ public class JsonSchemaServiceImpl implements JsonSchemaService {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void logException(@NotNull JsonSchemaFileProvider provider, Exception e) {
|
||||
private static void logException(@NotNull JsonSchemaFileProvider provider, Exception e) {
|
||||
final String message = "Error while processing json schema file: " + e.getMessage();
|
||||
if (provider instanceof JsonSchemaImportedProviderMarker) {
|
||||
RARE_LOGGER.info(message, e);
|
||||
@@ -135,14 +135,14 @@ public class JsonSchemaServiceImpl implements JsonSchemaService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshStaticProviders() {
|
||||
myStaticProvidersInitialized.getAndSet(false);
|
||||
ensureStaticProvidersInitialized();
|
||||
public void refreshCrossDefinitions() {
|
||||
myCrossDefinitionsInitialized.getAndSet(false);
|
||||
ensureCrossDefinitionsInitialized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ensureStaticProvidersInitialized() {
|
||||
if (myStaticProvidersInitialized.get()) return;
|
||||
public void ensureCrossDefinitionsInitialized() {
|
||||
if (myCrossDefinitionsInitialized.get()) return;
|
||||
final JsonSchemaProviderFactory[] factories = getProviderFactories();
|
||||
for (JsonSchemaProviderFactory factory : factories) {
|
||||
for (JsonSchemaFileProvider provider : factory.getProviders(myProject)) {
|
||||
@@ -157,7 +157,7 @@ public class JsonSchemaServiceImpl implements JsonSchemaService {
|
||||
}
|
||||
}
|
||||
}
|
||||
myStaticProvidersInitialized.getAndSet(true);
|
||||
myCrossDefinitionsInitialized.getAndSet(true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user