Merge remote branch 'origin/master'
@@ -351,10 +351,6 @@ public class JavaRearranger implements Rearranger<JavaElementArrangementEntry>,
|
||||
n.invite(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
}
|
||||
});
|
||||
Object key = typeRef.get() == null ? NO_TYPE : typeRef.get();
|
||||
Set<ArrangementModifier> modifiers = MODIFIERS_BY_TYPE.get(key);
|
||||
@@ -380,6 +376,11 @@ public class JavaRearranger implements Rearranger<JavaElementArrangementEntry>,
|
||||
return DEFAULT_SETTINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNameFilterSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(@NotNull ArrangementGroupingType groupingType, @Nullable ArrangementEntryOrderType orderType) {
|
||||
Set<ArrangementEntryOrderType> orderTypes = GROUPING_RULES.get(groupingType);
|
||||
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1007 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 645 B |
|
After Width: | Height: | Size: 831 B |
|
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 731 B After Width: | Height: | Size: 508 B |
|
After Width: | Height: | Size: 927 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 979 B |
|
After Width: | Height: | Size: 1013 B |
|
After Width: | Height: | Size: 790 B |
|
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 521 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 930 B |
|
After Width: | Height: | Size: 1013 B |
|
After Width: | Height: | Size: 600 B |
|
After Width: | Height: | Size: 603 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 263 B |
|
After Width: | Height: | Size: 1009 B |
|
After Width: | Height: | Size: 986 B |
|
After Width: | Height: | Size: 360 B |
|
Before Width: | Height: | Size: 490 B After Width: | Height: | Size: 516 B |
|
Before Width: | Height: | Size: 495 B After Width: | Height: | Size: 470 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 860 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 323 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 451 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 526 B |
|
Before Width: | Height: | Size: 804 B After Width: | Height: | Size: 543 B |
|
Before Width: | Height: | Size: 678 B After Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 204 B |
|
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 537 B |
|
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 612 B |
|
Before Width: | Height: | Size: 870 B After Width: | Height: | Size: 741 B |
|
Before Width: | Height: | Size: 807 B After Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 414 B |
|
Before Width: | Height: | Size: 664 B After Width: | Height: | Size: 553 B |
|
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 687 B |
|
Before Width: | Height: | Size: 755 B After Width: | Height: | Size: 511 B |
|
Before Width: | Height: | Size: 755 B After Width: | Height: | Size: 395 B |
|
Before Width: | Height: | Size: 664 B After Width: | Height: | Size: 584 B |
|
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 846 B After Width: | Height: | Size: 479 B |
|
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 467 B |
|
Before Width: | Height: | Size: 764 B After Width: | Height: | Size: 724 B |
|
Before Width: | Height: | Size: 785 B After Width: | Height: | Size: 461 B |
|
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 774 B After Width: | Height: | Size: 587 B |
|
Before Width: | Height: | Size: 563 B After Width: | Height: | Size: 469 B |
|
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 494 B |
|
Before Width: | Height: | Size: 693 B After Width: | Height: | Size: 746 B |
|
Before Width: | Height: | Size: 703 B After Width: | Height: | Size: 696 B |
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 414 B |
@@ -18,7 +18,7 @@ package com.intellij.psi.codeStyle.arrangement;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementCompositeMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementNameMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementSettingType;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -34,16 +34,25 @@ public class ArrangementConditionInfo {
|
||||
|
||||
@NotNull private final Set<ArrangementAtomMatchCondition> myAtomConditions = ContainerUtilRt.newHashSet();
|
||||
@NotNull private final Set<Object> myConditions = ContainerUtilRt.newHashSet();
|
||||
|
||||
@Nullable private ArrangementNameMatchCondition myNameCondition;
|
||||
|
||||
public void setNameCondition(@Nullable ArrangementNameMatchCondition condition) {
|
||||
myNameCondition = condition;
|
||||
@Nullable private String myNamePattern;
|
||||
|
||||
@Nullable
|
||||
public String getNamePattern() {
|
||||
return myNamePattern;
|
||||
}
|
||||
|
||||
|
||||
public void setNamePattern(@Nullable String namePattern) {
|
||||
myNamePattern = namePattern;
|
||||
}
|
||||
|
||||
public void addAtomCondition(@NotNull ArrangementAtomMatchCondition condition) {
|
||||
myAtomConditions.add(condition);
|
||||
myConditions.add(condition.getValue());
|
||||
switch (condition.getType()) {
|
||||
case NAME: myNamePattern = condition.getValue().toString(); break;
|
||||
default:
|
||||
myAtomConditions.add(condition);
|
||||
myConditions.add(condition.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasCondition(@NotNull Object condition) {
|
||||
@@ -66,15 +75,15 @@ public class ArrangementConditionInfo {
|
||||
@Nullable
|
||||
public ArrangementMatchCondition buildCondition() {
|
||||
if (myAtomConditions.isEmpty()) {
|
||||
return myNameCondition == null ? null : myNameCondition;
|
||||
return myNamePattern == null ? null : new ArrangementAtomMatchCondition(ArrangementSettingType.NAME, myNamePattern);
|
||||
}
|
||||
else if (myAtomConditions.size() == 1 && myNameCondition == null) {
|
||||
else if (myAtomConditions.size() == 1 && myNamePattern == null) {
|
||||
return myAtomConditions.iterator().next();
|
||||
}
|
||||
else {
|
||||
ArrangementCompositeMatchCondition result = new ArrangementCompositeMatchCondition(myAtomConditions);
|
||||
if (myNameCondition != null) {
|
||||
result.addOperand(myNameCondition);
|
||||
if (myNamePattern != null) {
|
||||
result.addOperand(new ArrangementAtomMatchCondition(ArrangementSettingType.NAME, myNamePattern));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -75,11 +75,6 @@ public class ArrangementUtil {
|
||||
operand.invite(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
result.addOperand(condition);
|
||||
}
|
||||
};
|
||||
for (ArrangementMatchCondition node : nodes) {
|
||||
node.invite(visitor);
|
||||
@@ -148,6 +143,9 @@ public class ArrangementUtil {
|
||||
else if (condition instanceof ArrangementModifier) {
|
||||
return ArrangementSettingType.MODIFIER;
|
||||
}
|
||||
else if (condition instanceof String) {
|
||||
return ArrangementSettingType.NAME;
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Can't parse type for the given condition of class '%s': %s", condition.getClass(), condition
|
||||
@@ -180,11 +178,6 @@ public class ArrangementUtil {
|
||||
operand.invite(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
result.setNameCondition(condition);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -75,8 +75,6 @@ public class DefaultArrangementEntryMatcherSerializer {
|
||||
private static final Logger LOG = Logger.getInstance("#" + DefaultArrangementEntryMatcherSerializer.class.getName());
|
||||
|
||||
@NotNull private static final String COMPOSITE_CONDITION_NAME = "AND";
|
||||
@NotNull private static final String PATTERN_CONDITION_NAME = "NAME";
|
||||
|
||||
private static final Set<String> ATOM_SETTINGS_TYPES = new HashSet<String>();
|
||||
|
||||
static {
|
||||
@@ -115,10 +113,7 @@ public class DefaultArrangementEntryMatcherSerializer {
|
||||
@Nullable
|
||||
private static ArrangementMatchCondition deserializeCondition(@NotNull Element matcherElement) {
|
||||
String name = matcherElement.getName();
|
||||
if (PATTERN_CONDITION_NAME.equals(name)) {
|
||||
return new ArrangementNameMatchCondition(StringUtil.unescapeStringCharacters(matcherElement.getText()));
|
||||
}
|
||||
else if (!COMPOSITE_CONDITION_NAME.equals(name)) {
|
||||
if (!COMPOSITE_CONDITION_NAME.equals(name)) {
|
||||
if (ATOM_SETTINGS_TYPES.contains(name)) {
|
||||
return deserializeAtomCondition(matcherElement);
|
||||
}
|
||||
@@ -150,6 +145,7 @@ public class DefaultArrangementEntryMatcherSerializer {
|
||||
switch (settingType) {
|
||||
case TYPE: value = ArrangementEntryType.valueOf(matcherElement.getText()); break;
|
||||
case MODIFIER: value = ArrangementModifier.valueOf(matcherElement.getText()); break;
|
||||
case NAME: value = StringUtil.unescapeStringCharacters(matcherElement.getText()); break;
|
||||
default:
|
||||
LOG.warn(String.format(
|
||||
"Can't deserialize an arrangement entry matcher from element of type '%s' with text '%s'",
|
||||
@@ -167,7 +163,11 @@ public class DefaultArrangementEntryMatcherSerializer {
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementAtomMatchCondition condition) {
|
||||
Element element = new Element(condition.getType().toString()).setText(condition.getValue().toString());
|
||||
String content = condition.getValue().toString();
|
||||
if (condition.getType() == ArrangementSettingType.NAME) {
|
||||
content = StringUtil.escapeStringCharacters(content);
|
||||
}
|
||||
Element element = new Element(condition.getType().toString()).setText(content);
|
||||
register(element);
|
||||
}
|
||||
|
||||
@@ -183,12 +183,6 @@ public class DefaultArrangementEntryMatcherSerializer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
Element element = new Element(PATTERN_CONDITION_NAME).setText(StringUtil.escapeStringCharacters(condition.getPattern()));
|
||||
register(element);
|
||||
}
|
||||
|
||||
private void register(@NotNull Element element) {
|
||||
if (result == null) {
|
||||
result = element;
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.psi.codeStyle.arrangement.ArrangementEntry;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.*;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
@@ -85,10 +86,11 @@ public class StdArrangementEntryMatcher implements ArrangementEntryMatcher {
|
||||
|
||||
private static class MyVisitor implements ArrangementMatchConditionVisitor {
|
||||
|
||||
@NotNull private final List<ArrangementEntryMatcher> myMatchers = ContainerUtilRt.newArrayList();
|
||||
@NotNull private final Set<ArrangementEntryType> myTypes = EnumSet.noneOf(ArrangementEntryType.class);
|
||||
@NotNull private final Set<ArrangementModifier> myModifiers = EnumSet.noneOf(ArrangementModifier.class);
|
||||
@NotNull private final List<String> myNamePatterns = ContainerUtilRt.newArrayList();
|
||||
@NotNull private final List<ArrangementEntryMatcher> myMatchers = ContainerUtilRt.newArrayList();
|
||||
@NotNull private final Set<ArrangementEntryType> myTypes = EnumSet.noneOf(ArrangementEntryType.class);
|
||||
@NotNull private final Set<ArrangementModifier> myModifiers = EnumSet.noneOf(ArrangementModifier.class);
|
||||
|
||||
@Nullable private String myNamePattern;
|
||||
|
||||
private boolean nestedComposite;
|
||||
|
||||
@@ -100,6 +102,9 @@ public class StdArrangementEntryMatcher implements ArrangementEntryMatcher {
|
||||
break;
|
||||
case MODIFIER:
|
||||
myModifiers.add((ArrangementModifier)condition.getValue());
|
||||
break;
|
||||
case NAME:
|
||||
myNamePattern = condition.getValue().toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,17 +121,12 @@ public class StdArrangementEntryMatcher implements ArrangementEntryMatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
myNamePatterns.add(condition.getPattern());
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@NotNull
|
||||
public ArrangementEntryMatcher getMatcher() {
|
||||
ByTypeArrangementEntryMatcher byType = myTypes.isEmpty() ? null : new ByTypeArrangementEntryMatcher(myTypes);
|
||||
ByModifierArrangementEntryMatcher byModifiers = myModifiers.isEmpty() ? null : new ByModifierArrangementEntryMatcher(myModifiers);
|
||||
ByNameArrangementEntryMatcher byName = myNamePatterns.size() != 1 ? null : new ByNameArrangementEntryMatcher(myNamePatterns.get(0));
|
||||
ByNameArrangementEntryMatcher byName = myNamePattern == null ? null : new ByNameArrangementEntryMatcher(myNamePattern);
|
||||
int i = countNonNulls(byType, byModifiers, byName);
|
||||
if (i == 0 && myMatchers.isEmpty()) {
|
||||
return ArrangementEntryMatcher.EMPTY;
|
||||
|
||||
@@ -26,6 +26,4 @@ public interface ArrangementMatchConditionVisitor {
|
||||
void visit(@NotNull ArrangementAtomMatchCondition condition);
|
||||
|
||||
void visit(@NotNull ArrangementCompositeMatchCondition condition);
|
||||
|
||||
void visit(@NotNull ArrangementNameMatchCondition condition);
|
||||
}
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.psi.codeStyle.arrangement.model;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.arrangement.NameAwareArrangementEntry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Condition which works on {@link NameAwareArrangementEntry}
|
||||
*
|
||||
* @author Denis Zhdanov
|
||||
* @since 11/14/12 12:18 PM
|
||||
*/
|
||||
public class ArrangementNameMatchCondition implements ArrangementMatchCondition {
|
||||
|
||||
@NotNull private final String myPattern;
|
||||
|
||||
public ArrangementNameMatchCondition(@NotNull String pattern) {
|
||||
myPattern = pattern;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getPattern() {
|
||||
return myPattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invite(@NotNull ArrangementMatchConditionVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ArrangementMatchCondition clone() {
|
||||
return new ArrangementNameMatchCondition(myPattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return myPattern.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
ArrangementNameMatchCondition condition = (ArrangementNameMatchCondition)o;
|
||||
return myPattern.equals(condition.myPattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("name like '%s'", StringUtil.escapeStringCharacters(myPattern));
|
||||
}
|
||||
}
|
||||
@@ -20,5 +20,5 @@ package com.intellij.psi.codeStyle.arrangement.model;
|
||||
* @since 8/6/12 5:02 PM
|
||||
*/
|
||||
public enum ArrangementSettingType {
|
||||
TYPE, MODIFIER
|
||||
TYPE, MODIFIER, NAME
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi.codeStyle.arrangement.settings;
|
||||
|
||||
import com.intellij.psi.codeStyle.arrangement.NameAwareArrangementEntry;
|
||||
import com.intellij.psi.codeStyle.arrangement.StdArrangementSettings;
|
||||
import com.intellij.psi.codeStyle.arrangement.group.ArrangementGroupingType;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.ArrangementEntryType;
|
||||
@@ -42,6 +43,13 @@ public interface ArrangementStandardSettingsAware {
|
||||
*/
|
||||
@Nullable
|
||||
StdArrangementSettings getDefaultSettings();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if name-based rules are supported by the current rearranger (it knows
|
||||
* about {@link NameAwareArrangementEntry});
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
boolean isNameFilterSupported();
|
||||
|
||||
/**
|
||||
* Allows to answer if given entry type can be applied for the rule specified by the given settings node.
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementCompositeMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementNameMatchCondition;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Test;
|
||||
@@ -33,6 +32,7 @@ import static com.intellij.psi.codeStyle.arrangement.match.ArrangementEntryType.
|
||||
import static com.intellij.psi.codeStyle.arrangement.match.ArrangementEntryType.METHOD;
|
||||
import static com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier.*;
|
||||
import static com.intellij.psi.codeStyle.arrangement.model.ArrangementSettingType.MODIFIER;
|
||||
import static com.intellij.psi.codeStyle.arrangement.model.ArrangementSettingType.NAME;
|
||||
import static com.intellij.psi.codeStyle.arrangement.model.ArrangementSettingType.TYPE;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class DefaultArrangementEntryMatcherSerializerTest {
|
||||
|
||||
@Test
|
||||
public void nameConditionOnly() {
|
||||
ArrangementNameMatchCondition condition = new ArrangementNameMatchCondition("get*");
|
||||
ArrangementAtomMatchCondition condition = new ArrangementAtomMatchCondition(NAME, "get*");
|
||||
doTest(condition);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class DefaultArrangementEntryMatcherSerializerTest {
|
||||
ArrangementCompositeMatchCondition condition = new ArrangementCompositeMatchCondition();
|
||||
condition.addOperand(new ArrangementAtomMatchCondition(TYPE, METHOD));
|
||||
condition.addOperand(new ArrangementAtomMatchCondition(MODIFIER, SYNCHRONIZED));
|
||||
condition.addOperand(new ArrangementNameMatchCondition("get*"));
|
||||
condition.addOperand(new ArrangementAtomMatchCondition(NAME, ("get*")));
|
||||
doTest(condition);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +46,10 @@ public class ArrangementConstants {
|
||||
public static final int CALLOUT_BORDER_HEIGHT = 10;
|
||||
public static final int BORDER_ARC_SIZE = 12;
|
||||
|
||||
public static final int ANIMATION_ITERATION_PIXEL_STEP = 5;
|
||||
public static final int ANIMATION_STEPS_TIME_GAP_MILLIS = 40;
|
||||
|
||||
public static final int ANIMATION_ITERATION_PIXEL_STEP = 5;
|
||||
public static final int ANIMATION_STEPS_TIME_GAP_MILLIS = 40;
|
||||
public static final int NAME_CONDITION_UPDATE_DELAY_MILLIS = 1000;
|
||||
|
||||
public static final boolean LOG_RULE_MODIFICATION = Boolean.parseBoolean(System.getProperty("log.arrangement.rule.modification"));
|
||||
|
||||
private ArrangementConstants() {
|
||||
|
||||
@@ -48,6 +48,7 @@ import java.util.Set;
|
||||
public class ArrangementNodeDisplayManager {
|
||||
|
||||
@NotNull private final TObjectIntHashMap<ArrangementSettingType> myMaxWidths = new TObjectIntHashMap<ArrangementSettingType>();
|
||||
|
||||
@NotNull private final ArrangementStandardSettingsAware myFilter;
|
||||
@NotNull private final ArrangementColorsProvider myColorsProvider;
|
||||
@NotNull private ArrangementStandardSettingsRepresentationAware myRepresentationManager;
|
||||
@@ -119,8 +120,16 @@ public class ArrangementNodeDisplayManager {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param type target condition type
|
||||
* @return max width in pixels for the condition value of the given type if any;
|
||||
* <code>'-1'</code> as an indication that no max width limit exists for the condition value of the given type
|
||||
*/
|
||||
public int getMaxWidth(@NotNull ArrangementSettingType type) {
|
||||
if (type == ArrangementSettingType.NAME) {
|
||||
return -1;
|
||||
}
|
||||
return myMaxWidths.get(type);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,11 +58,9 @@ public class ArrangementAndMatchConditionComponent extends JPanel implements Arr
|
||||
setOpaque(false);
|
||||
setLayout(new GridBagLayout());
|
||||
final Map<Object, ArrangementMatchCondition> operands = new HashMap<Object, ArrangementMatchCondition>();
|
||||
final List<ArrangementNameMatchCondition> nameConditions = new ArrayList<ArrangementNameMatchCondition>();
|
||||
ArrangementMatchConditionVisitor visitor = new ArrangementMatchConditionVisitor() {
|
||||
@Override public void visit(@NotNull ArrangementAtomMatchCondition condition) { operands.put(condition.getValue(), condition); }
|
||||
@Override public void visit(@NotNull ArrangementCompositeMatchCondition condition) { operands.put(condition, condition); }
|
||||
@Override public void visit(@NotNull ArrangementNameMatchCondition condition) { nameConditions.add(condition); }
|
||||
};
|
||||
for (ArrangementMatchCondition operand : setting.getOperands()) {
|
||||
operand.invite(visitor);
|
||||
@@ -78,12 +76,6 @@ public class ArrangementAndMatchConditionComponent extends JPanel implements Arr
|
||||
JComponent uiComponent = component.getUiComponent();
|
||||
add(uiComponent, constraints);
|
||||
}
|
||||
for (ArrangementNameMatchCondition condition : nameConditions) {
|
||||
ArrangementMatchConditionComponent component = factory.getComponent(condition, rule, true);
|
||||
myComponents.add(component);
|
||||
JComponent uiComponent = component.getUiComponent();
|
||||
add(uiComponent, constraints);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -25,11 +25,13 @@ import com.intellij.application.options.codeStyle.arrangement.util.InsetsPanel;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionButton;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementSettingType;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.RoundedLineBorder;
|
||||
import com.intellij.ui.SimpleColoredComponent;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import com.intellij.util.ui.GridBag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -37,6 +39,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* {@link ArrangementMatchConditionComponent} for {@link ArrangementAtomMatchCondition} representation.
|
||||
@@ -48,6 +51,16 @@ import java.awt.event.MouseEvent;
|
||||
*/
|
||||
public class ArrangementAtomMatchConditionComponent implements ArrangementMatchConditionComponent {
|
||||
|
||||
@NotNull private static final Map<ArrangementSettingType, BorderStrategy> BORDER_STRATEGIES = ContainerUtilRt.newHashMap();
|
||||
static {
|
||||
BORDER_STRATEGIES.put(ArrangementSettingType.NAME, new NameBorderStrategy());
|
||||
|
||||
PredefinedConditionBorderStrategy strategy = new PredefinedConditionBorderStrategy();
|
||||
BORDER_STRATEGIES.put(ArrangementSettingType.TYPE, strategy);
|
||||
BORDER_STRATEGIES.put(ArrangementSettingType.MODIFIER, strategy);
|
||||
assert BORDER_STRATEGIES.size() == ArrangementSettingType.values().length;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private final SimpleColoredComponent myTextControl = new SimpleColoredComponent() {
|
||||
@Override
|
||||
@@ -71,6 +84,7 @@ public class ArrangementAtomMatchConditionComponent implements ArrangementMatchC
|
||||
}
|
||||
};
|
||||
|
||||
@NotNull private final BorderStrategy myBorderStrategy;
|
||||
@NotNull private final String myText;
|
||||
@NotNull private final ArrangementColorsProvider myColorsProvider;
|
||||
@NotNull private final RoundedLineBorder myBorder;
|
||||
@@ -97,10 +111,17 @@ public class ArrangementAtomMatchConditionComponent implements ArrangementMatchC
|
||||
myColorsProvider = colorsProvider;
|
||||
myCondition = condition;
|
||||
myCloseCallback = closeCallback;
|
||||
myBorderStrategy = BORDER_STRATEGIES.get(condition.getType());
|
||||
myText = manager.getDisplayValue(condition);
|
||||
myTextControl.setTextAlign(SwingConstants.CENTER);
|
||||
myTextControl.append(myText, SimpleTextAttributes.fromTextAttributes(colorsProvider.getTextAttributes(condition.getType(), false)));
|
||||
myTextControlSize = new Dimension(manager.getMaxWidth(condition.getType()), myTextControl.getPreferredSize().height);
|
||||
int maxWidth = manager.getMaxWidth(condition.getType());
|
||||
if (maxWidth > 0) {
|
||||
myTextControlSize = new Dimension(maxWidth, myTextControl.getPreferredSize().height);
|
||||
}
|
||||
else {
|
||||
myTextControlSize = myTextControl.getPreferredSize();
|
||||
}
|
||||
|
||||
final ArrangementRemoveConditionAction action = new ArrangementRemoveConditionAction();
|
||||
Icon buttonIcon = action.getTemplatePresentation().getIcon();
|
||||
@@ -124,8 +145,6 @@ public class ArrangementAtomMatchConditionComponent implements ArrangementMatchC
|
||||
myCloseButtonBounds = new Rectangle(0, 0, buttonIcon.getIconWidth(), buttonIcon.getIconHeight());
|
||||
}
|
||||
|
||||
|
||||
|
||||
JPanel insetsPanel = new JPanel(new GridBagLayout()) {
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -158,12 +177,18 @@ public class ArrangementAtomMatchConditionComponent implements ArrangementMatchC
|
||||
public String toString() {
|
||||
return "round border panel for " + myText;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintBorder(Graphics g) {
|
||||
myBorderStrategy.setup((Graphics2D)g);
|
||||
super.paintBorder(g);
|
||||
}
|
||||
};
|
||||
roundBorderPanel.add(insetsPanel, new GridBag().anchor(GridBagConstraints.WEST));
|
||||
if (myCloseButton != null) {
|
||||
roundBorderPanel.add(new InsetsPanel(myCloseButton), new GridBag().anchor(GridBagConstraints.EAST));
|
||||
}
|
||||
myBorder = IdeBorderFactory.createRoundedBorder(ArrangementConstants.BORDER_ARC_SIZE);
|
||||
myBorder = myBorderStrategy.create();
|
||||
roundBorderPanel.setBorder(myBorder);
|
||||
roundBorderPanel.setOpaque(false);
|
||||
|
||||
@@ -297,4 +322,35 @@ public class ArrangementAtomMatchConditionComponent implements ArrangementMatchC
|
||||
public String toString() {
|
||||
return myText;
|
||||
}
|
||||
|
||||
private interface BorderStrategy {
|
||||
RoundedLineBorder create();
|
||||
void setup(@NotNull Graphics2D g);
|
||||
}
|
||||
|
||||
private static class PredefinedConditionBorderStrategy implements BorderStrategy {
|
||||
@Override
|
||||
public RoundedLineBorder create() {
|
||||
return IdeBorderFactory.createRoundedBorder(ArrangementConstants.BORDER_ARC_SIZE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(@NotNull Graphics2D g) {
|
||||
}
|
||||
}
|
||||
|
||||
private static class NameBorderStrategy implements BorderStrategy {
|
||||
|
||||
@NotNull private final BasicStroke myStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1, new float[]{5, 5}, 0);
|
||||
|
||||
@Override
|
||||
public RoundedLineBorder create() {
|
||||
return IdeBorderFactory.createRoundedBorder(ArrangementConstants.BORDER_ARC_SIZE, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup(@NotNull Graphics2D g) {
|
||||
g.setStroke(myStroke);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,11 +80,6 @@ public class ArrangementMatchNodeComponentFactory {
|
||||
public void visit(@NotNull ArrangementCompositeMatchCondition condition) {
|
||||
ref.set(new ArrangementAndMatchConditionComponent(rule, condition, ArrangementMatchNodeComponentFactory.this, myDisplayManager));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
ref.set(new ArrangementNameConditionComponent(condition));
|
||||
}
|
||||
});
|
||||
return ref.get();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ import com.intellij.application.options.codeStyle.arrangement.ArrangementConstan
|
||||
import com.intellij.application.options.codeStyle.arrangement.ArrangementNodeDisplayManager;
|
||||
import com.intellij.application.options.codeStyle.arrangement.color.ArrangementColorsProvider;
|
||||
import com.intellij.application.options.codeStyle.arrangement.util.ArrangementConfigUtil;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.arrangement.ArrangementConditionInfo;
|
||||
import com.intellij.psi.codeStyle.arrangement.ArrangementUtil;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.ArrangementEntryMatcher;
|
||||
@@ -30,6 +33,9 @@ import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementSettingType;
|
||||
import com.intellij.psi.codeStyle.arrangement.settings.ArrangementStandardSettingsAware;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.components.JBTextField;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import com.intellij.util.ui.GridBag;
|
||||
import com.intellij.util.ui.MultiRowFlowPanel;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -37,11 +43,17 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Control for managing {@link ArrangementEntryMatcher matching rule conditions} for a single {@link ArrangementMatchRule}.
|
||||
@@ -53,11 +65,12 @@ import java.util.List;
|
||||
*/
|
||||
public class ArrangementMatchingRuleEditor extends JPanel {
|
||||
|
||||
@NotNull private final List<MultiRowFlowPanel> myRows = new ArrayList<MultiRowFlowPanel>();
|
||||
@NotNull private final Map<Object, ArrangementAtomMatchConditionComponent> myComponents = ContainerUtilRt.newHashMap();
|
||||
@NotNull private final List<MultiRowFlowPanel> myRows = ContainerUtilRt.newArrayList();
|
||||
|
||||
@NotNull private final Alarm myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
|
||||
@NotNull private final JBTextField myNameField = new JBTextField(20);
|
||||
|
||||
@NotNull private final Map<Object, ArrangementAtomMatchConditionComponent> myComponents =
|
||||
new HashMap<Object, ArrangementAtomMatchConditionComponent>();
|
||||
|
||||
@NotNull private final ArrangementMatchingRulesControl myControl;
|
||||
@NotNull private final ArrangementStandardSettingsAware myFilter;
|
||||
@NotNull private final ArrangementColorsProvider myColorsProvider;
|
||||
@@ -65,6 +78,7 @@ public class ArrangementMatchingRuleEditor extends JPanel {
|
||||
@Nullable private ArrangementConditionInfo myConditionInfo;
|
||||
private int myRow = -1;
|
||||
private int myLabelWidth;
|
||||
private boolean myRequestFocus;
|
||||
|
||||
public ArrangementMatchingRuleEditor(@NotNull ArrangementStandardSettingsAware filter,
|
||||
@NotNull ArrangementColorsProvider provider,
|
||||
@@ -81,6 +95,11 @@ public class ArrangementMatchingRuleEditor extends JPanel {
|
||||
onMouseClicked(e);
|
||||
}
|
||||
});
|
||||
myNameField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override public void insertUpdate(DocumentEvent e) { scheduleNameUpdate(); }
|
||||
@Override public void removeUpdate(DocumentEvent e) { scheduleNameUpdate(); }
|
||||
@Override public void changedUpdate(DocumentEvent e) { scheduleNameUpdate(); }
|
||||
});
|
||||
}
|
||||
|
||||
private void init(@NotNull ArrangementNodeDisplayManager displayManager) {
|
||||
@@ -90,8 +109,42 @@ public class ArrangementMatchingRuleEditor extends JPanel {
|
||||
Map<ArrangementSettingType, Set<?>> supportedSettings = ArrangementConfigUtil.buildAvailableConditions(myFilter, null);
|
||||
addRowIfPossible(ArrangementSettingType.TYPE, supportedSettings, displayManager);
|
||||
addRowIfPossible(ArrangementSettingType.MODIFIER, supportedSettings, displayManager);
|
||||
addNameFilterIfPossible();
|
||||
applyBackground(UIUtil.getListBackground());
|
||||
}
|
||||
|
||||
private void scheduleNameUpdate() {
|
||||
myAlarm.cancelAllRequests();
|
||||
myAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateName();
|
||||
}
|
||||
}, ArrangementConstants.NAME_CONDITION_UPDATE_DELAY_MILLIS);
|
||||
}
|
||||
|
||||
private void updateName() {
|
||||
myAlarm.cancelAllRequests();
|
||||
if (myRow < 0 || myConditionInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String namePattern = myNameField.getText();
|
||||
if (StringUtil.isEmpty(namePattern)) {
|
||||
namePattern = null;
|
||||
}
|
||||
if (Comparing.equal(namePattern, myConditionInfo.getNamePattern())) {
|
||||
return;
|
||||
}
|
||||
myConditionInfo.setNamePattern(namePattern);
|
||||
ArrangementMatchCondition newCondition = myConditionInfo.buildCondition();
|
||||
Object modelValue = newCondition == null
|
||||
? new EmptyArrangementRuleComponent(myControl.getRowHeight(myRow))
|
||||
: new StdArrangementMatchRule(new StdArrangementEntryMatcher(newCondition));
|
||||
myControl.getModel().set(myRow, modelValue);
|
||||
myControl.repaintRows(myRow, myRow, true);
|
||||
}
|
||||
|
||||
private void addRowIfPossible(@NotNull ArrangementSettingType key,
|
||||
@NotNull Map<ArrangementSettingType, Set<?>> supportedSettings,
|
||||
@NotNull ArrangementNodeDisplayManager manager)
|
||||
@@ -101,23 +154,47 @@ public class ArrangementMatchingRuleEditor extends JPanel {
|
||||
return;
|
||||
}
|
||||
|
||||
MultiRowFlowPanel valuesPanel = new MultiRowFlowPanel(
|
||||
FlowLayout.LEFT, ArrangementConstants.HORIZONTAL_GAP, ArrangementConstants.VERTICAL_GAP
|
||||
);
|
||||
MultiRowFlowPanel valuesPanel = newRow(manager.getDisplayLabel(key));
|
||||
for (Object value : manager.sort(values)) {
|
||||
ArrangementAtomMatchConditionComponent component =
|
||||
new ArrangementAtomMatchConditionComponent(manager, myColorsProvider, new ArrangementAtomMatchCondition(key, value), null);
|
||||
myComponents.put(value, component);
|
||||
valuesPanel.add(component.getUiComponent());
|
||||
}
|
||||
}
|
||||
|
||||
int top = ArrangementConstants.VERTICAL_PADDING;
|
||||
JLabel label = new JLabel(manager.getDisplayLabel(key) + ":");
|
||||
add(label, new GridBag().anchor(GridBagConstraints.NORTHWEST).insets(top, 0, 0, 0));
|
||||
private void addNameFilterIfPossible() {
|
||||
if (!myFilter.isNameFilterSupported()) {
|
||||
return;
|
||||
}
|
||||
MultiRowFlowPanel panel = newRow(ApplicationBundle.message("arrangement.text.name"));
|
||||
panel.add(myNameField);
|
||||
}
|
||||
|
||||
private MultiRowFlowPanel newRow(@NotNull String rowLabel) {
|
||||
MultiRowFlowPanel result = new MultiRowFlowPanel(
|
||||
FlowLayout.LEFT, ArrangementConstants.HORIZONTAL_GAP, ArrangementConstants.VERTICAL_GAP
|
||||
);
|
||||
JLabel label = new JLabel(rowLabel + ":");
|
||||
add(label, new GridBag().anchor(GridBagConstraints.NORTHWEST).insets(ArrangementConstants.VERTICAL_PADDING, 0, 0, 0));
|
||||
myLabelWidth = Math.max(myLabelWidth, label.getPreferredSize().width);
|
||||
add(valuesPanel, new GridBag().anchor(GridBagConstraints.WEST).weightx(1).fillCellHorizontally().coverLine());
|
||||
myRows.add(valuesPanel);
|
||||
applyBackground(UIUtil.getListBackground());
|
||||
|
||||
add(result, new GridBag().anchor(GridBagConstraints.WEST).weightx(1).fillCellHorizontally().coverLine());
|
||||
myRows.add(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
if (myRequestFocus) {
|
||||
if (myNameField.isFocusOwner()) {
|
||||
myRequestFocus = false;
|
||||
}
|
||||
else {
|
||||
myNameField.requestFocusInWindow();
|
||||
}
|
||||
}
|
||||
super.paintComponent(g);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,9 +208,13 @@ public class ArrangementMatchingRuleEditor extends JPanel {
|
||||
}
|
||||
|
||||
private void updateState(int row, boolean newModel) {
|
||||
myAlarm.cancelAllRequests();
|
||||
if (newModel) {
|
||||
myRow = row;
|
||||
myConditionInfo = null;
|
||||
myNameField.setText("");
|
||||
myAlarm.cancelAllRequests();
|
||||
myRequestFocus = true;
|
||||
}
|
||||
|
||||
// Reset state.
|
||||
@@ -164,6 +245,7 @@ public class ArrangementMatchingRuleEditor extends JPanel {
|
||||
|
||||
ArrangementMatchCondition condition = ((StdArrangementMatchRule)element).getMatcher().getCondition();
|
||||
myConditionInfo = ArrangementUtil.extractConditions(condition);
|
||||
myNameField.setText(myConditionInfo.getNamePattern() == null ? "" : myConditionInfo.getNamePattern());
|
||||
|
||||
Map<ArrangementSettingType, Set<?>> available = ArrangementConfigUtil.buildAvailableConditions(myFilter, condition);
|
||||
for (Collection<?> ids : available.values()) {
|
||||
|
||||
@@ -79,6 +79,7 @@ public class ArrangementMatchingRulesControl extends JBTable {
|
||||
setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||
setShowColumns(false);
|
||||
setShowGrid(false);
|
||||
setSurrendersFocusOnKeystroke(true);
|
||||
putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
|
||||
myEditor = new ArrangementMatchingRuleEditor(settingsFilter, colorsProvider, displayManager, this);
|
||||
addMouseMotionListener(new MouseAdapter() {
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options.codeStyle.arrangement.match;
|
||||
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementNameMatchCondition;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
* @author Denis Zhdanov
|
||||
* @since 11/14/12 12:24 PM
|
||||
*/
|
||||
public class ArrangementNameConditionComponent implements ArrangementMatchConditionComponent {
|
||||
|
||||
@NotNull private final ArrangementNameMatchCondition myCondition;
|
||||
|
||||
public ArrangementNameConditionComponent(@NotNull ArrangementNameMatchCondition condition) {
|
||||
myCondition = condition;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ArrangementMatchCondition getMatchCondition() {
|
||||
return myCondition;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JComponent getUiComponent() {
|
||||
// TODO den implement
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Rectangle getScreenBounds() {
|
||||
// TODO den implement
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(boolean selected) {
|
||||
// TODO den implement
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Rectangle onMouseMove(@NotNull MouseEvent event) {
|
||||
// TODO den implement
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseRelease(@NotNull MouseEvent event) {
|
||||
// TODO den implement
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Rectangle onMouseExited() {
|
||||
// TODO den implement
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Rectangle onMouseEntered(@NotNull MouseEvent e) {
|
||||
// TODO den implement
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,11 @@ public class IdeBorderFactory {
|
||||
return new RoundedLineBorder(getBorderColor(), arcSize);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static RoundedLineBorder createRoundedBorder(int arcSize, final int thickness) {
|
||||
return new RoundedLineBorder(getBorderColor(), arcSize, thickness);
|
||||
}
|
||||
|
||||
public static Border createEmptyBorder(Insets insets) {
|
||||
return new EmptyBorder(insets);
|
||||
}
|
||||
|
||||
@@ -557,6 +557,7 @@ arrangement.title.settings.tab=Arrangement
|
||||
arrangement.text.empty.rule=<empty rule>
|
||||
arrangement.text.type=Type
|
||||
arrangement.text.modifier=Modifier
|
||||
arrangement.text.name=Name
|
||||
arrangement.action.rule.add.text=Add rule
|
||||
arrangement.action.rule.add.description=Add new arrangement rule
|
||||
arrangement.action.rule.remove.text=Remove rule(s)
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.intellij.psi.codeStyle.arrangement.match.StdArrangementEntryMatcher
|
||||
import com.intellij.psi.codeStyle.arrangement.match.StdArrangementMatchRule
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementNameMatchCondition
|
||||
import com.intellij.psi.codeStyle.arrangement.order.ArrangementEntryOrderType
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase
|
||||
import org.jetbrains.annotations.NotNull
|
||||
@@ -69,18 +68,6 @@ abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFixtureTes
|
||||
new ArrangementGroupingRule(type, order)
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static StdArrangementMatchRule rule(@NotNull String name) {
|
||||
new StdArrangementMatchRule(new StdArrangementEntryMatcher(new ArrangementNameMatchCondition(name)))
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static StdArrangementMatchRule rule(@NotNull String name, Object ... conditions) {
|
||||
def c = conditions.collect { atom(it) }
|
||||
c << new ArrangementNameMatchCondition(name)
|
||||
new StdArrangementMatchRule(new StdArrangementEntryMatcher(ArrangementUtil.combine(c as ArrangementMatchCondition[])))
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static StdArrangementMatchRule rule(@NotNull Object ... conditions) {
|
||||
def condition
|
||||
|
||||