package jetbrains.mps.debugger.java.runtime.state.customViewers;

/*Generated by MPS */

import jetbrains.mps.annotations.GeneratedClass;
import com.intellij.openapi.components.ApplicationComponent;
import jetbrains.mps.debugger.java.api.state.customViewers.CustomViewersManager;
import java.util.Set;
import jetbrains.mps.debugger.java.api.state.proxy.ValueWrapperFactory;
import jetbrains.mps.internal.collections.runtime.SetSequence;
import java.util.HashSet;

@GeneratedClass(node = "r:4388830e-b413-4ab4-a4d2-e76a7bc17a27(jetbrains.mps.debugger.java.runtime.state.customViewers)/7129857096176465096", model = "r:4388830e-b413-4ab4-a4d2-e76a7bc17a27(jetbrains.mps.debugger.java.runtime.state.customViewers)")
public class BaseLanguageCustomViewers implements ApplicationComponent {
  private final CustomViewersManager myCustomViewerManager;
  private final Set<ValueWrapperFactory> myFactories = SetSequence.fromSet(new HashSet<ValueWrapperFactory>());

  public BaseLanguageCustomViewers() {
    myCustomViewerManager = CustomViewersManager.getInstance();
  }

  public void initComponent() {
    // Base Language Custom Viewers
    SetSequence.fromSet(myFactories).addElement(new ObjectWrapperFactory());
    SetSequence.fromSet(myFactories).addElement(new ArrayWrapperFactory());
    SetSequence.fromSet(myFactories).addElement(new PrimitiveWrapperFactory());
    SetSequence.fromSet(myFactories).addElement(new StringWrapperFactory());
    SetSequence.fromSet(myFactories).visitAll((it) -> myCustomViewerManager.addFactory(it));
  }
  public void disposeComponent() {
    SetSequence.fromSet(myFactories).visitAll((it) -> myCustomViewerManager.removeFactory(it));
    SetSequence.fromSet(myFactories).clear();
  }
}
