Search in sources :

Example 1 with BlockViewOptions

use of org.stepik.api.objects.steps.BlockViewOptions in project intellij-plugins by StepicOrg.

the class StepNode method getSupportedLanguages.

@NotNull
public List<SupportedLanguages> getSupportedLanguages() {
    if (supportedLanguages == null) {
        supportedLanguages = new ArrayList<>();
        BlockView block;
        Step data = getData();
        if (data == null) {
            return supportedLanguages;
        }
        block = data.getBlock();
        if (getType() == StepType.CODE) {
            BlockViewOptions options = block.getOptions();
            Map<String, String> templates = options.getCodeTemplates();
            templates.keySet().forEach(key -> {
                SupportedLanguages language = SupportedLanguages.langOfName(key);
                if (language != INVALID && !supportedLanguages.contains(language)) {
                    supportedLanguages.add(language);
                }
            });
        }
    }
    return supportedLanguages;
}
Also used : SupportedLanguages(org.stepik.core.SupportedLanguages) BlockView(org.stepik.api.objects.steps.BlockView) Step(org.stepik.api.objects.steps.Step) BlockViewOptions(org.stepik.api.objects.steps.BlockViewOptions) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NotNull (org.jetbrains.annotations.NotNull)1 BlockView (org.stepik.api.objects.steps.BlockView)1 BlockViewOptions (org.stepik.api.objects.steps.BlockViewOptions)1 Step (org.stepik.api.objects.steps.Step)1 SupportedLanguages (org.stepik.core.SupportedLanguages)1