heading.setBusy(true);
heading.setBusy(false);
Field field = FormHeading.class.getDeclaredField("titleRegion"); //$NON-NLS-1$
field.setAccessible(true);
TitleRegion titleRegion = (TitleRegion) field.get(heading);
for (Control child : titleRegion.getChildren())
if (child instanceof BusyIndicator) {
busyLabel = (BusyIndicator) child;
break;
}
if (busyLabel == null)
throw new IllegalArgumentException();
final TextViewer titleViewer = new TextViewer(titleRegion, SWT.READ_ONLY);
titleViewer.setDocument(new Document(text));
titleLabel = titleViewer.getTextWidget();
titleLabel.setForeground(heading.getForeground());
titleLabel.setFont(heading.getFont());
titleLabel.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
titleLabel.setSelection(0);
Event selectionEvent= new Event();
selectionEvent.x = 0;
selectionEvent.y = 0;
titleLabel.notifyListeners(SWT.Selection, selectionEvent);
}
});
createContextMenu(titleLabel, sha1String);
Point size = titleLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Image emptyImage = new Image(heading.getDisplay(), size.x, size.y);
UIUtils.hookDisposal(titleLabel, emptyImage);
busyLabel.setImage(emptyImage);
busyLabel.addControlListener(new ControlAdapter() {
public void controlMoved(ControlEvent e) {
updateSizeAndLocations();
}
});
titleLabel.moveAbove(busyLabel);
titleRegion.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
updateSizeAndLocations();
}
});
updateSizeAndLocations();