composite.setLayout(new GridLayout(4, false));
GridData gd = new GridData();
gd.horizontalSpan = 4;
composite.setLayoutData(gd);
AttributeEditorToolkit editorToolkit = getTaskEditorPage().getAttributeEditorToolkit();
TaskAttribute root = getTaskData().getRoot();
AbstractAttributeEditor attributeEditor;
TaskAttribute attribute;
AttributePartLayoutHelper layoutHelper = new AttributePartLayoutHelper(composite, toolkit, true);
attribute = root.getAttribute(RedmineAttribute.TIME_ENTRY_HOURS.getTaskKey());
if (attribute != null) {
//TODO WORKAROUND - remove later
if (!attribute.getMetaData().getType().equals(IRedmineConstants.EDITOR_TYPE_DURATION)) {
attribute.getMetaData().setType(IRedmineConstants.EDITOR_TYPE_DURATION);
}
attributeList.add(attribute.getId());
attributeEditor = createAttributeEditor(attribute);
attributeEditor.createLabelControl(composite, toolkit);
attributeEditor.createControl(composite, toolkit);
attributeEditor.setDecorationEnabled(false);
layoutHelper.setLayoutData(attributeEditor);
editorToolkit.adapt(attributeEditor);
attributeEditor.getControl();
}
attribute = root.getAttribute(RedmineAttribute.TIME_ENTRY_ACTIVITY.getTaskKey());
if (attribute != null) {
attributeList.add(attribute.getId());
attributeEditor = createAttributeEditor(attribute);
attributeEditor.createLabelControl(composite, toolkit);
attributeEditor.createControl(composite, toolkit);
attributeEditor.setDecorationEnabled(false);
layoutHelper.setLayoutData(attributeEditor);
editorToolkit.adapt(attributeEditor);
}
attribute = root.getAttribute(RedmineAttribute.TIME_ENTRY_COMMENTS.getTaskKey());
if (attribute != null) {
attributeList.add(attribute.getId());
attributeEditor = createAttributeEditor(attribute);
attributeEditor.createLabelControl(composite, toolkit);
attributeEditor.createControl(composite, toolkit);
attributeEditor.setDecorationEnabled(false);
layoutHelper.setLayoutData(attributeEditor);
editorToolkit.adapt(attributeEditor);
}
for (TaskAttribute childAttribute : root.getAttributes().values()) {
if(childAttribute.getId().startsWith(IRedmineConstants.TASK_KEY_PREFIX_TIMEENTRY_EX)) {
attributeList.add(childAttribute.getId());
attributeEditor = createAttributeEditor(childAttribute);
attributeEditor.createLabelControl(composite, toolkit);
attributeEditor.createControl(composite, toolkit);
attributeEditor.setDecorationEnabled(false);
layoutHelper.setLayoutData(attributeEditor);
editorToolkit.adapt(attributeEditor);
}
}
for (TaskAttribute childAttribute : root.getAttributes().values()) {
if(childAttribute.getId().startsWith(IRedmineConstants.TASK_KEY_PREFIX_TIMEENTRY_CF)) {
attributeList.add(childAttribute.getId());
attributeEditor = createAttributeEditor(childAttribute);
attributeEditor.createLabelControl(composite, toolkit);
attributeEditor.createControl(composite, toolkit);
attributeEditor.setDecorationEnabled(false);
layoutHelper.setLayoutData(attributeEditor);
editorToolkit.adapt(attributeEditor);
}
}
toolkit.paintBordersFor(composite);
section.setClient(composite);