Search in sources :

Example 1 with SchemeFactory

use of com.intellij.openapi.options.SchemeFactory in project intellij-community by JetBrains.

the class CodeStyleXmlImporterTest method importSettings.

private CodeStyleSettings importSettings() throws SchemeImportException {
    final CodeStyleScheme targetScheme = new CodeStyleSchemeImpl("Test", false, null);
    SchemeFactory<CodeStyleScheme> schemeFactory = new SchemeFactory<CodeStyleScheme>() {

        @Override
        public CodeStyleScheme createNewScheme(@Nullable String name) {
            return targetScheme;
        }
    };
    File ioFile = new File(getTestDataPath() + getTestName(true) + ".xml");
    assertExists(ioFile);
    VirtualFile vFile = VfsUtil.findFileByIoFile(ioFile, true);
    CodeStyleSchemeXmlImporter importer = new CodeStyleSchemeXmlImporter();
    return importer.importScheme(getProject(), vFile, targetScheme, schemeFactory).getCodeStyleSettings();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme) CodeStyleSchemeXmlImporter(com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeXmlImporter) SchemeFactory(com.intellij.openapi.options.SchemeFactory) CodeStyleSchemeImpl(com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeImpl) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

SchemeFactory (com.intellij.openapi.options.SchemeFactory)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 CodeStyleScheme (com.intellij.psi.codeStyle.CodeStyleScheme)1 CodeStyleSchemeImpl (com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeImpl)1 CodeStyleSchemeXmlImporter (com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeXmlImporter)1 File (java.io.File)1 Nullable (org.jetbrains.annotations.Nullable)1