use of com.intellij.designer.model.Property in project intellij-community by JetBrains.
the class PropertyTable method collapse.
private void collapse(int rowIndex) {
int selectedRow = getSelectedRow();
Property property = myProperties.get(rowIndex);
int size = collapse(property, rowIndex + 1);
LOG.assertTrue(size > 0);
myModel.fireTableDataChanged();
if (selectedRow != -1) {
if (selectedRow > rowIndex) {
selectedRow -= size;
}
getSelectionModel().setSelectionInterval(selectedRow, selectedRow);
}
}
use of com.intellij.designer.model.Property 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();
}
}
use of com.intellij.designer.model.Property in project intellij-community by JetBrains.
the class PropertyTable method update.
private void update(@NotNull List<? extends PropertiesContainer> containers, @Nullable Property initialSelection, boolean finishEditing) {
if (finishEditing) {
finishEditing();
}
if (mySkipUpdate) {
return;
}
mySkipUpdate = true;
try {
if (finishEditing && isEditing()) {
cellEditor.stopCellEditing();
}
Property selection = initialSelection != null ? initialSelection : getSelectionProperty();
myContainers = new ArrayList<>(containers);
fillProperties();
myModel.fireTableDataChanged();
restoreSelection(selection);
} finally {
mySkipUpdate = false;
}
}
use of com.intellij.designer.model.Property in project intellij-community by JetBrains.
the class PropertyTable method findFullPathProperty.
private static int findFullPathProperty(List<Property> properties, Property property) {
Property parent = property.getParent();
if (parent == null) {
return findProperty(properties, property);
}
String name = getFullPathName(property);
int size = properties.size();
for (int i = 0; i < size; i++) {
if (name.equals(getFullPathName(properties.get(i)))) {
return i;
}
}
return -1;
}
use of com.intellij.designer.model.Property in project intellij-community by JetBrains.
the class PropertyTable method fillProperties.
private void fillProperties() {
myProperties = new ArrayList<>();
int size = myContainers.size();
if (size > 0) {
List<Property> rootProperties = new ArrayList<>();
for (Property each : (Iterable<? extends Property>) getProperties(myContainers.get(0))) {
addIfNeeded(getCurrentComponent(), each, rootProperties);
}
sortPropertiesAndCreateGroups(rootProperties);
for (Property property : rootProperties) {
myProperties.add(property);
addExpandedChildren(getCurrentComponent(), property, myProperties);
}
if (size > 1) {
for (Iterator<Property> I = myProperties.iterator(); I.hasNext(); ) {
if (!I.next().availableFor(myContainers)) {
I.remove();
}
}
for (int i = 1; i < size; i++) {
List<Property> otherProperties = new ArrayList<>();
fillProperties(myContainers.get(i), otherProperties);
for (Iterator<Property> I = myProperties.iterator(); I.hasNext(); ) {
Property addedProperty = I.next();
int index = findFullPathProperty(otherProperties, addedProperty);
if (index == -1) {
I.remove();
continue;
}
Property testProperty = otherProperties.get(index);
if (!addedProperty.getClass().equals(testProperty.getClass())) {
I.remove();
continue;
}
List<Property> addedChildren = getChildren(addedProperty);
List<Property> testChildren = getChildren(testProperty);
int addedChildrenSize = addedChildren.size();
if (addedChildrenSize != testChildren.size()) {
I.remove();
continue;
}
for (int j = 0; j < addedChildrenSize; j++) {
if (!addedChildren.get(j).getName().equals(testChildren.get(j).getName())) {
I.remove();
break;
}
}
}
}
}
}
}
Aggregations