Search in sources :

Example 11 with CodeStyleScheme

use of com.intellij.psi.codeStyle.CodeStyleScheme in project intellij-community by JetBrains.

the class CodeStyleSchemesActions method duplicateScheme.

@Override
protected void duplicateScheme(@NotNull CodeStyleScheme scheme, @NotNull String newName) {
    if (!getModel().isProjectScheme(scheme)) {
        CodeStyleScheme newScheme = getModel().createNewScheme(newName, getCurrentScheme());
        getModel().addScheme(newScheme, true);
    }
}
Also used : CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme)

Example 12 with CodeStyleScheme

use of com.intellij.psi.codeStyle.CodeStyleScheme in project intellij-community by JetBrains.

the class CodeStyleSchemesModel method isSchemeListModified.

public boolean isSchemeListModified() {
    CodeStyleSchemes schemes = CodeStyleSchemes.getInstance();
    if (getProjectSettings().USE_PER_PROJECT_SETTINGS != myUsePerProjectSettings)
        return true;
    if (!myUsePerProjectSettings && getSelectedScheme() != schemes.findPreferredScheme(getProjectSettings().PREFERRED_PROJECT_CODE_STYLE)) {
        return true;
    }
    Set<CodeStyleScheme> configuredSchemesSet = new HashSet<>(getSchemes());
    return !configuredSchemesSet.equals(new THashSet<>(CodeStyleSchemesImpl.getSchemeManager().getAllSchemes()));
}
Also used : CodeStyleSchemes(com.intellij.psi.codeStyle.CodeStyleSchemes) CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme) THashSet(gnu.trove.THashSet) THashSet(gnu.trove.THashSet)

Example 13 with CodeStyleScheme

use of com.intellij.psi.codeStyle.CodeStyleScheme 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 14 with CodeStyleScheme

use of com.intellij.psi.codeStyle.CodeStyleScheme in project intellij-community by JetBrains.

the class CodeStyleSchemesPanel method onCombo.

private void onCombo() {
    CodeStyleScheme selected = getSelectedScheme();
    if (selected != null) {
        if (myModel.isProjectScheme(selected)) {
            myModel.setUsePerProjectSettings(true);
        } else {
            myModel.selectScheme(selected, this);
            myModel.setUsePerProjectSettings(false);
        }
    }
}
Also used : CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme)

Example 15 with CodeStyleScheme

use of com.intellij.psi.codeStyle.CodeStyleScheme 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)

Aggregations

CodeStyleScheme (com.intellij.psi.codeStyle.CodeStyleScheme)19 Nullable (org.jetbrains.annotations.Nullable)5 CodeStyleSchemeImpl (com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeImpl)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 CodeStyleSchemes (com.intellij.psi.codeStyle.CodeStyleSchemes)2 CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)2 File (java.io.File)2 CodeStyleSchemesModel (com.intellij.application.options.codeStyle.CodeStyleSchemesModel)1 CodeStyleSchemesPanel (com.intellij.application.options.codeStyle.CodeStyleSchemesPanel)1 CodeStyleSettingsListener (com.intellij.application.options.codeStyle.CodeStyleSettingsListener)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 EditorSettingsExternalizable (com.intellij.openapi.editor.ex.EditorSettingsExternalizable)1 SchemeFactory (com.intellij.openapi.options.SchemeFactory)1 CodeStyleSettingsManager (com.intellij.psi.codeStyle.CodeStyleSettingsManager)1 CommonCodeStyleSettings (com.intellij.psi.codeStyle.CommonCodeStyleSettings)1 CodeStyleSchemeXmlImporter (com.intellij.psi.impl.source.codeStyle.CodeStyleSchemeXmlImporter)1 Accessor (com.intellij.util.xmlb.Accessor)1 SerializationFilter (com.intellij.util.xmlb.SerializationFilter)1 THashSet (gnu.trove.THashSet)1