if(e.isConsumed())\r
return;\r
currentPosition = e.getPoint();\r
- dragEvent.currentModifiers = \r
- Modifiers.modifierString(e.getButton(), e.isControlDown(), e.isAltDown(), e.isShiftDown());\r
- dragEvent.current = editor.screenToDiagram(e.getPoint());\r
+ if(dragEvent != null) { // TODO why this is needed?\r
+ dragEvent.currentModifiers = \r
+ Modifiers.modifierString(e.getButton(), e.isControlDown(), e.isAltDown(), e.isShiftDown());\r
+ dragEvent.current = editor.screenToDiagram(e.getPoint());\r
+ }\r
editor.handleEvent(dragEvent);\r
\r
- if(dragEvent.phase == DragEventPhase.dragBegin) {\r
+ if(dragEvent != null && dragEvent.phase == DragEventPhase.dragBegin) {\r
dragEvent.phase = DragEventPhase.dragUpdate;\r
editor.handleEvent(dragEvent);\r
}\r
for(IElement element : event.pickedElements) {\r
Connectable connectable = element.getInterface(Connectable.class);\r
if(connectable != null && isAllowedTail(connectable)) {\r
- System.out.println("allowed");\r
this.from = connectable;\r
return true;\r
}\r
}\r
- System.out.println("not allowed");\r
return false;\r
}\r
\r
mapping.addMappingListener(new IMappingListener() {\r
\r
@Override\r
- public void rangeModified() { \r
- session.asyncRequest(new WriteRequest() {\r
- \r
- @Override\r
- public void perform(WriteGraph graph)\r
- throws DatabaseException {\r
- try {\r
- mapping.updateDomain(graph);\r
- } catch(Exception e) {\r
- e.printStackTrace();\r
- }\r
- }\r
- \r
- });\r
+ public void rangeModified() {\r
+ SwingUtilities.invokeLater(new Runnable() {\r
+\r
+ @Override\r
+ public void run() {\r
+ try {\r
+ session.syncRequest(new WriteRequest() { \r
+ @Override\r
+ public void perform(WriteGraph graph)\r
+ throws DatabaseException {\r
+ mapping.updateDomain(graph);\r
+ } \r
+ });\r
+ } catch (DatabaseException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ } \r
+ }\r
+ \r
+ }); \r
}\r
\r
@Override\r
public void domainModified() {\r
- session.asyncRequest(new ReadRequest() {\r
- \r
+ SwingUtilities.invokeLater(new Runnable() {\r
+\r
@Override\r
- public void run(ReadGraph graph) throws DatabaseException {\r
+ public void run() {\r
try {\r
- mapping.updateRange(graph);\r
- } catch(Exception e) {\r
+ session.syncRequest(new ReadRequest() { \r
+ @Override\r
+ public void run(ReadGraph graph) throws DatabaseException {\r
+ mapping.updateRange(graph);\r
+ }\r
+ });\r
+ } catch (DatabaseException e) {\r
+ // TODO Auto-generated catch block\r
e.printStackTrace();\r
- }\r
+ } \r
}\r
- }); \r
+ \r
+ }); \r
}\r
\r
});\r