* @return the control.
*/
private Control createDefaultItems(Composite composite) {
PropertyResource propertyResource = PropertyResource.getInstance(project, true);
String reviewIdString = PropertyConstraints.DEFAULT_REVIEW_ID;
ReviewResource reviewResource = propertyResource.getReviewResource(reviewIdString, true);
ReviewId reviewId = null;
if (reviewResource != null) {
reviewId = reviewResource.getReviewId();
}
IWizardPage page = getWizard().getPage(ReviewIdNewWizard.PAGE_ITEM_ENTRIES);
ReviewIdNewItemEntriesPage itemEntryPage = (ReviewIdNewItemEntriesPage) page;
final Map<String, FieldItem> fieldItemIdFieldItemMap = itemEntryPage
.getFieldItemIdFieldItemMap();
// create type label and its combo.
Label typeLabel = new Label(composite, SWT.NONE);
typeLabel.setText(ReviewI18n.getString("ReviewIdEditDialog.label.type"));
this.typeCombo = new Combo(composite, SWT.READ_ONLY);
typeCombo.setData(typeCombo);
TypeKeyManager manager = TypeKeyManager.getInstance(project, reviewId);
String[] elements = (reviewId != null) ? manager.getElements() : new String[] { "" };
typeCombo.setItems(elements);
String typeName = PropertyConstraints.ATTRIBUTE_VALUE_TYPE;
String typeKey = (reviewResource != null) ? reviewResource.getDefaultField(typeName) : "";
typeCombo.setText(ReviewI18n.getString(typeKey));
typeCombo.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
String nameId = PropertyConstraints.ATTRIBUTE_VALUE_TYPE;
FieldItem fieldItem = (FieldItem) fieldItemIdFieldItemMap.get(nameId);
fieldItem.setDefaultKey(ReviewI18n.getKey(typeCombo.getText()));
}
});
FormData typeLabelData = new FormData();
typeLabelData.width = (int) (clientWidth * RATIO);
typeLabelData.top = new FormAttachment(typeCombo, 0, SWT.CENTER);
typeLabel.setLayoutData(typeLabelData);
FormData typeComboData = new FormData();
typeComboData.left = new FormAttachment(typeLabel, 0);
typeComboData.right = new FormAttachment(100, 0);
typeCombo.setLayoutData(typeComboData);
// create severity label and its combo.
Label severityLabel = new Label(composite, SWT.NONE);
severityLabel.setText(ReviewI18n.getString("ReviewIdEditDialog.label.severity"));
this.severityCombo = new Combo(composite, SWT.READ_ONLY);
severityCombo.setData(severityCombo);
severityCombo.setItems(SeverityKeyManager.getInstance(project, reviewId).getElements());
String severityName = PropertyConstraints.ATTRIBUTE_VALUE_SEVERITY;
String severityKey = (reviewResource != null) ? reviewResource
.getDefaultField(severityName) : "";
severityCombo.setText(ReviewI18n.getString(severityKey));
severityCombo.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
String nameId = PropertyConstraints.ATTRIBUTE_VALUE_SEVERITY;
FieldItem fieldItem = (FieldItem) fieldItemIdFieldItemMap.get(nameId);
fieldItem.setDefaultKey(ReviewI18n.getKey(severityCombo.getText()));
}
});
FormData severityLabelData = new FormData();
severityLabelData.width = (int) (clientWidth * RATIO);
severityLabelData.top = new FormAttachment(severityCombo, 0, SWT.CENTER);
severityLabel.setLayoutData(severityLabelData);
FormData severityComboData = new FormData();
severityComboData.top = new FormAttachment(typeCombo, 5);
severityComboData.left = new FormAttachment(severityLabel, 0);
severityComboData.right = new FormAttachment(100, 0);
severityCombo.setLayoutData(severityComboData);
// create resolution label and its combo.
Label resolutionLabel = new Label(composite, SWT.NONE);
resolutionLabel.setText(ReviewI18n.getString("ReviewIdEditDialog.label.resolution"));
this.resolutionCombo = new Combo(composite, SWT.READ_ONLY);
resolutionCombo.setData(resolutionCombo);
resolutionCombo
.setItems(ResolutionKeyManager.getInstance(project, reviewId).getElements());
String resolutionName = PropertyConstraints.ATTRIBUTE_VALUE_RESOLUTION;
String resolutionKey = (reviewResource != null) ? reviewResource
.getDefaultField(resolutionName) : "";
resolutionCombo.setText(ReviewI18n.getString(resolutionKey));
resolutionCombo.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
String nameId = PropertyConstraints.ATTRIBUTE_VALUE_RESOLUTION;
FieldItem fieldItem = (FieldItem) fieldItemIdFieldItemMap.get(nameId);
fieldItem.setDefaultKey(ReviewI18n.getKey(resolutionCombo.getText()));
}
});
FormData resolutionLabelData = new FormData();
resolutionLabelData.width = (int) (clientWidth * RATIO);
resolutionLabelData.top = new FormAttachment(resolutionCombo, 0, SWT.CENTER);
resolutionLabel.setLayoutData(resolutionLabelData);
FormData resolutionComboData = new FormData();
resolutionComboData.top = new FormAttachment(severityCombo, 5);
resolutionComboData.left = new FormAttachment(resolutionLabel, 0);
resolutionComboData.right = new FormAttachment(100, 0);
resolutionCombo.setLayoutData(resolutionComboData);
// create status label and its combo.
Label statusLabel = new Label(composite, SWT.NONE);
statusLabel.setText(ReviewI18n.getString("ReviewIdEditDialog.label.status"));
this.statusCombo = new Combo(composite, SWT.READ_ONLY);
statusCombo.setData(statusCombo);
statusCombo.setItems(StatusKeyManager.getInstance(project, reviewId).getElements());
String statusName = PropertyConstraints.ATTRIBUTE_VALUE_STATUS;
String statusKey = (reviewResource != null) ? reviewResource.getDefaultField(statusName)
: "";
statusCombo.setText(ReviewI18n.getString(statusKey));
statusCombo.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
String nameId = PropertyConstraints.ATTRIBUTE_VALUE_STATUS;