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;
}
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;
}
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;
}
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);
}
Aggregations