1

I have an editor that has both draw2d tree and Nebula's GridTreeViewer (basically a JFace TreeViewer). What I need is working, except scrollbars. In draw2d I get scrollbars provided by org.eclipse.draw2d.ScrollPane and in GridTreeViewer I get scrollbars from JFace. I am not sure why, but scrollbars look different, I would expect them to look the same since they are calling OS's native controls if I am not mistaken? Is there a reason why scrollbars look different and is there a way "downgrade" JFace's scrollbars to look like draw2d's? Perhaps there is mistake in setting up ScrollPane's scrollbars?

Here is the screenshot, this is on Ubuntu 13.04:

enter image description here

flavio.donze
  • 7,432
  • 9
  • 58
  • 91
positron
  • 3,643
  • 3
  • 22
  • 26

1 Answers1

2

There is no mistake on your side. Leftmost tree has a custom-drawn scrollbar (I assume that's Draw2d tree) and rightmost tree shows native scrollbar (I guess those are the ones you call "JFace"). You can notice that most applications outside of Eclipse show scrollbars like the "JFace" ones. That is, if Ubuntu overlay scrollbars are enabled.

There is no easy fix for this. IMHO, you could try to get in Draw2d sources and try disabling their custom-drawn and replacing them with native ones (from SWT). Or you could use a custom tree instead on Nebula control...

Please note that "JFace" toolbars will look drastically different on Mac OS X or Windows, will have different size and such. And the users will expect them :)

Eugene
  • 9,242
  • 2
  • 30
  • 29
  • Thanks @Eugene Yeah, that's what I would expect. Why did draw2d developers decide to roll their own styling? Isn't the whole notion of SWT is to rely on host OS for controls? – positron May 21 '13 at 20:12
  • Draw2d is meant to be "lightweight". It is meant for creating diagrams where you work with figures pretty much as you would do with controls - and Draw2d manages Z order, clipping and such. They did not want to have every figure to be backed by an OS control - this would consume to many resources on bigger diagrams (AFAIK, Windows even has a limit on a max number or controls) thus they custom draw everything in their viewer. – Eugene May 21 '13 at 20:28
  • I get that, but I wish there was a way to override styling in favor of OS's control styling, that is if it's possible. – positron May 21 '13 at 20:56
  • It is not possible/feasable if you are targetting multiple OSes... E.g. Mac OS X has (had? - not sure if it's still there) some controls "pulsing" when they are selected - custom-drawn controls will immediately look fake. That is one of the problems with the likes of SWING and Qt. Note that you can try overlaying native control (e.g. add it on the same parent as your tree and position on top of the tree, carefully updating the bounds) - but that is generally a waste of time. – Eugene May 21 '13 at 21:30
  • One more question, is there a way to make simplify TreeViewer's scrollbars to match those provided by draw2d ScrollPane? – positron May 22 '13 at 15:45
  • Can't you use the Draw2D tree? – Eugene May 22 '13 at 16:29
  • I am using columns and I don't think Draw2d tree offers column support. – positron May 22 '13 at 17:24
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/30432/discussion-between-alex-kravets-and-eugene) – positron May 22 '13 at 17:30