mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
IDEA-19061 Integrate the Rearranger-plugin into core-IDEA
Arrangement settings are linked with the arrangement rules editing UI
This commit is contained in:
+5
-1
@@ -16,9 +16,11 @@
|
||||
package com.intellij.application.options.codeStyle.arrangement;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.codeStyle.arrangement.ArrangementRule;
|
||||
import com.intellij.psi.codeStyle.arrangement.JavaRearranger;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.ArrangementEntryType;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.StdArrangementEntryMatcher;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementSettingType;
|
||||
@@ -57,7 +59,9 @@ public abstract class AbstractArrangementRuleEditingModelTest {
|
||||
}
|
||||
|
||||
protected void configure(@NotNull ArrangementMatchCondition matchCondition) {
|
||||
Pair<ArrangementRuleEditingModelImpl,TIntIntHashMap> pair = myBuilder.build(matchCondition, myTree, myRoot, null, myGrouper);
|
||||
Pair<ArrangementRuleEditingModelImpl,TIntIntHashMap> pair = myBuilder.build(
|
||||
new ArrangementRule<StdArrangementEntryMatcher>(new StdArrangementEntryMatcher(matchCondition)), myTree, myRoot, null, myGrouper
|
||||
);
|
||||
myRowMappings.put(pair.first.getRow(), pair.first);
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -42,7 +42,7 @@ public class ArrangementRuleEditingModelImplTest extends AbstractArrangementRule
|
||||
assertNotNull(child);
|
||||
ArrangementMatchCondition expectedMatchCondition = and(atom(PUBLIC), atom(STATIC));
|
||||
assertEquals(expectedMatchCondition, child.getBackingCondition());
|
||||
assertEquals(expectedMatchCondition, model.getMatchCondition());
|
||||
assertEquals(expectedMatchCondition, model.getCondition());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -55,7 +55,7 @@ public class ArrangementRuleEditingModelImplTest extends AbstractArrangementRule
|
||||
model.addAndCondition(atom(FIELD));
|
||||
|
||||
assertEquals(2, model.getRow());
|
||||
assertEquals(and(atom(FIELD), atom(PUBLIC)), model.getMatchCondition());
|
||||
assertEquals(and(atom(FIELD), atom(PUBLIC)), model.getCondition());
|
||||
|
||||
ArrangementTreeNode fieldNode = myRoot.getFirstChild();
|
||||
assertNotNull(fieldNode);
|
||||
@@ -77,7 +77,7 @@ public class ArrangementRuleEditingModelImplTest extends AbstractArrangementRule
|
||||
|
||||
assertEquals(1, myRowMappings.size());
|
||||
assertSame(model, myRowMappings.get(2));
|
||||
assertEquals(and(atom(FIELD), atom(PUBLIC), atom(STATIC)), model.getMatchCondition());
|
||||
assertEquals(and(atom(FIELD), atom(PUBLIC), atom(STATIC)), model.getCondition());
|
||||
|
||||
ArrangementTreeNode fieldNode = myRoot.getFirstChild();
|
||||
assertNotNull(fieldNode);
|
||||
@@ -99,7 +99,7 @@ public class ArrangementRuleEditingModelImplTest extends AbstractArrangementRule
|
||||
|
||||
assertEquals(1, myRowMappings.size());
|
||||
assertSame(model, myRowMappings.get(2));
|
||||
assertEquals(and(atom(FIELD), atom(STATIC)), model.getMatchCondition());
|
||||
assertEquals(and(atom(FIELD), atom(STATIC)), model.getCondition());
|
||||
|
||||
ArrangementTreeNode fieldNode = myRoot.getFirstChild();
|
||||
assertNotNull(fieldNode);
|
||||
@@ -122,7 +122,7 @@ public class ArrangementRuleEditingModelImplTest extends AbstractArrangementRule
|
||||
model.removeAndCondition(atom(PUBLIC));
|
||||
|
||||
assertEquals(1, model.getRow());
|
||||
assertEquals(atom(FIELD), model.getMatchCondition());
|
||||
assertEquals(atom(FIELD), model.getCondition());
|
||||
|
||||
ArrangementTreeNode fieldNode = myRoot.getFirstChild();
|
||||
assertNotNull(fieldNode);
|
||||
@@ -146,10 +146,10 @@ public class ArrangementRuleEditingModelImplTest extends AbstractArrangementRule
|
||||
modelToChange.removeAndCondition(atom(PUBLIC));
|
||||
|
||||
assertSame(1, modelToChange.getRow());
|
||||
assertEquals(atom(FIELD), modelToChange.getMatchCondition());
|
||||
assertEquals(atom(FIELD), modelToChange.getCondition());
|
||||
|
||||
assertSame(3, siblingModel.getRow());
|
||||
assertEquals(and(atom(FIELD), atom(STATIC)), siblingModel.getMatchCondition());
|
||||
assertEquals(and(atom(FIELD), atom(STATIC)), siblingModel.getCondition());
|
||||
|
||||
ArrangementTreeNode atomFieldNode = myRoot.getFirstChild();
|
||||
assertNotNull(atomFieldNode);
|
||||
@@ -180,10 +180,10 @@ public class ArrangementRuleEditingModelImplTest extends AbstractArrangementRule
|
||||
|
||||
assertEquals(2, myRowMappings.size());
|
||||
assertSame(siblingModel, myRowMappings.get(2));
|
||||
assertEquals(and(atom(FIELD), atom(PUBLIC)), siblingModel.getMatchCondition());
|
||||
assertEquals(and(atom(FIELD), atom(PUBLIC)), siblingModel.getCondition());
|
||||
|
||||
assertSame(modelToChange, myRowMappings.get(3));
|
||||
assertEquals(atom(FIELD), modelToChange.getMatchCondition());
|
||||
assertEquals(atom(FIELD), modelToChange.getCondition());
|
||||
|
||||
ArrangementTreeNode compositeFieldNode = myRoot.getFirstChild();
|
||||
assertNotNull(compositeFieldNode);
|
||||
|
||||
+4
-4
@@ -54,7 +54,7 @@ class Test2 {
|
||||
public void test() {
|
||||
}
|
||||
}''',
|
||||
[new ArrangementRule(atom(ArrangementEntryType.FIELD))]
|
||||
[rule(atom(ArrangementEntryType.FIELD))]
|
||||
)
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ class Test {
|
||||
return null;
|
||||
}
|
||||
}''',
|
||||
[new ArrangementRule(atom(ArrangementEntryType.FIELD))]
|
||||
[rule(atom(ArrangementEntryType.FIELD))]
|
||||
)
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class Test {
|
||||
});
|
||||
}
|
||||
}''',
|
||||
[new ArrangementRule(atom(ArrangementEntryType.FIELD))]
|
||||
[rule(atom(ArrangementEntryType.FIELD))]
|
||||
)
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ class Test {
|
||||
});
|
||||
}
|
||||
}''',
|
||||
[new ArrangementRule(atom(ArrangementEntryType.FIELD))]
|
||||
[rule(atom(ArrangementEntryType.FIELD))]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user