IDEA-19061 Integrate the Rearranger-plugin into core-IDEA

'enum' and 'interface' arrangement entry types are added
This commit is contained in:
Denis.Zhdanov
2012-08-27 17:23:21 +04:00
parent 6b75fc525d
commit 69412613bc
4 changed files with 8 additions and 4 deletions
@@ -41,7 +41,7 @@ public class JavaRearranger implements Rearranger<JavaElementArrangementEntry>,
{
// Type
@NotNull private static final Set<ArrangementEntryType> SUPPORTED_TYPES = EnumSet.of(CLASS, FIELD, METHOD);
@NotNull private static final Set<ArrangementEntryType> SUPPORTED_TYPES = EnumSet.of(INTERFACE, CLASS, ENUM, FIELD, METHOD);
// Modifier
@NotNull private static final Set<ArrangementModifier> SUPPORTED_MODIFIERS = EnumSet.of(
@@ -60,6 +60,8 @@ public class JavaRearranger implements Rearranger<JavaElementArrangementEntry>,
Set<ArrangementModifier> commonModifiers = concat(visibilityModifiers, STATIC, FINAL);
MODIFIERS_BY_TYPE.put(NO_TYPE, commonModifiers);
MODIFIERS_BY_TYPE.put(ENUM, visibilityModifiers);
MODIFIERS_BY_TYPE.put(INTERFACE, visibilityModifiers);
MODIFIERS_BY_TYPE.put(CLASS, concat(commonModifiers, ABSTRACT));
MODIFIERS_BY_TYPE.put(METHOD, concat(commonModifiers, SYNCHRONIZED, ABSTRACT));
MODIFIERS_BY_TYPE.put(FIELD, concat(commonModifiers, TRANSIENT, VOLATILE));
@@ -27,5 +27,5 @@ import com.intellij.psi.codeStyle.arrangement.ArrangementEntry;
*/
public enum ArrangementEntryType {
CLASS, FIELD, METHOD
CLASS, FIELD, METHOD, ENUM, INTERFACE
}
@@ -37,7 +37,8 @@ public class DefaultArrangementSettingsRepresentationManager implements Arrangem
Object[] ids = {
// Types.
ArrangementEntryType.FIELD, ArrangementEntryType.METHOD, ArrangementEntryType.CLASS,
ArrangementEntryType.FIELD, ArrangementEntryType.METHOD, ArrangementEntryType.CLASS, ArrangementEntryType.INTERFACE,
ArrangementEntryType.ENUM,
// Visibility.
ArrangementModifier.PUBLIC, ArrangementModifier.PROTECTED, ArrangementModifier.PACKAGE_PRIVATE, ArrangementModifier.PRIVATE,
@@ -156,7 +156,8 @@ public class ArrangementRuleEditor extends JPanel {
ArrangementAtomNodeComponent componentToDeselect = myComponents.get(key);
myModel.replaceCondition(componentToDeselect.getMatchCondition(), chosenCondition);
for (ArrangementAtomNodeComponent componentToCheck : myComponents.values()) {
if (!ArrangementConfigUtil.isEnabled(componentToCheck.getMatchCondition().getValue(), myFilter, myModel.getMatchCondition())) {
Object value = componentToCheck.getMatchCondition().getValue();
if (myModel.hasCondition(value) && !ArrangementConfigUtil.isEnabled(value, myFilter, myModel.getMatchCondition())) {
myModel.removeAndCondition(componentToCheck.getMatchCondition());
}
}