Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to get curved (blue) tabs when running under e4?
How to get curved (blue) tabs when running under e4? [message #1033936] Thu, 04 April 2013 20:50 Go to next message
Phil Beauvoir is currently offline Phil BeauvoirFriend
Messages: 62
Registered: October 2012
Member
I'm trying to run my e3 based RCP app under Eclipse 4.3 M6 (therefore it's using the compatibility layer). It runs, though the problem is that all View parts and Editor parts have square white tabs rather than the usual curved tabs that are blue when they have the focus.

Thus, this doesn't work either:

PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, false);

Am I missing a step needed for e4 compatibility?
Re: How to get curved (blue) tabs when running under e4? [message #1033947 is a reply to message #1033936] Thu, 04 April 2013 21:09 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Tab-Rendering is defined via CSS and not through the old preferences.

Tom

On 04.04.13 22:50, Phil Beauvoir wrote:
> I'm trying to run my e3 based RCP app under Eclipse 4.3 M6 (therefore
> it's using the compatibility layer). It runs, though the problem is that
> all View parts and Editor parts have square white tabs rather than the
> usual curved tabs that are blue when they have the focus.
>
> Thus, this doesn't work either:
>
> PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,
> false);
>
> Am I missing a step needed for e4 compatibility?
Re: How to get curved (blue) tabs when running under e4? [message #1033950 is a reply to message #1033947] Thu, 04 April 2013 21:13 Go to previous messageGo to next message
Phil Beauvoir is currently offline Phil BeauvoirFriend
Messages: 62
Registered: October 2012
Member
OK, so is there any information on how I would do the tab rendering via CSS? BTW - I though the compatibility layer might take care of this?
Re: How to get curved (blue) tabs when running under e4? [message #1033955 is a reply to message #1033950] Thu, 04 April 2013 21:22 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
No - in reality it was the 3.x presentation which took care of the
rendering and we made clear from the start that the presentation API
will NOT be supported in 4.x!

Tom

On 04.04.13 23:13, Phil Beauvoir wrote:
> OK, so is there any information on how I would do the tab rendering via
> CSS? BTW - I though the compatibility layer might take care of this?
Re: How to get curved (blue) tabs when running under e4? [message #1033956 is a reply to message #1033955] Thu, 04 April 2013 21:24 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
http://wiki.eclipse.org/E4/CSS/SWT_Mapping

Tom

On 04.04.13 23:22, Tom Schindl wrote:
> No - in reality it was the 3.x presentation which took care of the
> rendering and we made clear from the start that the presentation API
> will NOT be supported in 4.x!
>
> Tom
>
> On 04.04.13 23:13, Phil Beauvoir wrote:
>> OK, so is there any information on how I would do the tab rendering via
>> CSS? BTW - I though the compatibility layer might take care of this?
>
Re: How to get curved (blue) tabs when running under e4? [message #1033963 is a reply to message #1033956] Thu, 04 April 2013 21:33 Go to previous messageGo to next message
Phil Beauvoir is currently offline Phil BeauvoirFriend
Messages: 62
Registered: October 2012
Member
I have no idea what any of what that mapping information means or what to do with it. But thanks anyway.
Re: How to get curved (blue) tabs when running under e4? [message #1034006 is a reply to message #1033963] Thu, 04 April 2013 22:54 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
IIRC it is the simple attribute, if set to false you get curves.

Tom

On 04.04.13 23:33, Phil Beauvoir wrote:
> I have no idea what any of what that mapping information means or what
> to do with it. But thanks anyway.
Re: How to get curved (blue) tabs when running under e4? [message #1034243 is a reply to message #1034006] Fri, 05 April 2013 07:35 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 482
Registered: December 2010
Location: Germany
Senior Member
Hi Phil,

you need to set
.MPartStack {
  swt-simple: false;
}
in your CSS.

Hope that helps.

Christoph
Re: How to get curved (blue) tabs when running under e4? [message #1034273 is a reply to message #1034243] Fri, 05 April 2013 08:26 Go to previous messageGo to next message
Phil Beauvoir is currently offline Phil BeauvoirFriend
Messages: 62
Registered: October 2012
Member
Thanks, but my app is a RCP app based on Eclipse 3 and so I have no CSS files or no code to read in CSS files. Is there a special location to create a CSS file and some command or extension to read it in?
Re: How to get curved (blue) tabs when running under e4? [message #1034649 is a reply to message #1033936] Fri, 05 April 2013 18:12 Go to previous messageGo to next message
Phil Beauvoir is currently offline Phil BeauvoirFriend
Messages: 62
Registered: October 2012
Member
In the spirit of Eclipse development I spent many hours of trial and error and head-scratching and somehow figured it out by reverse engineering Eclipse 4 itself (the clues are in the org.eclipse.platform plug-in).

Here's what I did:

1. Copy over the "css" folder from the org.eclipse.platform plug-in to a "css" folder in my main application plug-in.

2. Copy over the "images" folder from the org.eclipse.platform plug-in to a "css/images" folder in my main application plug-in.

3. Add this required bundle to the RCP app's MANIFEST.MF:
   org.eclipse.e4.ui.css.swt.theme


4. Add the following to my plugin.xml file in the "org.eclipse.core.runtime.products" extension point to set the default theme:
     <property
           name="cssTheme"
           value="org.eclipse.e4.ui.css.theme.e4_default">
     </property>
     <property
           name="applicationCSSResources"
           value="platform:/plugin/uk.ac.bolton.archimate.editor/css/images/">
     </property>


5. Add following to my plugin.xml file to add the themes:
	<extension
   		point="org.eclipse.e4.ui.css.swt.theme">
	  	<theme
			basestylesheeturi="css/e4_default.css"
			id="org.eclipse.e4.ui.css.theme.e4_default.noos"
			label="Default Theme">
			</theme>
		<theme
			basestylesheeturi="css/e4_classic_winxp.css"
			id="org.eclipse.e4.ui.css.theme.e4_classic"
			label="Classic">
		</theme>
		<theme
			basestylesheeturi="css/e4_default_gtk.css"
			id="org.eclipse.e4.ui.css.theme.e4_default"
			label="GTK"
			os="linux">
		</theme>
		<theme
			basestylesheeturi="css/e4_default_mac.css"
			id="org.eclipse.e4.ui.css.theme.e4_default"
			label="Mac"
			os="macosx">
		</theme>
		<theme
			basestylesheeturi="css/e4_default_win7.css"
			id="org.eclipse.e4.ui.css.theme.e4_default"
			label="Windows 7"
			os="win32"
			os_version="6.1">
		</theme>
		<theme
			basestylesheeturi="css/e4_default_winxp_blu.css"
			id="org.eclipse.e4.ui.css.theme.e4_default"
			label="Windows XP Blue"
			os="win32">
		</theme>
		<theme
			basestylesheeturi="css/e4_default_winxp_olv.css"
			id="org.eclipse.e4.ui.css.theme.e4_default.xpolive"
			label="Windows XP Olive"
			os="win32">
		</theme>
		<theme
			basestylesheeturi="css/e4_classic_win7.css"
			id="org.eclipse.e4.ui.css.theme.e4_classic"
			label="Windows 7 Classic"
			os="win32"
			os_version="6.1">
		</theme>
		<theme
			basestylesheeturi="css/e4_default_gtk.css"
			id="org.eclipse.e4.ui.css.theme.e4_default"
			label="Solaris"
			os="solaris">
		</theme>
		<theme
			basestylesheeturi="css/e4_default_gtk.css"
			id="org.eclipse.e4.ui.css.theme.e4_default"
			label="AIX"
			os="aix">
		</theme>
		<theme
			basestylesheeturi="css/e4_classic_winxp.css"
			id="org.eclipse.e4.ui.css.theme.e4_default"
			label="HPUX"
			os="hpux">
		</theme>
	</extension>


To change the theme programmatically I use this:

    private IThemeEngine getThemeEngine() {
    	Bundle bundle = FrameworkUtil.getBundle(ArchimateEditorPlugin.class);
        BundleContext context = bundle.getBundleContext();
        ServiceReference<IThemeManager> ref = context.getServiceReference(IThemeManager.class);
        IThemeManager themeManager = context.getService(ref);
        return themeManager.getEngineForDisplay(Display.getCurrent());
    }


To allow the user change the theme I call:
	List<ITheme> themes = getThemeEngine().getThemes();

Then add these to a Combo box in my Preferences dialog.

Then to set the theme:

    ITheme theme = (ITheme)((IStructuredSelection)fThemeComboViewer.getSelection()).getFirstElement();
    getThemeEngine().setTheme(theme, true);



Hope this helps some lost soul like myself.


Re: How to get curved (blue) tabs when running under e4? [message #1035222 is a reply to message #1034649] Sat, 06 April 2013 14:29 Go to previous messageGo to next message
Phil Beauvoir is currently offline Phil BeauvoirFriend
Messages: 62
Registered: October 2012
Member
Thinking further, if the "compatibility layer" in e4 were to truly offer 100% backward compatibility for e3 based RCP applications (and please remember, I'm not talking about plug-ins, I'm talking standalone RCP apps) then I would have thought a default e3 theme would be provided in e4? Or at the very least this could be documented so that developers would know what to do, rather than having to struggle the way I did.
Re: How to get curved (blue) tabs when running under e4? [message #1133082 is a reply to message #1035222] Fri, 11 October 2013 15:48 Go to previous messageGo to next message
n m is currently offline n mFriend
Messages: 7
Registered: February 2012
Junior Member
I followed your description on adding the themes and it seems to work fine when I launch from Eclipse but it doesn't work when I export the product. I checked the build.properties contains my css and images folder.

Can anyone help?
Re: How to get curved (blue) tabs when running under e4? [message #1137411 is a reply to message #1133082] Mon, 14 October 2013 13:22 Go to previous messageGo to next message
n m is currently offline n mFriend
Messages: 7
Registered: February 2012
Junior Member
I was able to fix it by adding the following to the basesheetstyleuri values
platform:/plugin/pluginname/css/e4_default.css


OR by making the plugin into a directory by adding the following to the MANIFEST.MF]
Eclipse-BundleShape: dir
Re: How to get curved (blue) tabs when running under e4? [message #1604888 is a reply to message #1034649] Sat, 07 February 2015 05:08 Go to previous messageGo to next message
Al B is currently offline Al BFriend
Messages: 47
Registered: June 2012
Member
When I try Phil's suggestion on, I get this error:

java.lang.IllegalArgumentException: A theme with the id 'org.eclipse.e4.ui.css.theme.e4_default' is already registered

PS: I'm using Kepler as the IDE for my RCP application.

[Updated on: Sat, 07 February 2015 05:09]

Report message to a moderator

Re: How to get curved (blue) tabs when running under e4? [message #1766869 is a reply to message #1033936] Wed, 28 June 2017 11:56 Go to previous messageGo to next message
Peter Pinnau is currently offline Peter PinnauFriend
Messages: 10
Registered: October 2015
Junior Member
I managed to enable one of the default themes in my Eclipse 3.X application in compatibility mode with the -cssTheme command line switch.

Here is an example:

-nl ${target.nl} -consoleLog -cssTheme org.eclipse.e4.ui.css.theme.e4_default

The bundle 'org.eclipse.ui.themes' and dependend bundles have to be added to the plugin.

Valid options for cssTheme are:

org.eclipse.e4.ui.css.theme.e4_classic
org.eclipse.e4.ui.css.theme.e4_default
org.eclipse.e4.ui.css.theme.e4_dark
Re: How to get curved (blue) tabs when running under e4? [message #1774159 is a reply to message #1766869] Wed, 11 October 2017 06:57 Go to previous message
Santhosh Kumar is currently offline Santhosh KumarFriend
Messages: 44
Registered: March 2011
Member
Thank you Phil Beauvoir, it worked perfectly.
Previous Topic:Hook that GUI has completely rendered
Next Topic:How to close the workbench from an other bundle
Goto Forum:
  


Current Time: Fri Apr 19 05:10:39 GMT 2024

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

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

Back to the top