use of com.intellij.psi.codeStyle.arrangement.std.ArrangementSettingsToken in project intellij-community by JetBrains.
the class ArrangementGroupingRulesControl method getRules.
@NotNull
public List<ArrangementGroupingRule> getRules() {
List<ArrangementGroupingRule> result = new ArrayList<>();
DefaultTableModel model = getModel();
for (int i = 0, max = model.getRowCount(); i < max; i++) {
ArrangementGroupingComponent component = (ArrangementGroupingComponent) model.getValueAt(i, 0);
if (!component.isSelected()) {
continue;
}
ArrangementSettingsToken orderType = component.getOrderType();
if (orderType == null) {
result.add(new ArrangementGroupingRule(component.getGroupingType()));
} else {
result.add(new ArrangementGroupingRule(component.getGroupingType(), orderType));
}
}
return result;
}
use of com.intellij.psi.codeStyle.arrangement.std.ArrangementSettingsToken in project intellij-community by JetBrains.
the class ArrangementSectionRuleManager method getSectionRuleData.
@Nullable
public ArrangementSectionRuleData getSectionRuleData(@NotNull ArrangementMatchCondition condition) {
final Ref<Boolean> isStart = new Ref<>();
final Ref<String> text = new Ref<>();
condition.invite(new ArrangementMatchConditionVisitor() {
@Override
public void visit(@NotNull ArrangementAtomMatchCondition condition) {
final ArrangementSettingsToken type = condition.getType();
if (type.equals(START_SECTION)) {
isStart.set(true);
} else if (type.equals(END_SECTION)) {
isStart.set(false);
} else if (type.equals(TEXT)) {
text.set(condition.getValue().toString());
}
}
@Override
public void visit(@NotNull ArrangementCompositeMatchCondition condition) {
for (ArrangementMatchCondition c : condition.getOperands()) {
c.invite(this);
if (!text.isNull() && !isStart.isNull()) {
return;
}
}
}
});
if (isStart.isNull()) {
return null;
}
return new ArrangementSectionRuleData(processSectionText(StringUtil.notNullize(text.get())), isStart.get());
}
use of com.intellij.psi.codeStyle.arrangement.std.ArrangementSettingsToken in project intellij-plugins by JetBrains.
the class ActionScriptRearranger method getBlankLines.
@Override
public int getBlankLines(@NotNull CodeStyleSettings settings, @Nullable JSArrangementEntry parent, @Nullable JSArrangementEntry previous, @NotNull JSArrangementEntry target) {
if (previous == null) {
return -1;
}
final CommonCodeStyleSettings commonSettings = settings.getCommonSettings(JavaScriptSupportLoader.ECMA_SCRIPT_L4);
ArrangementSettingsToken type = target.getType();
if (VAR.equals(type) || CONST.equals(type)) {
return commonSettings.BLANK_LINES_AROUND_FIELD;
} else if (STATIC_INIT.equals(type) || CONSTRUCTOR.equals(type) || METHOD.equals(type) || PROPERTY.equals(type) || EVENT_HANDLER.equals(type)) {
return commonSettings.BLANK_LINES_AROUND_METHOD;
} else {
return -1;
}
}
Aggregations