I believe headlines use icons, not sure if you can use text. You can add an entry to the context menu (popup), in which the number of traces will be displayed, and when the element is clicked, start your viewing.
I based this on the Hello, World Command template that comes with Eclipse, and added input to the menu.
I expanded CompoundContributionItem to act as a menu tab as follows.
public class TraceWindowContributionItem extends CompoundContributionItem {
private static int demoTraceCount = 0;
@Override
protected IContributionItem[] getContributionItems() {
final String label = getTraceCount() + " traces";
final String id = "test.dynamicContribution";
final IServiceLocator serviceLocator = findServiceLocator();
final String commandId = "test.commands.sampleCommand";
final Map parameters = new HashMap();
final CommandContributionItem contribution = new CommandContributionItem(
serviceLocator, id, commandId, parameters, null, null, null,
label, null, null, SWT.NONE);
return new IContributionItem[] { contribution };
}
private int getTraceCount() {
return demoTraceCount++;
}
private IServiceLocator findServiceLocator() {
return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
}
}
, .
plugin.xml.
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<dynamic
class="test.TraceWindowContributionItem"
id="test.dynamicContribution">
</dynamic>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.commands">
<category
name="Sample Category"
id="test.commands.category">
</category>
<command
categoryId="test.commands.category"
defaultHandler="test.handlers.SampleHandler"
id="test.commands.sampleCommand"
name="Sample Command">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="test.commands.sampleCommand"
class="test.handlers.SampleHandler">
</handler>
</extension>