mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
The fact that I created these files in the past doesn't mean that I still actively maintain them, or that I still the best person to ask about them, or that one should ask for my confirmation before editing them, etc. If there are questions about some code in these files one should use git history to find the real author of that code anyway, so these '@author' tags are useless and just occupy space. GitOrigin-RevId: ae6081fafe19481c51c9032939b4dcaca0ec9a3b
40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
|
|
|
package com.intellij.facet.mock;
|
|
|
|
import com.intellij.facet.ui.FacetEditorValidator;
|
|
import com.intellij.facet.ui.FacetValidatorsManager;
|
|
import com.intellij.facet.ui.ValidationResult;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
import javax.swing.*;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class MockFacetValidatorsManager implements FacetValidatorsManager {
|
|
private String myErrorMessage;
|
|
private final List<FacetEditorValidator> myValidators = new ArrayList<>();
|
|
|
|
@Override
|
|
public void registerValidator(final FacetEditorValidator validator, final JComponent... componentsToWatch) {
|
|
myValidators.add(validator);
|
|
}
|
|
|
|
@Override
|
|
public void validate() {
|
|
myErrorMessage = null;
|
|
for (FacetEditorValidator validator : myValidators) {
|
|
ValidationResult result = validator.check();
|
|
if (!result.isOk()) {
|
|
myErrorMessage = result.getErrorMessage();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Nullable
|
|
public String getErrorMessage() {
|
|
return myErrorMessage;
|
|
}
|
|
}
|