2012-03-05 3 views
4

텍스트 편집기에서 트리 뷰가있는 편집기를 만들고 있습니다. 속성보기가 첨부되어 각 트리 항목을 선택하면 항목의 속성이 표시됩니다. 이를 위해 각 트리 항목은 IPropertySource를 구현하는 클래스입니다. 따라서 속성 값은 IPropertySource 클래스의 메서드 (예 : getPropertyDescriptors, getPropertyValue, setPropertyValue 등)를 재정 의하여 가져옵니다. 속성 값이 올바르게 표시됩니다. 그러나 속성보기의 값은 읽기 전용이어야합니다. 현재 이름은 편집 할 수 없습니다. 그러나 속성보기의 행 중 하나를 선택하면 해당 속성의 값을 편집 할 수 있습니다. 속성보기의 모든 속성 값을 읽기 전용 (편집 할 수 없음)으로 만들려면 어떻게합니까?Eclipse 에디터의 읽기 전용 속성보기

감사합니다.

+0

속성보기는 무엇입니까? 그것은 테이블인가? –

답변

4

Eclipse에서 표준 속성 시트 페이지를 사용하는 경우 IPropertySource.getPropertyDescriptors에 의해 반환 된 IPropertyDescriptor 구현에 따라보기에서 속성을 편집 할 수 있는지 여부 및 속성을 편집 할 수 있는지 여부에 따라 달라집니다. 그래서

Clients may implement this interface to provide specialized property 
descriptors; however, there are standard implementations declared in this 
package that take care of the most common cases: 

* PropertyDescriptor - read-only property 
* TextPropertyDescriptor - edits with a TextCellEditor 
* CheckboxPropertyDescriptor - edits with a CheckboxCellEditor 
* ComboBoxPropertyDescriptor - edits with a ComboBoxCellEditor 
* ColorPropertyDescriptor - edits with a ColorCellEditor 

사건의 PropertyDescriptor 트릭을 할해야 반환 : 당신이 IPropertyDescriptor의 JavaDoc을 살펴있는 경우

, 당신은 다음을 참조 할 수 있습니다.