preview navigation quick-fix

This commit is contained in:
Gregory.Shrago
2015-02-12 19:25:13 +03:00
parent d880634e74
commit 68ef1e17df
2 changed files with 8 additions and 20 deletions
@@ -249,23 +249,11 @@ public abstract class ColorAndFontDescription extends TextAttributes implements
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
ColorAndFontDescription that = (ColorAndFontDescription)o;
if (!myGroup.equals(that.myGroup)) return false;
if (!myType.equals(that.myType)) return false;
return true;
return this == o;
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + myGroup.hashCode();
result = 31 * result + myType.hashCode();
return result;
return System.identityHashCode(this);
}
}
@@ -183,8 +183,8 @@ public class OptionsPanelImpl extends JPanel implements OptionsPanel {
}
@Override
public Runnable showOption(String attribute) {
final int index = getAttributeIndex(attribute);
public Runnable showOption(String attributeDisplayName) {
final int index = getAttributeIndex(attributeDisplayName, true);
return index < 0 ? null : new Runnable() {
@Override
public void run() {
@@ -194,11 +194,11 @@ public class OptionsPanelImpl extends JPanel implements OptionsPanel {
};
}
private int getAttributeIndex(final String option) {
private int getAttributeIndex(final String option, final boolean byDisplayNamePlease) {
return ContainerUtil.indexOf(myListModel.getItems(), new Condition<EditorSchemeAttributeDescriptor>() {
@Override
public boolean value(EditorSchemeAttributeDescriptor o) {
return StringUtil.naturalCompare(o.toString(), option) == 0;
return StringUtil.naturalCompare(byDisplayNamePlease ? o.toString() : o.getType(), option) == 0;
}
});
}
@@ -212,8 +212,8 @@ public class OptionsPanelImpl extends JPanel implements OptionsPanel {
}
@Override
public void selectOption(String attribute) {
int index = getAttributeIndex(attribute);
public void selectOption(String attributeType) {
int index = getAttributeIndex(attributeType, false);
if (index < 0) return;
ListScrollingUtil.selectItem(myOptionsList, index);
}