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

Bug 372728

Summary: [design] ConfigurationDialog fails to initialize on separator
Product: [RT] RAP Reporter: Thorsten Schlathölter <tschlat>
Component: WorkbenchAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: unspecified   
Target Milestone: 1.5 M7   
Hardware: All   
OS: All   
Whiteboard:

Description Thorsten Schlathölter CLA 2012-02-28 07:59:13 EST
Build Identifier: 20110916-0149

When using the org.eclipse.rap.design.example.business.factory the 
org.eclipse.rap.internal.design.example.stacks.ConfigurationDialog fails to initialize when a view toolbar contains a Separator or Group.

Reproducible: Always

Steps to Reproduce:
1. Create a new Project using the RAP Mail Demo Template
2. Add a menuContribution for the MessageView. Add a command a separator and another command. Add a DefaultCommandHandler that does nothing.

   <extension
         point="org.eclipse.ui.menus">
      <group
            id="TestRap2.group1"
            separatorsVisible="true">
      </group>
      <menuContribution
            allPopups="false"
            locationURI="toolbar:TestRap2.view">
         <command
               commandId="TestRap2.command1"
               icon="icons/sample.gif"
               label="Command1"
               style="push">
         </command>
         <separator
               name="TestRap2.separator1"
               visible="true">
         </separator>
         <command
               commandId="TestRap2.command2"
               style="push">
         </command>
      </menuContribution>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <command
            defaultHandler="testrap2.MyCommandHandler"
            id="TestRap2.command1"
            name="name1">
      </command>
      <command
            defaultHandler="testrap2.MyCommandHandler"
            id="TestRap2.command2"
            name="name2">
      </command>
   </extension>

3. Start the application and click the "Configure actions.." button in the upper right corner of the message view.
4. A ConfigurationDialog should pop up which it does not because the added Separator has no text label.

The problem is that the separator is added as a check button to the dialog. There is a check on the text of the separator but if the text is missing the tooltipText of the separator is used as a text for the button. There is no null check on the button text any more. Setting a null text on a button results in a NPE.

In my real case I have a bunch of actions in the toolbar and the toolbar is initially not shown (maybe because of the large number of actions?). As a result of not beeing able to configure the toolbar the user gets no tools at all.

To fix this, groups and separators should either be ignored or 

check.setText( text );

should be replaced by

check.setText( text==null?"":text );
Comment 1 Ivan Furnadjiev CLA 2012-04-03 05:03:24 EDT
Groups and separators are excluded from the configuration dialog (ViewToolBarManager#updateItemsData). Changes are in CVS HEAD.