public void initialiseClassView() throws Exception { loadProperties(); options = new OWLVizViewOptions(); // options specific to this view selectionModel = new OWLVizSelectionModel(); setupExportFormats(); closableTabs = new HashSet(); componentGroupMap = new HashMap<OWLVizGraphPanel, List<GraphComponent>>(); graphComponents = new HashSet<GraphComponent>(); createOWLVizTabUI(); DropTarget dt = new DropTarget(this, this); dt.setActive(true); }
public static void setDragDrop(final Text text) { Transfer[] types = new Transfer[] {TextTransfer.getInstance()}; int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK; final DragSource source = new DragSource(text, operations); source.setTransfer(types); source.addDragListener( new DragSourceListener() { Point selection; @Override public void dragStart(DragSourceEvent e) { selection = text.getSelection(); e.doit = selection.x != selection.y; } @Override public void dragSetData(DragSourceEvent e) { e.data = text.getText(selection.x, selection.y - 1); } @Override public void dragFinished(DragSourceEvent e) { if (e.detail == DND.DROP_MOVE) { text.setSelection(selection); text.insert(""); } selection = null; } }); DropTarget target = new DropTarget(text, operations); target.setTransfer(types); target.addDropListener( new DropTargetAdapter() { @Override public void drop(DropTargetEvent event) { if (event.data == null) { event.detail = DND.DROP_NONE; return; } text.append((String) event.data); } }); }