prev 2016. 02 next
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29

포인트 랭킹 Top 9

  • 1위. 김동영b
  • 2위. 아름프로
  • 3위. netfer
  • 4위. 심플
  • 5위. 정의의소
  • 6위. 바이스
  • 7위. 달마다
  • 8위. 코디
  • 9위. 데로드

출처 :


This document describes how the work item component can be extended to display an attribute with a custom presentation. Our example implements an alternative presentation for a boolean attribute. Instead of a check box, our custom presentations will show a starred image. When true, the star is filled in and when false the star is outlined.


For more information about configuring presentations and defining custom attributes, please see Work Item Editor Presentations.

There is an additional example on how to develop a custom attribute presentation that handles calculated attributes and attribute dependencies in CalculatedAttributePresentation.

Contributing to the Work Item Editor

Contributing a new presentation to the work item editors consists of two steps for each editor:

  1. Implement the presentation
  2. Bind the abstract presentation ID to the concrete implementation class

The kind for a presentation can be determined in two ways: either a kind is declared in the Process Configuration directly (blue), or a kind can be retrieved from the Attribute type registry (orange) where the type of an attribute is bound to a default presentation. The Eclipse UI instantiates the bound java class and displays it in the editor.

We assume that our new presentation has an ID of This presentation ID can be chosen arbitrarily but should be prefixed with the implementing component's namespace. Any boolean attribute can then be associated with our new presentation ID and will be shown using the respective control both in the web and in the rich client. Let's start with the Eclipse UI implementation:

Editor Presentations

Editor presentations for the work item editor in the eclipse ui are registered to the extension point. An extension has to specify whether it is intended to work on an attribute or not and has then to subclass either PresentationPart or AttributePart.

The extension point allows to bind a presentation id to an attribute type. Presentations configured with an attribute but without a kind will use the presentation specified in this extension point. As our example is an additional presentation, we will not register it to be default for boolean.

The presentation shows the attribute name on the left side and a toggle button with the star icon on the right side. Let's have a look at some parts of the code:

Presentation Updater:
private IPresentationUpdater fPresentationUpdater= new AbstractPresentationUpdater() {
public void setVisible(boolean visible) {
List<Control> changedControls= new ArrayList<Control>();
if (fAttributeName != null && !fAttributeName.isDisposed()) {
TeamFormUtil.setVisible(fAttributeName.getLayoutControl(), visible);
if (fStar != null && !fStar.isDisposed()) {
TeamFormUtil.setVisible(fStar, visible);
Util.updateFormLayout(changedControls.toArray(new Control[changedControls.size()]));
public void setRequired(boolean required) {
if (fAttributeName != null && !fAttributeName.isDisposed()) {
public void attributeChanged(WorkItemChangeEvent event) {
This is the presentation updater that handles events from the presentation handler infrastructure. Such changes include visibility, attribute changes, required property annotation, dependency changes (not implemented in this example) and status reporting (not implemented in this example). The updater is registered and de-registered when the input of the work item editor changes or the editor is closed.

public void createContent(ITeamFormLayout formLayout) {
final WorkItemEditorToolkit toolkit= (WorkItemEditorToolkit) getSite().getToolkit();
Composite parent= formLayout.getContainer();
if (isLabelVisible()) {
fAttributeName= new RequiredPropertyLabel(parent, toolkit, getBackgroundStyle());
formLayout.add(fAttributeName.getLayoutControl(), ITeamFormConfiguration.LABEL_GUIDE);
fResourceManager= new LocalResourceManager(JFaceResources.getResources(), parent);
fStar= toolkit.createButton(parent, "", SWT.TOGGLE | SWT.FLAT, getBackgroundStyle()); //$NON-NLS-1$
TeamFormLayouts.setLayoutData(fStar, ITeamFormData.BUTTON);
formLayout.add(fStar, ITeamFormConfiguration.CONTENT_GUIDE);
if (isReadOnly()) {
} else {
fStar.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
public void widgetSelected(SelectionEvent e) {
if (fWorkingCopy != null) {
// Change the value on the work item
fWorkingCopy.getWorkItem().setValue(getAttribute(), fStar.getSelection());
This createContent method uses the TeamFormLayout infrastructure to align the label and the button on the respective guides. The work item editor has two guides in a section. For small sections LABEL_GUIDE and CONTENT_GUIDE, for wide sections LABEL_GUIDE and WIDE_CONTENT_GUIDE. The example also shows how to correctly respect the labelVisible and readOnly properties. When the button is clicked, the value is written to the work item.

Get Value
// Get the value from the resolved work item
private boolean getNonNullValue() {
Boolean value= null;
if (fWorkingCopy != null && getAttribute() != null && fWorkingCopy.getWorkItem().hasAttribute(getAttribute())) {
WorkItemUIWorkingCopy uiCopy= (WorkItemUIWorkingCopy) fWorkingCopy.getAdapter(IWorkItemUIWorkingCopy.class);
ResolvedWorkItem workItem= uiCopy.getResolvedWorkItem();
value= (Boolean)workItem.getValue(getAttribute());
if (value == null) {
value= Boolean.FALSE;
return value.booleanValue();
This method is used to get the value in a safe way from the work item. It demonstrates the use of the resolved work item which allows to get a resolved value directly (this is not a problem for boolean, but for example for an IContributor where the work item would return an IContributorHandle instead).

Update UI
// The value has changed, update the UI
private void handleValueChanged() {
if (!fStar.isDisposed()) {
boolean value= getNonNullValue();
if (fStar.getSelection() != value) {
if (value) {
fStar.setImage(JazzResources.getImageWithDefault(fResourceManager, ImagePool.STAR_ICON_ENABLED));
} else {
fStar.setImage(JazzResources.getImageWithDefault(fResourceManager, ImagePool.STAR_ICON_DISABLED));
Update the UI when the value has changed. This is the case when the user clicks the button, or a different (or the initial) input is set to the editor.

Set Input
public void setInput(Object input) {
if (input instanceof WorkItemEditorInput && ((WorkItemEditorInput) input).isResolved() && getAttribute() != null) {
WorkItemEditorInput workItemEditorInput= (WorkItemEditorInput) input;
fWorkingCopy= workItemEditorInput.getWorkingCopy();
if (fAttributeName != null && fStar != null && !fAttributeName.isDisposed()) {
fAttributeName.setText(NLS.bind(ATTRNAME_COLON, getAttribute().getDisplayName()));
if (fStar != null && !fStar.isDisposed()) {
} else if (input instanceof WorkItemEditorInputFuture) {
fWorkingCopy= null;
When the editor gets the input, remove the old presentation updater (if necessary), add the new updater, set the attribute name and update the star button.

Add Presentation Updater
private void addListeners() {
PresentationHandlerManager mgr= (PresentationHandlerManager) getSite().getAdapter(PresentationHandlerManager.class);
if (mgr != null) {
mgr.addPresentationUpdater(fPresentationUpdater, getDescriptor());
The presentation updater is registered to the handler infrastructure. Removing the updater is very similar.

Presentation Binding

The presentation created above is bound to a Kind ID in the plugin.xml. I needs an attribute and can handle attributes of type boolean.
<extension point="">
needsAttribute="true" >
<attributeType id="boolean" />



With the implementations and bindings in place, we are now ready to define a new custom attribute and to configure the work item editors to use the new presentation for it: We define a boolean attribute named 'Has Star' and add it to the Details section using the 'Star' presentation:


The attribute is then editable using our new control:

Attachement : Star implementation for the eclipse ui work item editor

분류 :
조회 수 :
등록일 :
21:17:05 (*.148.64.111)
엮인글 :
게시글 주소 :



위 함수들간의 관계는 아래 처럼 해석해 봅니다.


첨부 :
fx-relationships.png [File Size:14.7KB/Download9]



boolean 이외의 attributeType에 지정할 땐, process source를 보고, attribute type id를 설정해주면 된다고 합니다.



첨부 :
presentation-extensions.png [File Size:10.8KB/Download45]
process-config-source.png [File Size:10.9KB/Download13]
List of Articles
번호 제목 글쓴이 날짜 조회 수
373 CLM [CLM 설치] Manual DB2 테이블스페이스 관련 CLM 설정 파일 구성 김동영b 2011-11-09 18780
372 CLM [CLM 설치] 커맨드를 이용한 CLM 설치 김동영b 2011-11-09 6879
371 CLM 커맨드를 이용한 CLM 설치 도움말 풍차 2011-11-08 7314
370 RTC JTS 백업 및 복원 도움말 김동영b 2011-11-08 17293
369 CLM 째즈 저장소 권한 종류 및 세부 권한 도움말 김동영b 2011-11-04 5885
368 RTC 어드민 - Considerations for Rational Team Concert 3.x backups 풍차 2011-11-04 6161
367 RTC 어드민 - Jazz Administration Guide (3.x) 풍차 2011-11-04 7772
366 RTC RTC Java API - 특정 상태를 이용한 쿼리 샘플 김동영b 2011-11-02 10023
365 RTC RTC Java API - 상태그룹 쿼리를 이용한 샘플 [1] 김동영b 2011-11-02 8865
364 RTC [RTC SCM] SCM content access logging 김동영b 2011-11-02 7994
363 CLM [CLM 설치] Manual DB2 테이블스페이스 생성 김동영b 2011-11-01 25074
362 CLM CLM Distributed Setup 시나리오 풍차 2011-10-31 10320
361 CLM CLM 설치 및 구성 테스트 (WAS/LDAP/SSO) [2] file 김동영b 2011-10-28 21207
360 RTC RTC REST API - 작업항목 상태변경 샘플 풍차 2011-10-27 8103
359 RTC RTC OSLC-CM용 워크플로우 상태 및 조치 정보 풍차 2011-10-27 6408
358 RTC RTC REST API에 필요한 HTTP Client 라이브러리 및 도움말 풍차 2011-10-27 6648
357 RTC RTC REST API - 작업항목 ID 검색 및 수정 샘플 (using JSON) file 풍차 2011-10-27 8874
356 RTC RTC REST API - 작업항목 ID 검색 및 수정 샘플 (using XML) file 풍차 2011-10-26 7824
355 RTC RTC REST API용 헬퍼클래스 ChangeRequest 샘플 [142] 풍차 2011-10-26 8474
354 RTC RTC REST API - 작업항목 ID 검색 샘플 [140] 풍차 2011-10-26 8400