import org.simantics.selectionview.IPropertyTab;
import org.simantics.selectionview.IPropertyTab2;
import org.simantics.utils.datastructures.MapList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AnnotatedPropertyTabContributorFactory implements PropertyTabContributorFactory {
- private static final boolean DEBUG = false;
+ private static final Logger LOGGER = LoggerFactory.getLogger(AnnotatedPropertyTabContributorFactory.class);
@SuppressWarnings("unchecked")
@Override
}
ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(
viewer) {
- Object lastSource = null;
- int clickCount = 0;
-
protected boolean isEditorActivationEvent(
ColumnViewerEditorActivationEvent event) {
- if (!event.getSource().equals(lastSource))
- clickCount = 0;
-
- lastSource = event.getSource();
-
- if (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION)
- clickCount += 1;
-
return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
+ || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION
|| event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
- || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION && clickCount >= 2
- || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
+ || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && (event.keyCode == SWT.CR || event.keyCode == SWT.F2))
|| event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
}
};
if (Thread.currentThread() == Display.getDefault().getThread()) {
if (viewer.getTable().isDisposed())
return;
- if (DEBUG)System.out.println("Viewer refresh " + id);
+ if (LOGGER.isTraceEnabled()) LOGGER.trace("Viewer refresh " + id);
for (IPropertyItem item : resolvedItems)
if (!item.equals(selectedItem))
viewer.refresh(item);
AnnotatedPropertyTab.this.node.removeListener(AnnotatedPropertyTab.this);
return;
}
- if (DEBUG) System.out.println("Viewer threaded refresh " + id);
+ if (LOGGER.isTraceEnabled()) LOGGER.trace("Viewer threaded refresh " + id);
for (IPropertyItem item : resolvedItems)
if (!item.equals(selectedItem))
viewer.refresh(item);
};
}
- if (DEBUG) System.err.println("CELL EDITOR: " + element);
+ if (LOGGER.isTraceEnabled()) LOGGER.trace("CELL EDITOR: " + element);
return propertyItemEditor;
}
else if (item instanceof ComboPropertyItem) {
comboEditors.put(comboPropertyItem, editor);
}
- if (DEBUG) System.err.println("CELL EDITOR: " + element);
+ if (LOGGER.isTraceEnabled()) LOGGER.trace("CELL EDITOR: " + element);
return editor;
}
else {
PropertyManipulator manipulator = tab.getManipulator(item);//createManipulator(item, obj);
if (manipulator.getValueCount() <= index)
throw new IllegalAccessError("Editing value in index " + index + " is not allowed.");
- if (DEBUG)System.err.println("CELL SET VALUE: " + element + " " + value);
+ if (LOGGER.isTraceEnabled()) LOGGER.trace("CELL SET VALUE: " + element + " " + value);
manipulator.setValue(value.toString(),index);
viewer.refresh(item);
nodeMap.commit("Set " + item.getId() + " value to " + value);
|| event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL) {
if (focusCellManager != null) {
try {
- if (DEBUG)System.err.println("FOCUS CELL: " + focusCell);
+ if (LOGGER.isTraceEnabled()) LOGGER.trace("FOCUS CELL: " + focusCell);
Method m = AbstractTableViewer.class.getDeclaredMethod(
"getSelectionFromWidget");
row.getCell(columnIndex), getViewer());
}
}
- if (DEBUG) System.err.println("NEXT CELL: " + cell2edit);
+ if (LOGGER.isTraceEnabled()) LOGGER.trace("NEXT CELL: " + cell2edit);
if (cell2edit != null) {
getViewer().getControl().setRedraw(false);
ColumnViewerEditorActivationEvent acEvent = new ColumnViewerEditorActivationEvent(