Files
openide/java/idea-ui/testSrc/com/intellij/facet/mock/MockFacetEditorFacade.java
Nikolay Chashnikov d767b2e1ff [project structure] get rid of some code which takes parts of Project Structure from services (IDEA-261457)
Additional project-services holding parts of Project Structure dialog are not registered as separate services anymore and their instances are taken from ProjectStructureConfigurable instead. Instance of ProjectStructureConfigurable is passed explicitly where possible. This is a first step to avoid registering ProjectStructureConfigurable as a service.

GitOrigin-RevId: fe8198a9ffb284af9dd9478909a14714978c220d
2021-02-09 11:30:17 +00:00

68 lines
1.8 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.Facet;
import com.intellij.facet.FacetInfo;
import com.intellij.facet.FacetType;
import com.intellij.facet.FacetTypeId;
import com.intellij.facet.impl.ui.FacetEditorFacade;
import com.intellij.facet.impl.ui.FacetTreeModel;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
public class MockFacetEditorFacade implements FacetEditorFacade {
private FacetInfo mySelectedFacet;
private final FacetTreeModel myModel = new FacetTreeModel();
public void setSelectedFacet(final FacetInfo selectedFacet) {
mySelectedFacet = selectedFacet;
}
public FacetTreeModel getModel() {
return myModel;
}
@Override
public boolean nodeHasFacetOfType(final @Nullable FacetInfo facet, FacetTypeId typeId) {
return myModel.hasFacetOfType(facet, typeId);
}
@Override
@Nullable
public FacetInfo getSelectedFacetInfo() {
return mySelectedFacet;
}
@Override
@Nullable
public ModuleType getSelectedModuleType() {
return StdModuleTypes.JAVA;
}
@Override
public Facet createFacet(final FacetInfo parent, final FacetType type) {
return null;
}
@Override
public Collection<FacetInfo> getFacetsByType(final FacetType<?, ?> type) {
return myModel.getFacetInfos(type);
}
@Override
@Nullable
public FacetInfo getParent(final FacetInfo facet) {
return myModel.getParent(facet);
}
@Override
public ProjectStructureConfigurable getProjectStructureConfigurable() {
throw new UnsupportedOperationException();
}
}