Search in sources :

Example 1 with CodeStyleSchemeImpl

use of com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeImpl in project intellij-community by JetBrains.

the class CodeStyleSchemesModel method exportProjectScheme.

public CodeStyleScheme exportProjectScheme(@NotNull String name) {
    CodeStyleScheme newScheme = createNewScheme(name, myProjectScheme);
    ((CodeStyleSchemeImpl) newScheme).setCodeStyleSettings(getCloneSettings(myProjectScheme));
    addScheme(newScheme, false);
    return newScheme;
}
Also used : CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme) CodeStyleSchemeImpl(com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeImpl)

Example 2 with CodeStyleSchemeImpl

use of com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeImpl in project intellij-community by JetBrains.

the class CodeStyleSchemesPanel method createSchemeActions.

@Override
protected AbstractSchemeActions<CodeStyleScheme> createSchemeActions() {
    return new CodeStyleSchemesActions(this) {

        @Override
        protected void onSchemeChanged(@Nullable CodeStyleScheme scheme) {
            if (!myIsReset) {
                ApplicationManager.getApplication().invokeLater(() -> onCombo());
            }
        }

        @Override
        protected void renameScheme(@NotNull CodeStyleScheme scheme, @NotNull String newName) {
            CodeStyleSchemeImpl newScheme = new CodeStyleSchemeImpl(newName, false, scheme);
            myModel.addScheme(newScheme, false);
            myModel.removeScheme(scheme);
            myModel.selectScheme(newScheme, null);
        }
    };
}
Also used : CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme) CodeStyleSchemeImpl(com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeImpl) NotNull(org.jetbrains.annotations.NotNull) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with CodeStyleSchemeImpl

use of com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeImpl 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

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