in source/com.microsoft.tfs.client.common.ui.teambuild/src/com/microsoft/tfs/client/common/ui/teambuild/dialogs/QueueBuildDialog.java [170:378]
protected void hookAddToDialogArea(final Composite dialogArea) {
GridLayout layout = SWTUtil.gridLayout(dialogArea, 3);
layout.marginWidth = getHorizontalMargin();
layout.marginHeight = getVerticalMargin();
layout.horizontalSpacing = getHorizontalSpacing();
layout.verticalSpacing = getVerticalSpacing();
if (image != null) {
final Label imageLabel = new Label(dialogArea, SWT.NULL);
image.setBackground(imageLabel.getBackground());
imageLabel.setImage(image);
GridDataBuilder.newInstance().fill().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel);
}
final Label messageLabel = new Label(dialogArea, SWT.WRAP);
messageLabel.setText(Messages.getString("QueueBuildDialog.MessageLabelText")); //$NON-NLS-1$
GridDataBuilder.newInstance().fill().align(SWT.FILL, SWT.BEGINNING).hGrab().wHint(
IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH).hSpan(2).applyTo(messageLabel);
SWTUtil.createLabel(dialogArea, ""); //$NON-NLS-1$
SWTUtil.createLabel(dialogArea, ""); //$NON-NLS-1$
SWTUtil.createLabel(dialogArea, ""); //$NON-NLS-1$
final Label buildDefLabel =
SWTUtil.createLabel(dialogArea, Messages.getString("QueueBuildDialog.BuildDefinitionLabelText")); //$NON-NLS-1$
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(buildDefLabel);
buildDefinitionCombo = new Combo(dialogArea, SWT.READ_ONLY);
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(buildDefinitionCombo);
AutomationIDHelper.setWidgetID(buildDefinitionCombo, BUILDDEF_COMBO_ID);
buildDefinitionCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
final Combo combo = (Combo) e.widget;
final int ix = combo.getSelectionIndex();
newBuildDefinitionSelected(ix);
enableControls();
}
});
descriptionText = new Text(dialogArea, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP);
GridDataBuilder.newInstance().fill().grab().hSpan(3).applyTo(descriptionText);
ControlSize.setCharHeightHint(descriptionText, 2);
AutomationIDHelper.setWidgetID(descriptionText, DESCRIPTION_TEXT_ID);
final String buddyLabelText = Messages.getString("QueueBuildDialog.BuddyBuildLabelText"); //$NON-NLS-1$
final Label buddyBuildLabel = SWTUtil.createLabel(dialogArea, buddyLabelText);
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(buddyBuildLabel);
buddyBuildCombo = new Combo(dialogArea, SWT.READ_ONLY);
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(buddyBuildCombo);
AutomationIDHelper.setWidgetID(buddyBuildCombo, BUDDY_BUILD_COMBO_ID);
buddyBuildCombo.add(Messages.getString("QueueBuildDialog.LatestSourcesComboChoice")); //$NON-NLS-1$
buddyBuildCombo.add(Messages.getString("QueueBuildDialog.LatestSourcesWithShelveComboChoice")); //$NON-NLS-1$
buddyBuildCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
enableControls();
}
});
if (!buildServer.getBuildServerVersion().isV3OrGreater()
|| !BuildSourceProviders.isTfVersionControl(selectedBuildDefinition.getDefaultSourceProvider())) {
buddyBuildCombo.select(0);
buddyBuildCombo.setEnabled(false);
} else {
shelvesetComposite = new Composite(dialogArea, SWT.NONE);
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(shelvesetComposite);
layout = SWTUtil.gridLayout(shelvesetComposite, 3);
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.horizontalSpacing = getHorizontalSpacing();
layout.verticalSpacing = getVerticalSpacing();
final String shelvesetLabelText = Messages.getString("QueueBuildDialog.ShelvesetLabelText"); //$NON-NLS-1$
shelvesetLabel = SWTUtil.createLabel(shelvesetComposite, shelvesetLabelText);
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(shelvesetLabel);
AutomationIDHelper.setWidgetID(shelvesetLabel, SHELVESET_NAME_LABEL_ID);
shelvesetNameText = new Text(shelvesetComposite, SWT.BORDER);
GridDataBuilder.newInstance().hFill().hGrab().applyTo(shelvesetNameText);
AutomationIDHelper.setWidgetID(shelvesetNameText, SHELVESET_TEXT_ID);
findShelvesetButton = new Button(shelvesetComposite, SWT.PUSH);
findShelvesetButton.setText(Messages.getString("QueueBuildDialog.FindShelveButtonText")); //$NON-NLS-1$
GridDataBuilder.newInstance().applyTo(findShelvesetButton);
findShelvesetButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
findShelveset();
}
});
AutomationIDHelper.setWidgetID(findShelvesetButton, FIND_SHELVESET_BUTTON_ID);
createShelvesetButton = new Button(shelvesetComposite, SWT.PUSH);
createShelvesetButton.setText(Messages.getString("QueueBuildDialog.CreateShelveButtonText")); //$NON-NLS-1$
GridDataBuilder.newInstance().applyTo(createShelvesetButton);
createShelvesetButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
createShelveset();
}
});
AutomationIDHelper.setWidgetID(createShelvesetButton, CREATE_SHELVESET_BUTTON_ID);
checkinAfterSuccessButton = new Button(shelvesetComposite, SWT.CHECK);
checkinAfterSuccessButton.setText(Messages.getString("QueueBuildDialog.CheckinAfterSuccessButtonText")); //$NON-NLS-1$
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(checkinAfterSuccessButton);
checkinAfterSuccessButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
enableControls();
}
});
AutomationIDHelper.setWidgetID(checkinAfterSuccessButton, CHECKIN_AFTER_SUCCESS_BUTTON_ID);
}
final String controllerLabel = buildServer.getBuildServerVersion().isLessThanV3()
? Messages.getString("QueueBuildDialog.BuildAgentLabelText") //$NON-NLS-1$
: Messages.getString("QueueBuildDialog.BuildControllerLabelText"); //$NON-NLS-1$
final Label buildAgentLabel = SWTUtil.createLabel(dialogArea, controllerLabel);
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(buildAgentLabel);
buildControllerCombo = new Combo(dialogArea, SWT.READ_ONLY);
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(buildControllerCombo);
AutomationIDHelper.setWidgetID(buildControllerCombo, CONTROLLER_COMBO_ID);
buildControllerCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
final int selection = buildControllerCombo.getSelectionIndex();
if (selection >= 0 && selection < buildControllers.length) {
selectedBuildController = buildControllers[selection];
} else {
selectedBuildController = null;
}
calculatePosition();
enableControls();
}
});
final Label dropFolderLabel =
SWTUtil.createLabel(dialogArea, Messages.getString("QueueBuildDialog.DropFolderLabelText")); //$NON-NLS-1$
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(dropFolderLabel);
dropText = new Text(dialogArea, SWT.BORDER);
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(dropText);
AutomationIDHelper.setWidgetID(dropText, DROP_LOCATION_TEXT_ID);
final Label queueLabel =
SWTUtil.createLabel(dialogArea, Messages.getString("QueueBuildDialog.PriorityLabelText")); //$NON-NLS-1$
GridDataBuilder.newInstance().fill().hGrab().hSpan(2).applyTo(queueLabel);
SWTUtil.createLabel(dialogArea, Messages.getString("QueueBuildDialog.PositionLabelText")); //$NON-NLS-1$
priority = new Combo(dialogArea, SWT.READ_ONLY);
GridDataBuilder.newInstance().fill().hGrab().hSpan(2).applyTo(priority);
AutomationIDHelper.setWidgetID(priority, PRIORITY_COMBO_ID);
priority.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
calculatePosition();
}
});
position = new Text(dialogArea, SWT.BORDER | SWT.READ_ONLY);
GridDataBuilder.newInstance().fill().applyTo(position);
ControlSize.setCharWidthHint(position, 20);
AutomationIDHelper.setWidgetID(position, QUEUE_POSITION_TEXT_ID);
final Label commandArgsLabel =
SWTUtil.createLabel(dialogArea, Messages.getString("QueueBuildDialog.CommandArgsLabelText")); //$NON-NLS-1$
GridDataBuilder.newInstance().fill().hGrab().hSpan(3).applyTo(commandArgsLabel);
commandLineArgs = new Text(dialogArea, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
AutomationIDHelper.setWidgetID(commandLineArgs, COMMAND_ARGS_TEXT_ID);
commandLineArgs.addTraverseListener(new TraverseListener() {
@Override
public void keyTraversed(final TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
e.doit = true;
}
}
});
GridDataBuilder.newInstance().fill().grab().hSpan(3).applyTo(commandLineArgs);
ControlSize.setCharHeightHint(commandLineArgs, 2);
if (buildServer.getBuildServerVersion().isV1()) {
buildControllerCombo.setEnabled(false);
dropText.setEnabled(false);
priority.setEnabled(false);
position.setEnabled(false);
commandLineArgs.setEnabled(false);
}
// populate drop downs.
loadBuildControllers();
loadQueuePriorities();
final int selectedIndex = loadBuildDefinitions();
// Populate with default values.
newBuildDefinitionSelected(selectedIndex);
enableControls();
}