import org.simantics.interop.update.Activator;
import org.simantics.interop.update.model.ModelUpdate;
import org.simantics.interop.update.model.ModelUpdate.WarningListener;
+import org.simantics.interop.update.model.PropertyChange;
import org.simantics.interop.update.model.UpdateList;
import org.simantics.interop.update.model.UpdateNode;
import org.simantics.interop.update.model.UpdateOp;
import org.simantics.interop.update.model.UpdateTree;
import org.simantics.interop.utils.TableUtils;
import org.simantics.ui.SimanticsUI;
-import org.simantics.utils.datastructures.Callback;
import org.simantics.utils.datastructures.Pair;
import org.simantics.utils.ui.ExceptionUtils;
if (update.getUpdateList().getSelected().size() > 0) {
update.getUpdateList().clearSelected();
} else {
- for (Pair<Statement, Statement> nr : update.getUpdateList().getChanges())
- update.getUpdateList().addSelected(nr);
+ for (PropertyChange nr : update.getUpdateList().getChanges())
+ nr.select(true);
}
changeViewer.refresh();
}
}
- }, new Callback<DatabaseException>() {
- @Override
- public void run(DatabaseException parameter) {
- if (parameter != null)
- ExceptionUtils.logAndShowError("Cannot update model", parameter);
- }
+ }, e -> {
+ if (e != null)
+ ExceptionUtils.logAndShowError("Cannot update model", e);
});
}
public Image getImage(Object element) {
if (update == null || !update.isInit())
return null;
-// if (update.getUpdateList() == null)
-// return null;
- if (update.getUpdateList().isSelected((Pair<Statement, Statement>) element))
+ PropertyChange pc = (PropertyChange)element;
+ if (pc.selected())
return checked;
else
return unchecked;
private class SelectionEditingSupport extends EditingSupport {
- @SuppressWarnings("rawtypes")
public SelectionEditingSupport(ColumnViewer viewer) {
super(viewer);
-
}
@Override
protected Object getValue(Object element) {
if (update == null || !update.isInit())
return false;
- return update.getUpdateList().isSelected((Pair<Statement, Statement>) element);
+ PropertyChange pc = (PropertyChange)element;
+ return pc.selected();
}
- @SuppressWarnings("unchecked")
@Override
protected void setValue(Object element, Object value) {
if (update == null || !update.isInit())
return;
+ PropertyChange pc = (PropertyChange)element;
if (Boolean.TRUE.equals(value))
- update.getUpdateList().addSelected((Pair<Statement, Statement>) element);
+ pc.select(true);
else
- update.getUpdateList().removeSelected((Pair<Statement, Statement>) element);
+ pc.select(false);
getViewer().refresh(element);
}