Java Code Examples for com.intellij.psi.codeStyle.CodeStyleSettingsManager#getInstance()

The following examples show how to use com.intellij.psi.codeStyle.CodeStyleSettingsManager#getInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuickChangeCodeStyleSchemeAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void fillActions(Project project, @Nonnull DefaultActionGroup group, @Nonnull 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(@Nonnull AnActionEvent e) {
        manager.USE_PER_PROJECT_SETTINGS = true;
      }
    });
  }

  CodeStyleScheme currentScheme = CodeStyleSchemes.getInstance().getCurrentScheme();
  for (CodeStyleScheme scheme : CodeStyleSchemes.getInstance().getSchemes()) {
    addScheme(group, manager, currentScheme, scheme, false);
  }
}
 
Example 2
Source File: BashFormatterTestCase.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
protected void setSettingsBack() {
    final CodeStyleSettingsManager manager = CodeStyleSettingsManager.getInstance(myFixture.getProject());
    myTempSettings.getIndentOptions(BashFileType.BASH_FILE_TYPE).INDENT_SIZE = 200;
    myTempSettings.getIndentOptions(BashFileType.BASH_FILE_TYPE).CONTINUATION_INDENT_SIZE = 200;
    myTempSettings.getIndentOptions(BashFileType.BASH_FILE_TYPE).TAB_SIZE = 200;

    myTempSettings.CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND = 5;
    manager.dropTemporarySettings();
    myTempSettings = null;
}
 
Example 3
Source File: XQueryFormattingModelBuilderTest.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
private void setTestStyleSettings() {
    CodeStyleSettingsManager settingsManager = CodeStyleSettingsManager.getInstance(getProject());
    CodeStyleSettings currSettings = settingsManager.getCurrentSettings();
    Assert.assertNotNull(currSettings);
    myTemporarySettings = currSettings.clone();
    CodeStyleSettings.IndentOptions indentOptions = myTemporarySettings.getIndentOptions(XQueryFileType.INSTANCE);
    Assert.assertNotNull(indentOptions);
    settingsManager.setTemporarySettings(myTemporarySettings);
}
 
Example 4
Source File: Utils.java    From android-butterknife-zelezny with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
    }
}
 
Example 5
Source File: IdeHelper.java    From yiistorm with MIT License 5 votes vote down vote up
public static CodeStyleSettings getSettings(Project project) {
    if (project != null) {
        CodeStyleSettingsManager manager = CodeStyleSettingsManager.getInstance(project);
        if (manager != null) {
            return manager.getCurrentSettings();
        }
    }
    return null;
}
 
Example 6
Source File: CSharpCodeGenerationSettings.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static CSharpCodeGenerationSettings getInstance(@Nonnull Project project)
{
	CodeStyleSettingsManager codeStyleSettingsManager = CodeStyleSettingsManager.getInstance(project);
	return codeStyleSettingsManager.getCurrentSettings().getCustomSettings(CSharpCodeGenerationSettings.class);
}
 
Example 7
Source File: CSharpCodeStyleSettings.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static CSharpCodeStyleSettings getInstance(@Nonnull Project project)
{
	CodeStyleSettingsManager codeStyleSettingsManager = CodeStyleSettingsManager.getInstance(project);
	return codeStyleSettingsManager.getCurrentSettings().getCustomSettings(CSharpCodeStyleSettings.class);
}
 
Example 8
Source File: CodeStyleManager.java    From editorconfig-jetbrains with MIT License 4 votes vote down vote up
public CodeStyleManager(Project project) {
    codeStyleSettingsManager = CodeStyleSettingsManager.getInstance(project);
    this.project = project;
}
 
Example 9
Source File: CodeStyleSchemesModel.java    From consulo with Apache License 2.0 4 votes vote down vote up
private CodeStyleSettingsManager getProjectSettings() {
  return CodeStyleSettingsManager.getInstance(myProject);
}