[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform] Re: TreeViewerFocusCellManager support for SWT.MULTI
|
When doing this the ColumnViewerEditorActivationStragegy should also be set
to not activate when there are multiple selections to prevent non-editor
cells from being highlighted.
"Greg Babcock" <greg.babcock@xxxxxxxxxxxxxxxxx> wrote in message
news:gnk7rl$t91$1@xxxxxxxxxxxxxxxxxxxx
> Tom,
>
> There are essentially two scenerios that I need to support. Editing
> cells, and selecting elements for delete or drag, and drop. The current
> implementation works correctly for editing, but I need to be able to
> select multiple elements for deleting and drag and drop. As you mentioned
> in an earlier post, the selection part of SWT.MULTI is functional, but the
> FocusCellOwnerDrawnHighlighter is not highlighting the entire selection.
> So all did was add a filter in the Listener in
> FocusCellOwnerDrawnHighlighter.hookListener(final ColunnViewer) to only
> modify the highlighted cells when the selection size==1.
>
> In short all I had to do was chang the following line in
> FocusCellOwnerDrawnHighlighter.hookListener(final ColunnViewer) from
> if ((event.detail & SWT.SELECTED) > 0) {
> to
> if ((event.detail & SWT.SELECTED) > 0 &&
> ((StructuredSelection)viewer.getSelection()).size()==1) {
>
>
> While reviewing the change using snippet 48 I noticed that sometimes the
> row area to the right of the last column is highlighted, and sometimes it
> is not.
>
> Regards,
>
> GB
>
> "Tom Schindl" <tom.schindl@xxxxxxxxxxxxxxx> wrote in message
> news:gnk1ui$np$1@xxxxxxxxxxxxxxxxxxxx
>> Greg Babcock schrieb:
>>> Tom,
>>>
>>> Thanks for the timely response and the insight.
>>>
>>> One of the things I realized is that if the SWT.MULTI flag is set the
>>> highligted cell is probably (I have only done limited testing) belongs
>>> to
>>> the last element in the selection list. It may be wise to add an Assert
>>> !SWT.MULTI to the FocusCellOwnerDrawHighlighter.
>>>
>>> In any case I have been able to get the selection behavior I was looking
>>> for
>>> by only performing cell highlighing when there is a single selection.
>>> Instead of going though the effort to link in the source for the entire
>>> jface class to my I just copied the FocusCellOwnerDrawHighlighter class
>>> to
>>> my workspace and made the modification. To do so I had to replace
>>> viewer.getViewerRowFromItem(event.item); with focusCell.getViewerRow();
>>> because the first one was hidden. Under what circumstances would the
>>> two
>>> methods return different results?
>>
>>
>> When a ViewerCell is detached from the viewer we clone it because we
>> internally reuse the ViewerRow and Viewercell IIRC.
>>
>> I guess I didn't get what you describe do you have a fully running
>> example so that I can see the modified behaviour? Maybe it is feasable
>> and a common use case so that we could provide a switch between the 2?
>>
>> Tom
>>
>> --
>> B e s t S o l u t i o n . at
>> --------------------------------------------------------------------
>> Tom Schindl JFace-Committer
>> --------------------------------------------------------------------
>
>