package jetbrains.mps.debugger.java.customViewers.plugin.plugin;
/*Generated by MPS */
import jetbrains.mps.plugins.custom.BaseCustomApplicationPlugin;
import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;
import java.util.List;
import jetbrains.mps.debugger.java.api.state.proxy.ValueWrapperFactory;
import jetbrains.mps.internal.collections.runtime.ListSequence;
import java.util.ArrayList;
import jetbrains.mps.debugger.java.api.state.customViewers.CustomViewersManager;
import org.apache.log4j.Level;
public class CustomViewersInitializer_CustomApplicationPlugin extends BaseCustomApplicationPlugin {
private static final Logger LOG = LogManager.getLogger(CustomViewersInitializer_CustomApplicationPlugin.class);
private List<ValueWrapperFactory> myFactories = ListSequence.fromList(new ArrayList<ValueWrapperFactory>());
public CustomViewersInitializer_CustomApplicationPlugin() {
}
public void doInit() {
CustomViewersManager manager = CustomViewersManager.getInstance();
if (manager != null) {
{
ValueWrapperFactory factory = new List_WrapperFactory();
ListSequence.fromList(CustomViewersInitializer_CustomApplicationPlugin.this.myFactories).addElement(factory);
manager.addFactory(factory);
}
{
ValueWrapperFactory factory = new MapEntry_WrapperFactory();
ListSequence.fromList(CustomViewersInitializer_CustomApplicationPlugin.this.myFactories).addElement(factory);
manager.addFactory(factory);
}
{
ValueWrapperFactory factory = new Map_WrapperFactory();
ListSequence.fromList(CustomViewersInitializer_CustomApplicationPlugin.this.myFactories).addElement(factory);
manager.addFactory(factory);
}
{
ValueWrapperFactory factory = new Set_WrapperFactory();
ListSequence.fromList(CustomViewersInitializer_CustomApplicationPlugin.this.myFactories).addElement(factory);
manager.addFactory(factory);
}
{
ValueWrapperFactory factory = new IndexedTupleViewer_WrapperFactory();
ListSequence.fromList(CustomViewersInitializer_CustomApplicationPlugin.this.myFactories).addElement(factory);
manager.addFactory(factory);
}
{
ValueWrapperFactory factory = new SNodeViewer_WrapperFactory();
ListSequence.fromList(CustomViewersInitializer_CustomApplicationPlugin.this.myFactories).addElement(factory);
manager.addFactory(factory);
}
}
}
public void doDispose() {
CustomViewersManager manager = CustomViewersManager.getInstance();
if (manager != null) {
for (ValueWrapperFactory factory : ListSequence.fromList(CustomViewersInitializer_CustomApplicationPlugin.this.myFactories).reversedList()) {
manager.removeFactory(factory);
}
} else if (ListSequence.fromList(CustomViewersInitializer_CustomApplicationPlugin.this.myFactories).isNotEmpty()) {
if (LOG.isEnabledFor(Level.ERROR)) {
LOG.error("Cant find custom viewers manager while myFactories nonempty: " + CustomViewersInitializer_CustomApplicationPlugin.this.myFactories);
}
}
ListSequence.fromList(CustomViewersInitializer_CustomApplicationPlugin.this.myFactories).clear();
}
}