protected void internalIncludeItem(T item, Runnable addToCollection) { backgroundWorker.checkUIAccess(); checkState(); checkPermission(); if (getCollection() == null) { initCollection(); } doNotModify = true; try { // Don't add the same object instance twice if (!containsObjectInstance(item)) addToCollection.run(); MetaProperty inverseProperty = metaProperty.getInverse(); if (inverseProperty != null) item.setValue(inverseProperty.getName(), masterDs.getItem()); // attach listener only after setting value to the link property attachListener(item); fireCollectionChanged(Operation.ADD, Collections.singletonList(item)); } finally { doNotModify = false; } }
if (!containsObjectInstance(item)) addToCollection.run();