eclipse
eclipse editor
gonGon
2010. 8. 17. 09:18
eclipse화면은 editor와 여기에 연관된 view들로 구성된다.
editor는 IEditorPart를 구현해야 하는데 EditorPart가 기본 구현체이다. 실제 eclipse ide에서 editor를 만들 때는eclipse에서 제공하는 TextEditor나 MultiPageEditorPart를 상속받아 구현한다.
IEditorPart는 IAdaptable을 상속받기 때문에 eclipse의 adaptor 메커니즘을 사용할 수 있다. (getAdapter(class)를 구현해야 한다.)
editor를 초기화할 때 site와 input객체가 필요하다. 실제로는 workbenchpage가 openEditor(IEditorInput input, String editorId)에서 editor에 input을 넘겨준다.
IEditorPart의 메소드는 다음과 같다.
IEditorInput getEditorInput()
IEditorSite getEditorSite()
void init(IEditorSite site, IEditorInput input)
editor input은 IEditorInput을 구현한다. equals(Object) 메소드만 구현하여 원하는 파일 포맷을 사용할수도 있다.