IDEA-92957

This commit is contained in:
Alexander Lobas
2012-11-12 14:59:30 +04:00
parent 181857e673
commit 8eedc006c2
3 changed files with 29 additions and 17 deletions
@@ -215,22 +215,24 @@ public class ResizeOperation implements EditOperation {
myTextFeedback.dimension("dp");
}
}
else {
if (staticText.length() > 2) {
int index = staticText.length() - 2;
String dimension = staticText.substring(index);
if (ArrayUtil.indexOf(ResourceRenderer.DIMENSIONS, dimension) != -1) {
myTextFeedback.append(staticText.substring(0, index));
myTextFeedback.dimension(dimension);
}
else {
myTextFeedback.append(staticText);
}
else if (staticText.length() > 3 && staticText.endsWith("dip")) {
myTextFeedback.append(staticText.substring(0, staticText.length() - 3));
myTextFeedback.dimension("dip");
}
else if (staticText.length() > 2) {
int index = staticText.length() - 2;
String dimension = staticText.substring(index);
if (ArrayUtil.indexOf(ResourceRenderer.DIMENSIONS, dimension) != -1) {
myTextFeedback.append(staticText.substring(0, index));
myTextFeedback.dimension(dimension);
}
else {
myTextFeedback.append(staticText);
}
}
else {
myTextFeedback.append(staticText);
}
}
private static boolean snapToWidth(Rectangle bounds, Dimension size, int delta) {
@@ -273,6 +273,7 @@ public class ResourceEditor extends PropertyEditor {
}
if (myIsDimension &&
!value.startsWith("@") &&
!value.endsWith("dip") &&
!value.equalsIgnoreCase("wrap_content") &&
!value.equalsIgnoreCase("fill_parent") &&
!value.equalsIgnoreCase("match_parent")) {
@@ -90,12 +90,21 @@ public class ResourceRenderer extends AbstractResourceRenderer {
myColoredComponent.append(value.substring(0, prefix), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
myColoredComponent.append(value.substring(prefix), textStyle(component, value, system, colorValue));
}
else if (myFormats.contains(AttributeFormat.Dimension) && value.length() > 2) {
int index = value.length() - 2;
String dimension = value.substring(index);
if (ArrayUtil.indexOf(DIMENSIONS, dimension) != -1) {
myColoredComponent.append(value.substring(0, index));
myColoredComponent.append(dimension, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
else if (myFormats.contains(AttributeFormat.Dimension)) {
if (value.length() > 3 && value.endsWith("dip")) {
myColoredComponent.append(value.substring(0, value.length() - 3));
myColoredComponent.append("dip", SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
else if (value.length() > 2) {
int index = value.length() - 2;
String dimension = value.substring(index);
if (ArrayUtil.indexOf(DIMENSIONS, dimension) != -1) {
myColoredComponent.append(value.substring(0, index));
myColoredComponent.append(dimension, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
}
else {
myColoredComponent.append(value);
}
}
else {
myColoredComponent.append(value);