Project: Eclipse_Platform_UI
Bug 369866 New label for part -> StringIndexOutOfBoundsException in StackRenderer
Reported: 2012-01-26 16:05:08 | Status: resolved fixed

If I define a part without label and set it to dirty I get a StringIndexOutOfBoundsException in StackRenderer. Example: package com.exmaple.e4.playground3.parts; import javax.annotation.PostConstruct; import javax.inject.Inject; import org.eclipse.e4.ui.di.Persist; import org.eclipse.e4.ui.model.application.ui.MDirtyable; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; public class MySavePart { @Inject MDirtyable dirty; @PostConstruct public void createUi(Composite parent) { Button button = new Button(parent, SWT.PUSH); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { dirty.setDirty(true); } }); } @Persist public void save() { System.out.println("Saving data"); // Save the data // ... // Now set the dirty flag to false dirty.setDirty(false); } } Stack: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:694) at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.updateTab(StackRenderer.java:343) at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$2.handleEvent(StackRenderer.java:305)

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MPartTest.java