Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » 3.x RCP CSS styling not applied to exported product
3.x RCP CSS styling not applied to exported product [message #1063667] Thu, 13 June 2013 16:43 Go to next message
Dan Simkins is currently offline Dan Simkins
Messages: 38
Registered: December 2012
Member
Hi,

I have created an RCP based on my 3.x plug-in.

I have applied CSS styling (based on http://www.slideshare.net/toedter_k/css-styling-for-eclipse-rcp-3x-and-4x) which works correctly when I launch my RCP application from with the Eclipse IDE.

When I export the RCP application and then run it, no CSS styling is applied; all other aspects of the application do however work correctly.

Details of the build and configuration as follows:

1) OS - Windows 7 64bit Professional

2) Eclipse - Juno Service Release 1 Build id: 20121004-1855

3) RCP plugin.xml->build.properties
output.. = bin/
bin.includes = plugin.xml,\
               META-INF/,\
               .,\
               bin/,\
               icons/,\
               studio.product,\
               plugin_customization.ini,\
               splash.bmp,\
               css/,\
               images/
source.. = src/


4) RCP Extension Point fragments:
   <extension
         id="product"
         point="org.eclipse.core.runtime.products">
         <product ... >
         ...
         <property
               name="cssTheme"
               value="com.workflowscience.designer.themeDef">
         </property>
         <property
               name="applicationCSSResources"
               value="platform:/plugin/z.studio/images">
         </property>
      </product>
   </extension>

   <extension
      point="org.eclipse.e4.ui.css.swt.theme">
      <theme
         basestylesheeturi="css/wfs_default_win7.css"
         id="com.workflowscience.designer.themeDef"
         label="Windows 7 Custom Theme"
         os="win32"
         os_version="6.1">
      </theme>
   </extension>



5) ApplicationWorkbenchAdvisor.java

	public void initialize( IWorkbenchConfigurer configurer )
	{
		super.initialize( configurer );
		
		...

		Bundle b = FrameworkUtil.getBundle( getClass() );
		BundleContext context = b.getBundleContext();
		ServiceReference serviceRef = context.getServiceReference( IThemeManager.class.getName());
		IThemeManager themeManager = (IThemeManager) context.getService( serviceRef );
		final IThemeEngine engine = themeManager.getEngineForDisplay( Display.getCurrent() );
		engine.setTheme( "com.workflowscience.designer.themeDef", true );
	}
	



I have checked the RCP application log file under workspace/.metadata post execution and there are no reported errors.

I included the following log statement in the ApplicationWorkbenchAdvisor class to query the theme directly after setting:
		StaticLogger.get().info( "Theme: " + engine.getActiveTheme().getId() );


which logs: "Theme: com.workflowscience.designer.themeDef6.1"

I included the following log statements in the ApplicationWorkbenchAdvisor class to ensure that the css urls could be resolved:
		Enumeration e = (Enumeration) b.findEntries( "", "*.css", true );
		URL url = null;
		URL cssUrl = null;
		if ( e != null )
		{
			while ( e.hasMoreElements() )
			{
				url = (URL) e.nextElement();
				try
				{
					cssUrl = FileLocator.resolve( url );
				}
				catch ( IOException e1 )
				{
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				StaticLogger.get().info( "CSS URL: " + url.toString() );
				StaticLogger.get().info( "CSS FILE: " + cssUrl != null ? cssUrl.toString() : "null" );
			}
		}


which shows that all css urls can be resolved to the RCP plugin.

I have found the following forum entries that highlight similar issues and provide suggested resolutions: http://dev.eclipse.org/mhonarc/lists/e4-dev/msg06652.html and http://www.eclipse.org/forums/index.php/m/1034649/?srch=3.x+rcp+theme+css#msg_1034649. I have checked my configuration which seems to be consistent with that suggested.

I am now at a complete loss as to how to further debug and would appreciate any insight as to the likely cause of the problem or any further avenues to explore.

Many thanks

Dan
Re: 3.x RCP CSS styling not applied to exported product [message #1063832 is a reply to message #1063667] Fri, 14 June 2013 12:21 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Hi Dan,

A quick scan plugin.xml/build.properties says it looks reasonable (I
can't guarantee it's error free thought :-)

The next thing to check is the list of bundles used to launch your RCP
app from within eclipse (on the launch config Plug-ins tab) and the list
of bundle in your exported RCP app

Later,
PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench.htm


Re: 3.x RCP CSS styling not applied to exported product [message #1063914 is a reply to message #1063832] Sat, 15 June 2013 09:46 Go to previous message
Dan Simkins is currently offline Dan Simkins
Messages: 38
Registered: December 2012
Member
Hi Paul,

Many thanks for responding.

What I discovered was that I had omitted the following property in the plugin.xml:
   <property
      name="applicationXMI"
      value="org.eclipse.platform/LegacyIDE.e4xmi">
   </property>


and the following dependency in the .product file:
org.eclipse.platform


With these two changes the exported RCP is correctly styled!

Cheers

Dan
Previous Topic:P2 update and language switch
Next Topic:Display Progress View on Eclipse 4 RCP project
Goto Forum:
  


Current Time: Thu Oct 30 23:53:14 GMT 2014

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

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