Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anna Kozlova
2012-08-07 20:19:38 +04:00
3 changed files with 28 additions and 23 deletions
@@ -89,12 +89,18 @@ public abstract class Property<T extends PropertiesContainer> {
public void setValue(@NotNull T container, @Nullable Object value) throws Exception {
}
public boolean isDefaultValue(@NotNull T container) throws Exception {
return false;
public final boolean isRecursiveDefault(@NotNull T container) throws Exception {
for (Property<T> child : getChildren(container)) {
boolean isDefault = child.isRecursiveDefault(container);
if (!isDefault) {
return false;
}
}
return isDefaultValue(container);
}
public boolean isDefaultValueWithDepth(@NotNull T container) throws Exception {
return isDefaultValue(container);
public boolean isDefaultValue(@NotNull T container) throws Exception {
return true;
}
public void setDefaultValue(@NotNull T container) throws Exception {
@@ -148,6 +154,10 @@ public abstract class Property<T extends PropertiesContainer> {
myDeprecated = deprecated;
}
public boolean showAsDefault(@NotNull T container) throws Exception {
return isRecursiveDefault(container);
}
@NotNull
public abstract PropertyRenderer getRenderer();
@@ -200,7 +200,7 @@ public abstract class PropertyTable extends JBTable {
@Override
public void run() throws Exception {
for (PropertiesContainer component : myContainers) {
if (!property.isDefaultValue(component)) {
if (!property.isRecursiveDefault(component)) {
property.setDefaultValue(component);
}
}
@@ -427,16 +427,16 @@ public abstract class PropertyTable extends JBTable {
}
}
private void fillProperties(PropertiesContainer<?> component, List<Property> properties) {
for (Property property : component.getProperties()) {
addProperty(component, property, properties);
private void fillProperties(PropertiesContainer<?> container, List<Property> properties) {
for (Property property : container.getProperties()) {
addProperty(container, property, properties);
}
}
private void addProperty(PropertiesContainer<?> component, Property property, List<Property> properties) {
private void addProperty(PropertiesContainer<?> container, Property property, List<Property> properties) {
if (property.isExpert() && !myShowExpertProperties) {
try {
if (property.isDefaultValueWithDepth(component)) {
if (property.isRecursiveDefault(container)) {
return;
}
}
@@ -449,7 +449,7 @@ public abstract class PropertyTable extends JBTable {
if (isExpanded(property)) {
for (Property child : getChildren(property)) {
addProperty(component, child, properties);
addProperty(container, child, properties);
}
}
}
@@ -557,7 +557,7 @@ public abstract class PropertyTable extends JBTable {
public boolean isDefault(Property property) throws Exception {
for (PropertiesContainer component : myContainers) {
if (!property.isDefaultValue(component)) {
if (!property.isRecursiveDefault(component)) {
return false;
}
}
@@ -1142,7 +1142,12 @@ public abstract class PropertyTable extends JBTable {
boolean isDefault = true;
try {
isDefault = isDefault(property);
for (PropertiesContainer container : myContainers) {
if (!property.showAsDefault(container)) {
isDefault = false;
break;
}
}
}
catch (Exception e) {
LOG.debug(e);
@@ -93,16 +93,6 @@ public class CompoundProperty extends Property<RadViewComponent> implements IPro
return value.toString();
}
@Override
public boolean isDefaultValue(@NotNull RadViewComponent component) throws Exception {
for (Property<RadViewComponent> childProperty : myChildren) {
if (!childProperty.isDefaultValue(component)) {
return false;
}
}
return true;
}
@Override
public void setDefaultValue(@NotNull RadViewComponent component) throws Exception {
for (Property<RadViewComponent> childProperty : myChildren) {