Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » StyledCellLabelProvider right aligned text
StyledCellLabelProvider right aligned text [message #727463] Wed, 21 September 2011 11:23 Go to next message
Thomas Singer is currently offline Thomas SingerFriend
Messages: 75
Registered: July 2009
Member
How to make a StyledCellLabelProvider draw right-aligned text? For normal ColumnLabelProviders it is sufficient to initialize the belonging TableViewerColumn's style with SWT.RIGHT. But if the viewerColumn a StyledCellLabelProvider is registered, it ignores this style.

Thanks in advance.
Re: StyledCellLabelProvider right aligned text [message #727488 is a reply to message #727463] Wed, 21 September 2011 12:39 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You need to file a bugzilla until then you need to copy the code from
JFace, add the right aligning and keep it in your project until JFace
has shipped the fix.

Please post the bugzilla id here.

Ideally you'd attach the changes as a patch to the bugzilla if you
managed to implement the desired feature. BTW if you are crossposting
please do it in one mail!

Tom

Am 21.09.11 13:23, schrieb Thomas Singer:
> How to make a StyledCellLabelProvider draw right-aligned text? For
> normal ColumnLabelProviders it is sufficient to initialize the belonging
> TableViewerColumn's style with SWT.RIGHT. But if the viewerColumn a
> StyledCellLabelProvider is registered, it ignores this style.
>
> Thanks in advance.
Re: StyledCellLabelProvider right aligned text [message #727499 is a reply to message #727488] Wed, 21 September 2011 13:16 Go to previous messageGo to next message
Thomas Singer is currently offline Thomas SingerFriend
Messages: 75
Registered: July 2009
Member
Tom Schindl wrote on Wed, 21 September 2011 08:39
You need to file a bugzilla until then you need to copy the code from
JFace, add the right aligning and keep it in your project until JFace
has shipped the fix.

Please post the bugzilla id here.

I'm still learning SWT/JFace (only have ~1/2 year experience of transforming our AWT/Swing application to SWT/JFace). Hence I've assumed that I've did something wrong. But after a search in Eclipse' Bugzilla I've found that others already have reported it as a bug, so I don't need to blame myself:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=291245

Tom Schindl wrote on Wed, 21 September 2011 08:39
BTW if you are crossposting please do it in one mail!

Usually, I don't crosspost. Here I first posted it to the SWT forum and then read that there's also one for JFace. Then posted in there because it was much more appropriate.

Tom
Re: StyledCellLabelProvider right aligned text [message #727891 is a reply to message #727499] Thu, 22 September 2011 07:08 Go to previous message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
Thomas Singer wrote on Wed, 21 September 2011 18:49
Quote:
This is a jface related question,but since the solution may b a simple one will resolve it here,but if the problem continues please post your further queries to Jface forum.

Done. Looks like a JFace bug. Sad

Quote:
Try setting SWT.RIGHT_TO_LEFT

Just for the records: it does not work.


ohh...
i noticed this SWT.RIGHT_TO_LEFT style check code of StyledCellLabelProvider
private TextLayout getSharedTextLayout(Display display) {
		if (cachedTextLayout == null) {
			int orientation = viewer.getControl().getStyle() & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
			//viewer.getColumnViewerOwner(getColumn().)
			cachedTextLayout = new TextLayout(display);
			cachedTextLayout.setOrientation(orientation);
		}
		return cachedTextLayout;
	}

thats why i thought that would be the solution,but then again it is also used by the table control to right align the columns.

possible fix can be updating TextLayout orientation in updateTextLayout method according to the column style.


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Previous Topic:(no subject)
Next Topic:OwnerDrawLabelProvider ignores setting event.height
Goto Forum:
  


Current Time: Fri Mar 29 13:20:54 GMT 2024

Powered by FUDForum. Page generated in 0.03173 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top