Java Code Examples for com.intellij.psi.codeStyle.CustomCodeStyleSettings

The following examples show how to use com.intellij.psi.codeStyle.CustomCodeStyleSettings. These examples are extracted from open source projects. 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 Project: consulo   Source File: OptionTableWithPreviewPanel.java    License: Apache License 2.0 6 votes vote down vote up
public FieldOption(@Nullable Class<? extends CustomCodeStyleSettings> clazz,
                   @Nonnull String fieldName,
                   @Nonnull String title,
                   @Nullable String groupName,
                   @Nullable OptionAnchor anchor,
                   @Nullable String anchorFiledName) {
  super(fieldName, title, groupName, anchor, anchorFiledName);
  this.clazz = clazz;

  try {
    Class styleSettingsClass = clazz == null ? CommonCodeStyleSettings.class : clazz;
    this.field = styleSettingsClass.getField(fieldName);
  }
  catch (NoSuchFieldException e) {
    LOG.error(e);
  }
}
 
Example 2
Source Project: consulo   Source File: OptionTableWithPreviewPanel.java    License: Apache License 2.0 6 votes vote down vote up
public IntOption(Class<? extends CustomCodeStyleSettings> clazz,
                 @Nonnull String fieldName,
                 @Nonnull String title,
                 @Nullable String groupName,
                 @Nullable OptionAnchor anchor,
                 @Nullable String anchorFiledName,
                 int minValue,
                 int maxValue,
                 int defaultValue,
                 @Nullable Function<Integer, String> defaultValueRenderer) {
  super(clazz, fieldName, title, groupName, anchor, anchorFiledName);
  myMinValue = minValue;
  myMaxValue = maxValue;
  myDefaultValue = defaultValue;
  myDefaultValueRenderer = defaultValueRenderer;
}
 
Example 3
Source Project: consulo   Source File: CodeStyleBlankLinesPanel.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass,
                             String fieldName,
                             String title,
                             String groupName,
                             @Nullable OptionAnchor anchor,
                             @Nullable String anchorFieldName,
                             Object... options) {
  if (myIsFirstUpdate) {
    myCustomOptions.putValue(groupName, Trinity.create(settingsClass, fieldName, title));
  }

  for (IntOption option : myOptions) {
    if (option.myTarget.getName().equals(fieldName)) {
      option.myIntField.setEnabled(true);
    }
  }
}
 
Example 4
Source Project: consulo   Source File: OptionTreeWithPreviewPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass,
                             String fieldName,
                             String title,
                             @Nullable String groupName,
                             @Nullable OptionAnchor anchor,
                             @Nullable String anchorFieldName,
                             Object... options) {
  if (isFirstUpdate) {
    myCustomOptions.putValue(groupName, new CustomBooleanOptionInfo(settingsClass, fieldName, title, groupName, anchor, anchorFieldName));
  }
  enableOption(fieldName);
}
 
Example 5
Source Project: consulo   Source File: OptionTreeWithPreviewPanel.java    License: Apache License 2.0 5 votes vote down vote up
private CustomBooleanOptionInfo(@Nonnull Class<? extends CustomCodeStyleSettings> settingClass,
                                @Nonnull String fieldName,
                                @Nonnull String title,
                                @Nullable String groupName,
                                @Nullable OptionAnchor anchor,
                                @Nullable String anchorFieldName) {
  this.settingClass = settingClass;
  this.fieldName = fieldName;
  this.title = title;
  this.groupName = groupName;
  this.anchor = anchor;
  this.anchorFieldName = anchorFieldName;
}
 
Example 6
Source Project: consulo   Source File: OptionTreeWithPreviewPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(CodeStyleSettings settings, Boolean aBoolean) {
  final CustomCodeStyleSettings customSettings = settings.getCustomSettings(mySettingsClass);
  try {
    field.set(customSettings, aBoolean);
  }
  catch (Throwable e) {
    LOG.error("Field: " + field, e);
  }
}
 
Example 7
Source Project: consulo   Source File: OptionTreeWithPreviewPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean getValue(CodeStyleSettings settings) throws IllegalAccessException {
  try {
    final CustomCodeStyleSettings customSettings = settings.getCustomSettings(mySettingsClass);
    return field.getBoolean(customSettings);
  }
  catch (Throwable e) {
    LOG.error("Field: " + field, e);
    return false;
  }
}
 
Example 8
Source Project: consulo   Source File: OptionTableWithPreviewPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass,
                             String fieldName,
                             String title,
                             String groupName,
                             @Nullable OptionAnchor anchor,
                             @Nullable String anchorFieldName,
                             Object... options) {
  if (isFirstUpdate) {
    Option option;
    if (options.length == 2) {
      option = new SelectionOption(settingsClass, fieldName, title, groupName, anchor, anchorFieldName, (String[])options[0], (int[])options[1]);
    }
    else {
      option = new BooleanOption(settingsClass, fieldName, title, groupName, anchor, anchorFieldName);
    }
    myCustomOptions.add(option);
    option.setEnabled(true);
  }
  else {
    for (Option each : myCustomOptions) {
      if (each instanceof FieldOption && ((FieldOption)each).clazz == settingsClass && each.getOptionName().equals(fieldName)) {
        each.setEnabled(true);
      }
    }
  }
}
 
Example 9
Source Project: consulo   Source File: OptionTableWithPreviewPanel.java    License: Apache License 2.0 5 votes vote down vote up
private BooleanOption(Class<? extends CustomCodeStyleSettings> clazz,
                      @Nonnull String fieldName,
                      @Nonnull String title,
                      @Nullable String groupName,
                      @Nullable OptionAnchor anchor,
                      @Nullable String anchorFiledName) {
  super(clazz, fieldName, title, groupName, anchor, anchorFiledName);
}
 
Example 10
Source Project: consulo   Source File: OptionTableWithPreviewPanel.java    License: Apache License 2.0 5 votes vote down vote up
public SelectionOption(Class<? extends CustomCodeStyleSettings> clazz,
                       @Nonnull String fieldName,
                       @Nonnull String title,
                       @Nullable String groupName,
                       @Nullable OptionAnchor anchor,
                       @Nullable String anchorFiledName,
                       @Nonnull String[] options,
                       @Nonnull int[] values) {
  super(clazz, fieldName, title, groupName, anchor, anchorFiledName);
  this.options = options;
  this.values = values;
}
 
Example 11
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new FluidCodeStyleSettings(settings);
}
 
Example 12
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new FusionCodeStyleSettings(settings);
}
 
Example 13
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new ProtoCodeStyleSettings(settings);
}
 
Example 14
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new CypherCodeStyleSettings(settings);
}
 
Example 15
Source Project: intellij   Source File: BuildCodeStyleSettingsProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new BuildCodeStyleSettings(settings);
}
 
Example 16
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new BuckCodeStyleSettings(settings);
}
 
Example 17
Source Project: idea-latex   Source File: LatexCodeStyleSettingsProvider.java    License: MIT License 4 votes vote down vote up
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new LatexCodeStyleSettings(settings);
}
 
Example 18
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
	return new GLSLCodeStyleSettings(settings);
}
 
Example 19
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings)
{
	return new CSharpCodeGenerationSettings(settings);
}
 
Example 20
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings)
{
	return new CSharpCodeStyleSettings(settings);
}
 
Example 21
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new HaxeCodeStyleSettings(settings);
}
 
Example 22
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new XQueryCodeStyleSettings(settings);
}
 
Example 23
Source Project: buck   Source File: BuckCodeStyleSettingsProvider.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new BuckCodeStyleSettings(settings);
}
 
Example 24
Source Project: consulo   Source File: CodeStyleBean.java    License: Apache License 2.0 4 votes vote down vote up
@Nonnull
protected final <T extends CustomCodeStyleSettings> T getCustomSettings(@Nonnull Class<T> settingsClass) {
  return myRootSettings.getCustomSettings(settingsClass);
}
 
Example 25
Source Project: consulo   Source File: OptionTreeWithPreviewPanel.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass, String fieldName, String title, String groupName, Object... options) {
  showCustomOption(settingsClass, fieldName, title, groupName, null, null, options);
}
 
Example 26
Source Project: consulo   Source File: OptionTableWithPreviewPanel.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass, String fieldName, String title, String groupName, Object... options) {
  showCustomOption(settingsClass, fieldName, title, groupName, null, null, options);
}
 
Example 27
Source Project: consulo   Source File: CodeStyleBlankLinesPanel.java    License: Apache License 2.0 4 votes vote down vote up
private void initCustomOptions(OptionGroup optionGroup, String groupName) {
  for (Trinity<Class<? extends CustomCodeStyleSettings>, String, String> each : myCustomOptions.get(groupName)) {
    doCreateOption(optionGroup, each.third, new IntOption(each.third, each.first, each.second), each.second);
  }
}
 
Example 28
Source Project: consulo   Source File: CodeStyleBlankLinesPanel.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void showCustomOption(Class<? extends CustomCodeStyleSettings> settingsClass, String fieldName, String title, String groupName, Object... options) {
  showCustomOption(settingsClass, fieldName, title, groupName, null, null, options);
}
 
Example 29
Source Project: consulo   Source File: CodeStyleBlankLinesPanel.java    License: Apache License 2.0 4 votes vote down vote up
private IntOption(@Nonnull String title, Class<? extends CustomCodeStyleSettings> targetClass, String fieldName) {
  this(title, targetClass, fieldName, false);
  myTargetClass = targetClass;
}