Java 类com.intellij.psi.codeStyle.arrangement.std.StdArrangementTokenUiRole 实例源码

项目:intellij-ce-playground    文件:DefaultArrangementUiComponentFactory.java   
@Nullable
@Override
public ArrangementUiComponent build(@NotNull StdArrangementTokenUiRole role,
                                    @NotNull List<ArrangementSettingsToken> tokens,
                                    @NotNull ArrangementColorsProvider colorsProvider,
                                    @NotNull ArrangementStandardSettingsManager settingsManager)
{
  switch (role) {
    case CHECKBOX:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a checkbox token for elements " + tokens);
      }
      else {
        return new ArrangementCheckBoxUiComponent(tokens.get(0));
      }
    case COMBO_BOX:
      if (tokens.isEmpty()) {
        throw new IllegalArgumentException("Can't build a combo box token with empty content");
      }
      return new ArrangementComboBoxUiComponent(tokens);
    case LABEL:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a label token for elements " + tokens);
      }
      return new ArrangementLabelUiComponent(tokens.get(0));
    case TEXT_FIELD:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a text field token for elements " + tokens);
      }
      return new ArrangementTextFieldUiComponent(tokens.get(0));
    case BULB:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a bulb token for elements " + tokens);
      }
      return new ArrangementAtomMatchConditionComponent(
        settingsManager, colorsProvider, new ArrangementAtomMatchCondition(tokens.get(0)), null
      );
  }
  return null;
}
项目:tools-idea    文件:DefaultArrangementUiComponentFactory.java   
@Nullable
@Override
public ArrangementUiComponent build(@NotNull StdArrangementTokenUiRole role,
                                    @NotNull List<ArrangementSettingsToken> tokens,
                                    @NotNull ArrangementColorsProvider colorsProvider,
                                    @NotNull ArrangementStandardSettingsManager settingsManager)
{
  switch (role) {
    case CHECKBOX:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a checkbox token for elements " + tokens);
      }
      else {
        return new ArrangementCheckBoxUiComponent(tokens.get(0));
      }
    case COMBO_BOX:
      if (tokens.isEmpty()) {
        throw new IllegalArgumentException("Can't build a combo box token with empty content");
      }
      return new ArrangementComboBoxUiComponent(tokens);
    case LABEL:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a label token for elements " + tokens);
      }
      return new ArrangementLabelUiComponent(tokens.get(0));
    case TEXT_FIELD:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a text field token for elements " + tokens);
      }
      return new ArrangementTextFieldUiComponent(tokens.get(0));
    case BULB:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a bulb token for elements " + tokens);
      }
      return new ArrangementAtomMatchConditionComponent(
        settingsManager, colorsProvider, new ArrangementAtomMatchCondition(tokens.get(0)), null
      );
  }
  return null;
}
项目:consulo    文件:DefaultArrangementUiComponentFactory.java   
@Nullable
@Override
public ArrangementUiComponent build(@Nonnull StdArrangementTokenUiRole role,
                                    @Nonnull List<ArrangementSettingsToken> tokens,
                                    @Nonnull ArrangementColorsProvider colorsProvider,
                                    @Nonnull ArrangementStandardSettingsManager settingsManager)
{
  switch (role) {
    case CHECKBOX:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a checkbox token for elements " + tokens);
      }
      else {
        return new ArrangementCheckBoxUiComponent(tokens.get(0));
      }
    case COMBO_BOX:
      if (tokens.isEmpty()) {
        throw new IllegalArgumentException("Can't build a combo box token with empty content");
      }
      return new ArrangementComboBoxUiComponent(tokens);
    case LABEL:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a label token for elements " + tokens);
      }
      return new ArrangementLabelUiComponent(tokens.get(0));
    case TEXT_FIELD:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a text field token for elements " + tokens);
      }
      return new ArrangementTextFieldUiComponent(tokens.get(0));
    case BULB:
      if (tokens.size() != 1) {
        throw new IllegalArgumentException("Can't build a bulb token for elements " + tokens);
      }
      return new ArrangementAtomMatchConditionComponent(
        settingsManager, colorsProvider, new ArrangementAtomMatchCondition(tokens.get(0)), null
      );
  }
  return null;
}