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

Bug 321494

Summary: Assert label != null in ActivityStack.getUndoLabel
Product: z_Archived Reporter: Vladimír Hájek <hajek>
Component: BIRTAssignee: Dazheng Gao <gump_gao>
Status: VERIFIED FIXED QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, gump_gao
Version: unspecified   
Target Milestone: 2.6.2   
Hardware: PC   
OS: Windows Vista   
Whiteboard: Obsolete

Description Vladimír Hájek CLA 2010-08-02 07:29:08 EDT
Build Identifier: 20100617-1415

Commands implemented in org.eclipse.birt.report.designer.core.commands (e.g. DeleteCommand, SetPropertyCommand, ...) doesn't have set command label. In method ActivityStack.getUndoLabel is assert label != null.

Workaround:

public class MyCommandStack extends WrapperCommandStack {
   public MyCommandStack(org.eclipse.birt.report.model.api.CommandStack ar) {
      super(ar);
   }
   public void execute(Command command) {
      // Prevents command assertion in ActivityStack
      if (command != null && command.getLabel() == null)
         command.setLabel("");
      super.execute(command);
   }
}

In subclass of GraphicalEditor (e.g. ReportEditorWithRuler) implement method:

protected void configureGraphicalViewer() {
   ...
   ModuleHandle model = getModel();
   CommandStack modelCommandStack = model==null?null:model.getCommandStack();
   MyCommandStack myCommandStack = new MyCommandStack(modelCommandStack);
   getGraphicalViewer().getEditDomain().setCommandStack(myCommandStack);
   ...
}

Reproducible: Always

Steps to Reproduce:
1. Open new report design BIRT Report Designer.
2. Insert label into report and write some text into label.
3. End label editing with <Enter> or mouse click outside label.
4. Assert label != null in ActivityStack.getUndoLabel

If view Property Editor is shown, assertion happens every time.
Comment 1 Dazheng Gao CLA 2010-10-18 22:18:40 EDT
Fixed.
Comment 2 Xiaoying Gu CLA 2010-10-21 02:13:54 EDT
Verified in daily build 2.6.2.v20101021-0630