swt - Drag item from treeviewer without the viewer getting focus -
swt - Drag item from treeviewer without the viewer getting focus -
question
is there way prevent treeviewer gaining focus when starting drag-and-drop operation? or know way prevent changing selection on drag?
situation
category 1 note 1.1 category 2 note 2.1i have treeviewer "categories" show categories , 1 tableviewer "notes" shows notes within selected category. "notes" view content provided selection of "categories" view through databinding.
problem
when have category 1 selected in "categories" view see note 1.1 in "notes" view. problem when want drag category 2 onto note 1.1 "categories" view selects category 2 , cannot drop category on note 1.1 anymore because "notes" view shows note 2.1
i don't think can stop categories view getting focus , firing selection alter when want start drag. natural behavior of controls. there might unconventional ways delay selection firing may not work perfectly.
however, solve problem suggest configuring drag-drop back upwards such when start dragging "category 2" (and consequently changing selection) first have hover on "category 1" (which should re-select "category 1") , allow drop "category 2" on "note 1.1".
this means add together drop back upwards categories viewer , in droptargetlistener#dragover(droptargetevent)
set selection category mouse hovering over. should start showing right note can drop dragged category on it.
drag-and-drop swt jface
Comments
Post a Comment