Search in sources :

Example 16 with CodeStyleScheme

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

the class CodeStyleSchemesConfigurable method ensureModel.

CodeStyleSchemesModel ensureModel() {
    if (myModel == null) {
        myModel = new CodeStyleSchemesModel(myProject);
        myRootSchemesPanel = new CodeStyleSchemesPanel(myModel);
        myModel.addListener(new CodeStyleSettingsListener() {

            @Override
            public void currentSchemeChanged(final Object source) {
                if (source != myRootSchemesPanel) {
                    myRootSchemesPanel.onSelectedSchemeChanged();
                }
            }

            @Override
            public void schemeListChanged() {
                myRootSchemesPanel.resetSchemesCombo();
            }

            @Override
            public void beforeCurrentSettingsChanged() {
            }

            @Override
            public void afterCurrentSettingsChanged() {
            }

            @Override
            public void usePerProjectSettingsOptionChanged() {
                myRootSchemesPanel.usePerProjectSettingsOptionChanged();
            }

            @Override
            public void schemeChanged(final CodeStyleScheme scheme) {
                if (scheme == myModel.getSelectedScheme())
                    myRootSchemesPanel.onSelectedSchemeChanged();
            }
        });
    }
    return myModel;
}
Also used : CodeStyleSchemesPanel(com.intellij.application.options.codeStyle.CodeStyleSchemesPanel) CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme) CodeStyleSchemesModel(com.intellij.application.options.codeStyle.CodeStyleSchemesModel) CodeStyleSettingsListener(com.intellij.application.options.codeStyle.CodeStyleSettingsListener)

Example 17 with CodeStyleScheme

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

the class CodeStyleSchemeXmlImporter method importScheme.

@Nullable
@Override
public CodeStyleScheme importScheme(@NotNull Project project, @NotNull VirtualFile selectedFile, @NotNull CodeStyleScheme currentScheme, @NotNull SchemeFactory<CodeStyleScheme> schemeFactory) throws SchemeImportException {
    Element rootElement = SchemeImportUtil.loadSchemeDom(selectedFile);
    Element schemeRoot = getSchemeRoot(rootElement);
    final Pair<String, CodeStyleScheme> importPair = !ApplicationManager.getApplication().isUnitTestMode() ? ImportSchemeChooserDialog.selectOrCreateTargetScheme(project, currentScheme, schemeFactory, getSchemeName(schemeRoot)) : Pair.create(currentScheme.getName(), currentScheme);
    if (importPair != null) {
        return readSchemeFromDom(schemeRoot, importPair.second);
    }
    return null;
}
Also used : CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme) Element(org.jdom.Element) Nullable(org.jetbrains.annotations.Nullable)

Example 18 with CodeStyleScheme

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

the class CodeStyleSchemesImpl method getDefaultScheme.

@Override
public CodeStyleScheme getDefaultScheme() {
    CodeStyleScheme defaultScheme = mySchemeManager.findSchemeByName(CodeStyleSchemeImpl.DEFAULT_SCHEME_NAME);
    if (defaultScheme == null) {
        defaultScheme = new CodeStyleSchemeImpl(CodeStyleSchemeImpl.DEFAULT_SCHEME_NAME, true, null);
        addScheme(defaultScheme);
    }
    return defaultScheme;
}
Also used : CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme)

Example 19 with CodeStyleScheme

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

the class PersistableCodeStyleSchemes method loadState.

@Override
public void loadState(Element state) {
    XmlSerializer.deserializeInto(this, state);
    CodeStyleScheme current = CURRENT_SCHEME_NAME == null ? null : mySchemeManager.findSchemeByName(CURRENT_SCHEME_NAME);
    setCurrentScheme(current == null ? getDefaultScheme() : current);
}
Also used : CodeStyleScheme(com.intellij.psi.codeStyle.CodeStyleScheme)

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