Search in sources :

Example 1 with PropertiesContainer

use of com.intellij.designer.model.PropertiesContainer in project intellij-community by JetBrains.

the class PropertyTable method setValueAtRow.

private boolean setValueAtRow(int row, final Object newValue) {
    final Property property = myProperties.get(row);
    final Object[] oldValue = new Object[1];
    boolean isNewValue;
    try {
        oldValue[0] = getValue(property);
        isNewValue = !Comparing.equal(oldValue[0], newValue);
        if (newValue == null && oldValue[0] instanceof String && ((String) oldValue[0]).length() == 0) {
            isNewValue = false;
        }
    } catch (Throwable e) {
        isNewValue = true;
    }
    boolean isSetValue = true;
    final boolean[] needRefresh = new boolean[1];
    if (isNewValue) {
        isSetValue = doSetValue(() -> {
            for (PropertiesContainer component : myContainers) {
                property.setValue(component, newValue);
                needRefresh[0] |= property.needRefreshPropertyList(component, oldValue[0], newValue);
            }
        });
    }
    if (isSetValue) {
        if (property.needRefreshPropertyList() || needRefresh[0]) {
            update(myContainers, null, property.closeEditorDuringRefresh());
        } else {
            myModel.fireTableRowsUpdated(row, row);
        }
    }
    return isSetValue;
}
Also used : PropertiesContainer(com.intellij.designer.model.PropertiesContainer) Property(com.intellij.designer.model.Property)

Example 2 with PropertiesContainer

use of com.intellij.designer.model.PropertiesContainer in project intellij-community by JetBrains.

the class PropertyTable method restoreDefaultValue.

public void restoreDefaultValue() {
    final Property property = getSelectionProperty();
    if (property != null) {
        if (isEditing()) {
            cellEditor.stopCellEditing();
        }
        doRestoreDefault(() -> {
            for (PropertiesContainer component : myContainers) {
                if (!property.isDefaultRecursively(component)) {
                    property.setDefaultValue(component);
                }
            }
        });
        repaint();
    }
}
Also used : PropertiesContainer(com.intellij.designer.model.PropertiesContainer) Property(com.intellij.designer.model.Property)

Aggregations

PropertiesContainer (com.intellij.designer.model.PropertiesContainer)2 Property (com.intellij.designer.model.Property)2