com.intellij.psi.codeStyle.CustomCodeStyleSettings Java Examples

The following examples show how to use com.intellij.psi.codeStyle.CustomCodeStyleSettings. 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: CodeStyleBlankLinesPanel.java    From consulo with 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 #2
Source File: OptionTableWithPreviewPanel.java    From consulo with 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 File: OptionTableWithPreviewPanel.java    From consulo with 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 #4
Source File: OptionTableWithPreviewPanel.java    From consulo with 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 #5
Source File: OptionTableWithPreviewPanel.java    From consulo with 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 #6
Source File: OptionTableWithPreviewPanel.java    From consulo with 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 #7
Source File: OptionTreeWithPreviewPanel.java    From consulo with 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 File: OptionTreeWithPreviewPanel.java    From consulo with 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 #9
Source File: OptionTreeWithPreviewPanel.java    From consulo with 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 #10
Source File: OptionTreeWithPreviewPanel.java    From consulo with 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 #11
Source File: OptionTreeWithPreviewPanel.java    From consulo with 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 #12
Source File: CodeStyleBlankLinesPanel.java    From consulo with 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;
}
 
Example #13
Source File: CodeStyleBlankLinesPanel.java    From consulo with 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 #14
Source File: CodeStyleBlankLinesPanel.java    From consulo with 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 #15
Source File: OptionTableWithPreviewPanel.java    From consulo with 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 #16
Source File: FluidCodeStyleSettingsProvider.java    From idea-php-typo3-plugin with MIT License 4 votes vote down vote up
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new FluidCodeStyleSettings(settings);
}
 
Example #17
Source File: CodeStyleBean.java    From consulo with 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 #18
Source File: BuckCodeStyleSettingsProvider.java    From buck with Apache License 2.0 4 votes vote down vote up
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new BuckCodeStyleSettings(settings);
}
 
Example #19
Source File: XQueryCodeStyleSettingsProvider.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new XQueryCodeStyleSettings(settings);
}
 
Example #20
Source File: HaxeCodeStyleSettingsProvider.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new HaxeCodeStyleSettings(settings);
}
 
Example #21
Source File: CSharpCodeStyleSettingsProvider.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings)
{
	return new CSharpCodeStyleSettings(settings);
}
 
Example #22
Source File: CSharpCodeGenerationSettingsProvider.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings)
{
	return new CSharpCodeGenerationSettings(settings);
}
 
Example #23
Source File: GLSLCodeStyleSettingsProvider.java    From glsl4idea with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
	return new GLSLCodeStyleSettings(settings);
}
 
Example #24
Source File: LatexCodeStyleSettingsProvider.java    From idea-latex with MIT License 4 votes vote down vote up
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new LatexCodeStyleSettings(settings);
}
 
Example #25
Source File: BuckCodeStyleSettingsProvider.java    From Buck-IntelliJ-Plugin with Apache License 2.0 4 votes vote down vote up
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new BuckCodeStyleSettings(settings);
}
 
Example #26
Source File: BuildCodeStyleSettingsProvider.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new BuildCodeStyleSettings(settings);
}
 
Example #27
Source File: CypherCodeStyleSettingsProvider.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new CypherCodeStyleSettings(settings);
}
 
Example #28
Source File: ProtoCodeStyleSettingsProvider.java    From protobuf-jetbrains-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new ProtoCodeStyleSettings(settings);
}
 
Example #29
Source File: FusionCodeStyleSettingsProvider.java    From intellij-neos with GNU General Public License v3.0 4 votes vote down vote up
@Nullable
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
    return new FusionCodeStyleSettings(settings);
}