Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 275455

Summary: [CTabItem] Styling the unfocused state
Product: [RT] RAP Reporter: Markus Wolf <markus>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Markus Wolf CLA 2009-05-08 09:14:09 EDT
It would be great to have an unfocused state to style for the CTabItem.
Currently there is only a CTabItem:selected but a CTabItem:selected:unfocused would be good to show the current focused tab to the user.
Comment 1 Ralf Sternberg CLA 2009-07-17 07:35:21 EDT
In RCP, the CTabFolder colors are set by the workbench theme. If you're looking for a way to style the CTabFolders of active and inactive parts, you should use the workbench theming, not the RWT theming. See the extension point org.eclipse.ui.themes and search the Eclipse help for "theme".

I don't think it makes sense to style a CTabFolder differently related to its focused state, since usually an active CTabFolder will not have the focus itself but any of its child controls. Please reopen and explain your use case if you disagree.
Comment 2 Markus Wolf CLA 2009-07-17 08:16:02 EDT
The simple use case we have is that we do not use the workbench but an RWT only application.
Currently we style this with internal API like its done in the workbench code:

// XXX: This is hack and uses internal api
// It is used to track the active perspective part
ActivateEvent.addListener(this.tabFolder, new ActivateAdapter() {
	@Override
	public void activated(final ActivateEvent event) {
		ViewPlaceholder.this.perspective.onActivatePlaceholder(ViewPlaceholder.this);
	}
});


This is quite hacky and we could like to replace this with an official way.
Is that enough use case? ;)
Comment 3 Ralf Sternberg CLA 2009-07-29 16:47:24 EDT
Part activation is a Workbench concept and has nothing to do with the keyboard focus of the CTabFolder - actually, the CTabFolder does not even take the keyboard focus but one of its children does. We can not reflect the active Workbench part in the RWT theming.
The unfocused state on Tree and Table is different as it really relates to the keyboard focus state of this widget.

You should be able to use Workbench theming for your purpose.
Comment 4 Ralf Sternberg CLA 2009-07-30 03:53:59 EDT
(In reply to comment #3)
> You should be able to use Workbench theming for your purpose.
Sorry, I forgot that you don't use the workbench. But in your case you could set a custom variant in an activate listener to your CTabFolder. You can use this variant to distinguish active from inactive parts in your CSS.

Regarding the use of internal API, have you tried to use CTabFolder#addListener with SWT.Activate?
Comment 5 Markus Wolf CLA 2009-07-30 06:38:28 EDT
Thank you. Useing addListener works well. :)
That removed the hack and I'm fine with this now.