use of com.intellij.psi.codeStyle.CodeStyleSettingsManager in project android-butterknife-zelezny by avast.
the class Utils method getPrefix.
/**
* Load field name prefix from code style
*
* @return
*/
public static String getPrefix() {
if (PropertiesComponent.getInstance().isValueSet(Settings.PREFIX)) {
return PropertiesComponent.getInstance().getValue(Settings.PREFIX);
} else {
CodeStyleSettingsManager manager = CodeStyleSettingsManager.getInstance();
CodeStyleSettings settings = manager.getCurrentSettings();
return settings.FIELD_NAME_PREFIX;
}
}
use of com.intellij.psi.codeStyle.CodeStyleSettingsManager in project intellij-community by JetBrains.
the class CodeStyleSettingsUtilImpl method showCodeStyleSettings.
/**
* Shows code style settings suitable for the project passed. I.e. it shows project code style page if one
* is configured to use own code style scheme or global one in other case.
* @param project
* @return Returns true if settings were modified during editing session.
*/
@Override
public boolean showCodeStyleSettings(Project project, final Class pageToSelect) {
CodeStyleSettingsManager settingsManager = CodeStyleSettingsManager.getInstance(project);
CodeStyleSettings savedSettings = settingsManager.getCurrentSettings().clone();
final CodeStyleSchemesConfigurable configurable = new CodeStyleSchemesConfigurable(project);
ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> {
if (pageToSelect != null) {
configurable.selectPage(pageToSelect);
}
});
return !savedSettings.equals(settingsManager.getCurrentSettings());
}
use of com.intellij.psi.codeStyle.CodeStyleSettingsManager in project intellij-community by JetBrains.
the class CodeStyleSchemesModel method setUsePerProjectSettings.
/**
* Updates 'use per-project settings' value within the current model and optionally at the project settings.
*
* @param usePerProjectSettings defines whether 'use per-project settings' are in use
* @param commit flag that defines if current project settings should be applied as well
*/
public void setUsePerProjectSettings(final boolean usePerProjectSettings, final boolean commit) {
if (commit) {
final CodeStyleSettingsManager projectSettings = getProjectSettings();
projectSettings.USE_PER_PROJECT_SETTINGS = usePerProjectSettings;
projectSettings.PER_PROJECT_SETTINGS = myProjectScheme.getCodeStyleSettings();
}
if (myUsePerProjectSettings != usePerProjectSettings) {
myUsePerProjectSettings = usePerProjectSettings;
myDispatcher.getMulticaster().usePerProjectSettingsOptionChanged();
myDispatcher.getMulticaster().currentSchemeChanged(this);
}
}
use of com.intellij.psi.codeStyle.CodeStyleSettingsManager in project intellij-community by JetBrains.
the class CodeStyleSchemesModel method apply.
public void apply() {
CodeStyleSettingsManager projectSettingsManager = getProjectSettings();
projectSettingsManager.USE_PER_PROJECT_SETTINGS = myUsePerProjectSettings;
projectSettingsManager.PREFERRED_PROJECT_CODE_STYLE = myUsePerProjectSettings || myGlobalSelected == null ? null : myGlobalSelected.getName();
projectSettingsManager.PER_PROJECT_SETTINGS = myProjectScheme.getCodeStyleSettings();
CodeStyleSchemesImpl.getSchemeManager().setSchemes(mySchemes, myGlobalSelected, null);
}
use of com.intellij.psi.codeStyle.CodeStyleSettingsManager in project intellij-community by JetBrains.
the class QuickChangeCodeStyleSchemeAction method fillActions.
@Override
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) {
final CodeStyleSettingsManager manager = CodeStyleSettingsManager.getInstance(project);
if (manager.PER_PROJECT_SETTINGS != null) {
//noinspection HardCodedStringLiteral
group.add(new AnAction("<project>", "", manager.USE_PER_PROJECT_SETTINGS ? ourCurrentAction : ourNotCurrentAction) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
manager.USE_PER_PROJECT_SETTINGS = true;
}
});
}
CodeStyleScheme currentScheme = CodeStyleSchemes.getInstance().getCurrentScheme();
for (CodeStyleScheme scheme : CodeStyleSchemesImpl.getSchemeManager().getAllSchemes()) {
addScheme(group, manager, currentScheme, scheme, false);
}
}
Aggregations