package jetbrains.mps.project.io;
/*Generated by MPS */
import jetbrains.mps.project.structure.modules.ModuleDescriptor;
import jetbrains.mps.vfs.IFile;
import jetbrains.mps.project.MPSExtentions;
public class DescriptorIOFacade {
private static DescriptorIOFacade INSTANCE = new DescriptorIOFacade();
private static final StandardDescriptorIOProvider STANDARD_FACTORY = new StandardDescriptorIOProvider();
private static final IdeaDescriptorIOProvider IDEA = new IdeaDescriptorIOProvider();
private DescriptorIOFacade() {
}
public DescriptorIO<? extends ModuleDescriptor> fromFileType(IFile file) {
return fromExtension(file.getPath());
}
public DescriptorIOProvider standardProvider() {
return STANDARD_FACTORY;
}
public DescriptorIOProvider ideaProvider() {
return IDEA;
}
private DescriptorIO<? extends ModuleDescriptor> fromExtension(String path) {
if (path.endsWith(MPSExtentions.DOT_LANGUAGE)) {
return standardProvider().languageDescriptorIO();
} else if (path.endsWith(MPSExtentions.DOT_SOLUTION)) {
return standardProvider().solutionDescriptorIO();
} else if (path.endsWith(MPSExtentions.DOT_DEVKIT)) {
return standardProvider().devkitDescriptorIO();
} else if (path.endsWith(".iml")) {
return ideaProvider().solutionDescriptorIO();
}
return null;
}
public static DescriptorIOFacade getInstance() {
return INSTANCE;
}
}