private Color containsColor;
private Color deletedColor;
private Color addedColor;
-
- private HashSet<Pair<Statement, Statement>> selected = new HashSet<Pair<Statement,Statement>>();
+
private HashSet<UpdateNode> selectedStructure = new HashSet<UpdateNode>();
oldValue.setLabelProvider(getLabelProvider(4));
newValue.setLabelProvider(getLabelProvider(5));
- selection.setLabelProvider(new SelectionLabelProvider(selected));
+ selection.setLabelProvider(new SelectionLabelProvider());
selection.getColumn().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (updateList.getChanges().size() > 0) {
- if (selected.contains(updateList.getChanges().iterator().next())) {
+ if (updateList.getSelected().contains(updateList.getChanges().iterator().next())) {
for (Pair<Statement, Statement> nr : updateList.getChanges())
- selected.remove(nr);
+ updateList.removeSelected(nr);
} else {
for (Pair<Statement, Statement> nr : updateList.getChanges())
- selected.add(nr);
+ updateList.addSelected(nr);
}
changeViewer.refresh();
}
}
});
- selection.setEditingSupport(new SelectionEditingSupport(changeViewer, selected));
+ selection.setEditingSupport(new SelectionEditingSupport(changeViewer));
}
Composite buttonComposite = new Composite(this, SWT.NONE);
for (ICheckStateListener l : checkStateListeners) {
l.checkStateChanged(new CheckStateChangedEvent(changeBrowser, null, false));
}
+ changeViewer.refresh();
}
for (Pair<Statement, Statement> mod : updateList.getChanges()) {
applyLiteralChange(graph, mod);
}
- selected.clear();
updateList.clear();
updateTree.getUpdateOps().applyAll(graph);
public void perform(WriteGraph graph) throws DatabaseException {
Layer0Utils.addCommentMetadata(graph, "Apply selected model updates");
graph.markUndoPoint();
- for (Pair<Statement, Statement> mod : selected) {
+ for (Pair<Statement, Statement> mod : updateList.getSelected()) {
updateList.removeChange(mod);
applyLiteralChange(graph, mod);
}
- selected.clear();
updateTree.getUpdateOps().applySelected(graph);
private class SelectionLabelProvider extends ColumnLabelProvider {
- Collection<?> selected;
- public SelectionLabelProvider(Collection<?> selected) {
- this.selected = selected;
+ public SelectionLabelProvider() {
+
}
@Override
public String getText(Object element) {
@Override
public Image getImage(Object element) {
- if (selected.contains(element))
+ if (updateList == null)
+ return null;
+ if (updateList.getSelected().contains(element))
return checked;
else
return unchecked;
private class SelectionEditingSupport extends EditingSupport {
- @SuppressWarnings("rawtypes")
- Collection selected;
-
@SuppressWarnings("rawtypes")
- public SelectionEditingSupport(ColumnViewer viewer, Collection selected) {
+ public SelectionEditingSupport(ColumnViewer viewer) {
super(viewer);
- this.selected = selected;
}
@Override
protected Object getValue(Object element) {
- return selected.contains(element);
+ if (updateList == null)
+ return false;
+ return updateList.getSelected().contains(element);
}
@SuppressWarnings("unchecked")
@Override
protected void setValue(Object element, Object value) {
+ if (updateList == null)
+ return;
if (Boolean.TRUE.equals(value))
- selected.add(element);
+ updateList.addSelected((Pair<Statement, Statement>) element);
else
- selected.remove(element);
+ updateList.removeSelected((Pair<Statement, Statement>) element);
getViewer().refresh(element);
}