Bug 408921

Summary: User defined themes are always registered with "unknown" name
Product: [RT] RAP Reporter: Yury <swimmer_86>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P2 CC: rsternberg
Version: 2.1Keywords: api
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Yury CLA 2013-05-24 02:11:39 EDT
Extension org.eclipse.rap.ui.themes has the attribute 'name', but if you create and add your custom theme - it will be registered with "unknown" name (see org.eclipse.rap.rwt.internal.application.ApplicationImpl):

  public void addStyleSheet( String themeId, String styleSheetLocation, ResourceLoader resourceLoader ) {
    ParamCheck.notNull( themeId, "themeId" );
    ParamCheck.notNull( styleSheetLocation, "styleSheetLocation" );
    ParamCheck.notNull( resourceLoader, "resourceLoader" );

    StyleSheet styleSheet = readStyleSheet( styleSheetLocation, resourceLoader );
    ThemeManager themeManager = applicationContext.getThemeManager();
    Theme theme = themeManager.getTheme( themeId );
    if( theme != null ) {
      theme.addStyleSheet( styleSheet );
    } else {
      themeManager.registerTheme( new Theme( themeId, "unknown", styleSheet ) );
    }
  }

Think the name attribute defined by user must be passed here to create theme with it.
Comment 1 Ivan Furnadjiev CLA 2013-05-27 06:26:38 EDT
The "name" attribute in org.eclipse.rap.ui.themes extension is not use at all - see WorkbenchApplicationConfigurator#registerThemes.
Comment 2 Yury CLA 2013-05-27 06:37:40 EDT
I see, but what is the purpose to have an attribute name in theme extension defined in org.eclipse.rap.ui/schema/themes.exsd in this case? Why this attribute is not used now?
Comment 3 Ivan Furnadjiev CLA 2013-05-27 06:56:22 EDT
This attribute is leftover from the times before the Application/ApplicationConfiguration were introduced (RAP <1.5). We have to decide - keep it and change the signature of Application#addStyleSheet or remove it as not used anymore. But as method Theme#getName (name field) is not used in any code (only in test) I'm voting for removal together with Theme#name field.
Comment 4 Ivan Furnadjiev CLA 2014-11-24 05:40:36 EST
We should consider it for RAP 3.0.
Comment 5 Ralf Sternberg CLA 2014-12-09 07:21:50 EST
The name attribute is currently ignored. There doesn't seem to be a good reason to add it to the addStyleSheet() method now. Neither is there a need to remove it from the existing extension point (with the potential to break existing extensions). The extension point documentation states that the name attribute is currently not used. If we ever use the name in the future, we'll add a 'name' parameter to the API.