SlideShare a Scribd company logo
1 of 28
Eclipse GEF

 ECLIPSE GEF
               조현종(v.04, 12/12/12)
               http://cafe.naver.com/eclipseplugin
               http://hangumkj.blogspot.com/
               hangum@gmail.com
목 차
   Eclipse GEF란?
   Eclipse GEF 살펴보기
   각 Part 살펴보기
   Big Picture MVC
   Eclipse GEF 살펴보기
   Graphical Editor 만들기
   실행 환경
   개발순서
   HelloWorld GEF RCP
   EditParts
   Graphical View
   Editing and Edit Policies
   Editpart Lifecycle
   Tools and Palette
   Interactions
   실습
Eclipse GEF란?

 SWT, Draw2D에 의존합니다.
 Mouse, keyboard, workbench와 상호 작용 합니
  다.
 Model 기반으로 작동합니다.
 www.eclipse.org/gef
시각 기반 편집은?

 모델은 어떤 데이터를 가진 객체의 구성
 뷰는 화면상의 그림으로 구성
 사용자는 마우스나 키보드로 모델을 편집
  뷰를 통해 사용자의 명령이 내려 지거나
  모델이 변경 되었을 때 뷰와 모델 사이의 어떠한
  연결에 대응합니다.
일반적인 시각 기반 편집 문제

 모델은 화면에 어떻게 표시 될 것인지 모든 상
  태 데이터를 포함 해야 합니다.
  즉 뷰는 모델의 상태에 따라
  어떻게 표현될지 전체가 결정될
  수 있어야 합니다.

 GUI 를 통한 사용자의
  액션에 일어나는 모델을
  수정
 모델이 새로운 상태를
  가짐으로 뷰를 업데이트
GEF 도와주는 것

 에디터가 열렸을 때, 모델에 정의해 준 뷰들
 이 저절로 빌드되어 표시되는 매커니즘

 모델의 어떤 상태가 변경되었을 때 그와 연
 결된 뷰의 특성을 업데이트 하는 매커니즘

 사용자의 액션을 잡아내어 그것을 모델을
 수정하는 변경 객체로 변경하는 매커니즘
GEF 모델

 특성
  모델은 편집하고자 하는 모든 데이터를 가지고
   있어야 합니다.
  모델은 뷰나 에디터를 구성하는 어떤 다른 요소
   에 대해 아무것도 알아서 안됩니다. 참조도 안됩
   니다.
  모델은 변경이 일어나면 반드시 이벤트를 발신
   하고 수신할 수 있어야 합니다.

  java.beans.PropertyChangeListener
GEF 뷰

 특성
  뷰는 모델에 이미 저장된 데이터를 가지고 있어
   서는 안됩니다. 뷰는 단지 보여주는 용도로 사용
   되어야 합니다.
  뷰는 모델이나 에디터를 구성하는 다른 요소에
   대해 아무것도 몰라야 합니다.

  Draw2D 사용
GEF 컨트롤러

 특성
  모델과 뷰를 연결을 합니다.
    GEF에서 연결은 EditPart로 합니다.

   하나의 모델 + 뷰 마다 EditPart가 존재 합니다.
    EditPart는 모델과 뷰 를 다 알고 있으며 모델이 수
    정될 때 뷰를 반영해야 하는지 알고 있습니다.
Eclipse GEF 살펴보기




     Model : 표현하고자하는 Data.
       자신의 변경을 통지받을수 있어야합니다.
       java.beans.PropertyChangeListener
     View : 보여주는 것.
       IFigures, SWT의 Treeitem
     Controller : Model과 View를 컨트롤
       EditPart
각 Part설명
                      Graphical Viewer

            Outline                      Palette




Thumbnail
Graphical Editor 만들기

 확장점
  org.eclipse.ui.editors


  Extendsion 클래스
    GraphicalEditor : GEF 기본 에디터 클래스
    GraphicalEditorWithPalette : 팔랫트를 포함한 에
     디터 클래스
    GraphicalEditorWithFlyoutPalette : 이동 가능한 팔
     랫트를 포함한 에디터 클래스
실행환경

 Eclipse 4.2 SR1
 GEF SDK3.8.1
  (update manager
  http://download.eclipse.org/tools/gef/updates/releases/)

 Dependence - org.eclipse.gef
개발순서 1/4

 org.eclipse.ui.editor확장점 정의
 GraphicalEditorWithFlyoutPalette 클래스를
  상속받은 클래스 정의
 IEditInput 을 구현한 클래스 정의
개발순서 2/4

 1. 모델 정의
 Public class HelloworldModel() {
   String name;
  public HellowlrldModel(String name) {
   this.name = name;
 }
 getName()..
 setName(String name)…


 2. 모델을 어떻게 보여줄 컨트롤로 구현
 public class HelloworldEditPart extends AbstractGraphicalEditPart {
  protected IFigure createFigure () {
   HelloworldModel model = (HelloworldModel) getModel ();
   HelloworldFigure figure= new HelloworldFigure(model);
         return figure;
     }
 }
개발순서 3/4

 Figure
  public class HelloFigure extend Label {
    public HelloFigure(String name) {
      super(name);
 }
 }
개발순서 4/4
 3. 모델 + 뷰 연결 컨트롤러 구현

 public class HelloworldEditPartFactory implements
 EditPartFactory {
   public EditPart createEditPart (EditPart context, Object model)
 {
    EditPart part = null;
    if (model instanceof HelloworldModel) {
      part = new HelloworldEditPart ()
    }
          part.setModel (model) ; / / 모델 설정
          return part;
      }
  }
HelloWorld GEF RCP

1. Eclipse Plugin Project 생성
   (HelloWorld GEF RCP)
2. Dependencies에 org.eclipse.gef 추가
3. Extensions에 org.eclipse.ui.editor추가
   Id: com.sample.gef.helloworld.editor.gef
   Name : First GEF – Helloworld
   Class : com.sample.gef.helloworld.editor.HelloworldEditor
   위의 클래스 생성
Helloworld GEF RCP
4. HelloworldEditor 생성
public class HelloworldEditor extends GraphicalEditor {
 public static final String ID = "com.sample.gef.helloworld.editor.gef";

     public HelloworldEditor() {
     }

    …..
}
Helloworld GEF RCP
5. HelloworldInput
public class HelloworldInput implements IEditorInput {
  public String name = null;
  public HelloworldInput(String name) {
    this.name = name;
  }
  public boolean exists() {
    return (this.name != null);
  }
  public boolean equals(Object o) {
    if(!(o instanceof HelloworldInput)) return false;
    return ((HelloworldInput)o).getName().equals(getName());
  }
  public ImageDescriptor getImageDescriptor() {
    return ImageDescriptor.getMissingImageDescriptor();
  }
  public String getName() {
    return this.name;
  }
  public IPersistableElement getPersistable() {
    return null;
  }
  public String getToolTipText() {
    return this.name;
  }
  public Object getAdapter(Class adapter) {
    return null;
  }
}
Helloworld GEF RCP
6. Helloworld - 모델클래스작성
public class HelloModel {
 private String text = "Hello World";
    public String getText() {
      return text;
    }
    public void setText(String text) {
      this.text = text;
    }
}
Helloworld GEF RCP
7. 뷰 클래스작성
이번 예제 에서는
   뷰는
org.eclipse.draw2d.Label class를 사용합니다.
public class HelloworldFigure extends Label {
         public HelloworldFigure(String name) {
                  super(name);
         }
}
Helloworld GEF RCP
8. HelloworldEditPart - Controller클래스작성
public class HelloEditPart extends AbstractGraphicalEditPart {
 protected IFigure createFigure() {
  HelloModel model = (HelloModel) getModel();

        HelloworldFigure figure = new HelloworldFigure(model.getText());
        return figure;
    }

    protected void createEditPolicies() {
    }
}
Helloworld GEF RCP
9. MyEditPartFactory – Model과 EditPart 연결클래스작성
public class MyEditPartFactory implements EditPartFactory {

    public EditPart createEditPart(EditPart context, Object model) {
     EditPart part = null;

        if (model instanceof HelloModel)
          part = new HelloEditPart();

        part.setModel(model);
        return part;
    }

}
Helloworld GEF RCP
10. HelloworldEditor – EditorFactory 생성
public class HelloworldEditor extends GraphicalEditor {
…
 // 편집 도메인 설정
 public HelloworldEditor() {
   setEditDomain(new DefaultEditDomain(this));
 }

// EditorFactory 생성
protected void configureGraphicalViewer() {
 super.configureGraphicalViewer();

    GraphicalViewer viewer = getGraphicalViewer();
    viewer.setEditPartFactory(new HelloworldEditPartFactory());
}

// 최 상위모델 설정
protected void initializeGraphicalViewer() {
  GraphicalViewer viewer = getGraphicalViewer();
  viewer.setContents(new HelloModel());
}

…
}
모델 편집

 Control(EditPart)의 모델의 변경 듣기위해
모델 편집

 Role
참고자료
 http://wiki.eclipse.org/GEF_Description
 http://eclipse.or.kr – 특집기사 : GEF의 이해 1부
 Eclipse Help(http://help.eclipse.org/ganymede/index.jsp) – GEF편
 Eclipse coon 2005 GEF in dept ppt
 SWT/Jface 인 액션(이선아/제갈호준/에이콘)
 http://www13.plala.or.jp/observe/draw2d/draw2d_overview.html
 Eclipse Plug-in & RCP café의 번역문
      http://eclipse-articles.springnote.com/pages/3666185
      http://eclipse-articles.springnote.com/pages/3683263
 Eclipse Development using the Graphical Editing Framework and the
  Eclipse Modeling Framework(IBM)
 민물곰탱이님 블로그(http://esterel-dev.tistory.com/21)
 http://www.ibm.com/developerworks/kr/library/os-eclipse-gef11/

More Related Content

Viewers also liked

올챙이팜플렛 V1.0
올챙이팜플렛 V1.0올챙이팜플렛 V1.0
올챙이팜플렛 V1.0cho hyun jong
 
Penman - Our PR Process
Penman - Our PR ProcessPenman - Our PR Process
Penman - Our PR Processpdhill
 
Nc state presentationslideshare
Nc state presentationslideshareNc state presentationslideshare
Nc state presentationslideshareRichard Beach
 
Eclipse basic(조현종)
Eclipse basic(조현종)Eclipse basic(조현종)
Eclipse basic(조현종)cho hyun jong
 
EI Cloud Computing eBusiness Masterclass
EI Cloud Computing eBusiness MasterclassEI Cloud Computing eBusiness Masterclass
EI Cloud Computing eBusiness Masterclasstupped
 
C2 Information Technology Advisors
C2 Information Technology AdvisorsC2 Information Technology Advisors
C2 Information Technology Advisorscliffordclarke
 
Black hole kel 1 1
Black hole kel 1 1Black hole kel 1 1
Black hole kel 1 1Galih Praz
 
Den attraktiva gymnasieskolan
Den attraktiva gymnasieskolanDen attraktiva gymnasieskolan
Den attraktiva gymnasieskolanHanna Metsis
 
Leicester Stadium Kp
Leicester Stadium KpLeicester Stadium Kp
Leicester Stadium Kpdsnith
 
Nrc2009onlineroleplay
Nrc2009onlineroleplayNrc2009onlineroleplay
Nrc2009onlineroleplayRichard Beach
 
Smart solution
Smart solutionSmart solution
Smart solutionGalih Praz
 

Viewers also liked (20)

올챙이팜플렛 V1.0
올챙이팜플렛 V1.0올챙이팜플렛 V1.0
올챙이팜플렛 V1.0
 
Olli september26
Olli september26Olli september26
Olli september26
 
Howto Facebook
Howto FacebookHowto Facebook
Howto Facebook
 
Penman - Our PR Process
Penman - Our PR ProcessPenman - Our PR Process
Penman - Our PR Process
 
Down syndrome 2
Down syndrome 2Down syndrome 2
Down syndrome 2
 
Domestic violence
Domestic violenceDomestic violence
Domestic violence
 
Child abuse ppt
Child abuse pptChild abuse ppt
Child abuse ppt
 
Msu standards pp
Msu standards ppMsu standards pp
Msu standards pp
 
Nc state presentationslideshare
Nc state presentationslideshareNc state presentationslideshare
Nc state presentationslideshare
 
Eclipse basic(조현종)
Eclipse basic(조현종)Eclipse basic(조현종)
Eclipse basic(조현종)
 
EI Cloud Computing eBusiness Masterclass
EI Cloud Computing eBusiness MasterclassEI Cloud Computing eBusiness Masterclass
EI Cloud Computing eBusiness Masterclass
 
Eclipse RAP
Eclipse RAPEclipse RAP
Eclipse RAP
 
C2 Information Technology Advisors
C2 Information Technology AdvisorsC2 Information Technology Advisors
C2 Information Technology Advisors
 
Swt J Face 3/3
Swt J Face 3/3Swt J Face 3/3
Swt J Face 3/3
 
Black hole kel 1 1
Black hole kel 1 1Black hole kel 1 1
Black hole kel 1 1
 
Den attraktiva gymnasieskolan
Den attraktiva gymnasieskolanDen attraktiva gymnasieskolan
Den attraktiva gymnasieskolan
 
Leicester Stadium Kp
Leicester Stadium KpLeicester Stadium Kp
Leicester Stadium Kp
 
Nrc2009onlineroleplay
Nrc2009onlineroleplayNrc2009onlineroleplay
Nrc2009onlineroleplay
 
Smart solution
Smart solutionSmart solution
Smart solution
 
Swt J Face 1/3
Swt J Face 1/3Swt J Face 1/3
Swt J Face 1/3
 

Similar to GEF

Youtube를활용한app만들기
Youtube를활용한app만들기Youtube를활용한app만들기
Youtube를활용한app만들기DaeHee Jang
 
3D 모델러 ADDIN 개발과정 요약
3D 모델러 ADDIN 개발과정 요약3D 모델러 ADDIN 개발과정 요약
3D 모델러 ADDIN 개발과정 요약Tae wook kang
 
스프링프레임워크 & 마이바티스 무.료 강의자료 제공 (Spring IoC & DI)_ 구로자바학원/구로오라클학원/구로IT학원
스프링프레임워크 & 마이바티스 무.료 강의자료 제공 (Spring IoC & DI)_ 구로자바학원/구로오라클학원/구로IT학원스프링프레임워크 & 마이바티스 무.료 강의자료 제공 (Spring IoC & DI)_ 구로자바학원/구로오라클학원/구로IT학원
스프링프레임워크 & 마이바티스 무.료 강의자료 제공 (Spring IoC & DI)_ 구로자바학원/구로오라클학원/구로IT학원탑크리에듀(구로디지털단지역3번출구 2분거리)
 
React Hooks 마법. 그리고 깔끔한 사용기
React Hooks 마법. 그리고 깔끔한 사용기React Hooks 마법. 그리고 깔끔한 사용기
React Hooks 마법. 그리고 깔끔한 사용기NAVER SHOPPING
 
[114]angularvs react 김훈민손찬욱
[114]angularvs react 김훈민손찬욱[114]angularvs react 김훈민손찬욱
[114]angularvs react 김훈민손찬욱NAVER D2
 
Protocol Oriented Programming in Swift
Protocol Oriented Programming in SwiftProtocol Oriented Programming in Swift
Protocol Oriented Programming in SwiftSeongGyu Jo
 
React Native를 사용한
 초간단 커뮤니티 앱 제작
React Native를 사용한
 초간단 커뮤니티 앱 제작React Native를 사용한
 초간단 커뮤니티 앱 제작
React Native를 사용한
 초간단 커뮤니티 앱 제작Taegon Kim
 
[스프링 스터디 3일차] @MVC
[스프링 스터디 3일차] @MVC[스프링 스터디 3일차] @MVC
[스프링 스터디 3일차] @MVCAnselmKim
 
Android DI With Hilt
Android DI With HiltAndroid DI With Hilt
Android DI With HiltSSLEE14
 
Deep dive into Modern frameworks - HTML5 Forum 2018
Deep dive into Modern frameworks - HTML5 Forum 2018Deep dive into Modern frameworks - HTML5 Forum 2018
Deep dive into Modern frameworks - HTML5 Forum 2018Kenneth Ceyer
 
[D2 오픈세미나]3.web view hybridapp
[D2 오픈세미나]3.web view hybridapp[D2 오픈세미나]3.web view hybridapp
[D2 오픈세미나]3.web view hybridappNAVER D2
 
Meteor React Tutorial 따라하기
Meteor React Tutorial 따라하기Meteor React Tutorial 따라하기
Meteor React Tutorial 따라하기Jiam Seo
 
Domain Specific Languages With Groovy
Domain Specific Languages With GroovyDomain Specific Languages With Groovy
Domain Specific Languages With GroovyTommy C. Kang
 
React 실무활용 이야기
React 실무활용 이야기React 실무활용 이야기
React 실무활용 이야기철민 배
 

Similar to GEF (20)

Gef 정리
Gef 정리Gef 정리
Gef 정리
 
Eclipse RCP 1/2
Eclipse RCP 1/2Eclipse RCP 1/2
Eclipse RCP 1/2
 
Youtube를활용한app만들기
Youtube를활용한app만들기Youtube를활용한app만들기
Youtube를활용한app만들기
 
8장 editor
8장 editor8장 editor
8장 editor
 
3D 모델러 ADDIN 개발과정 요약
3D 모델러 ADDIN 개발과정 요약3D 모델러 ADDIN 개발과정 요약
3D 모델러 ADDIN 개발과정 요약
 
스프링프레임워크 & 마이바티스 무.료 강의자료 제공 (Spring IoC & DI)_ 구로자바학원/구로오라클학원/구로IT학원
스프링프레임워크 & 마이바티스 무.료 강의자료 제공 (Spring IoC & DI)_ 구로자바학원/구로오라클학원/구로IT학원스프링프레임워크 & 마이바티스 무.료 강의자료 제공 (Spring IoC & DI)_ 구로자바학원/구로오라클학원/구로IT학원
스프링프레임워크 & 마이바티스 무.료 강의자료 제공 (Spring IoC & DI)_ 구로자바학원/구로오라클학원/구로IT학원
 
react-ko.pdf
react-ko.pdfreact-ko.pdf
react-ko.pdf
 
Swt J Face 2/3
Swt J Face 2/3Swt J Face 2/3
Swt J Face 2/3
 
React Hooks 마법. 그리고 깔끔한 사용기
React Hooks 마법. 그리고 깔끔한 사용기React Hooks 마법. 그리고 깔끔한 사용기
React Hooks 마법. 그리고 깔끔한 사용기
 
[114]angularvs react 김훈민손찬욱
[114]angularvs react 김훈민손찬욱[114]angularvs react 김훈민손찬욱
[114]angularvs react 김훈민손찬욱
 
Protocol Oriented Programming in Swift
Protocol Oriented Programming in SwiftProtocol Oriented Programming in Swift
Protocol Oriented Programming in Swift
 
React Native를 사용한
 초간단 커뮤니티 앱 제작
React Native를 사용한
 초간단 커뮤니티 앱 제작React Native를 사용한
 초간단 커뮤니티 앱 제작
React Native를 사용한
 초간단 커뮤니티 앱 제작
 
[스프링 스터디 3일차] @MVC
[스프링 스터디 3일차] @MVC[스프링 스터디 3일차] @MVC
[스프링 스터디 3일차] @MVC
 
Android DI With Hilt
Android DI With HiltAndroid DI With Hilt
Android DI With Hilt
 
Deep dive into Modern frameworks - HTML5 Forum 2018
Deep dive into Modern frameworks - HTML5 Forum 2018Deep dive into Modern frameworks - HTML5 Forum 2018
Deep dive into Modern frameworks - HTML5 Forum 2018
 
[D2 오픈세미나]3.web view hybridapp
[D2 오픈세미나]3.web view hybridapp[D2 오픈세미나]3.web view hybridapp
[D2 오픈세미나]3.web view hybridapp
 
Meteor React Tutorial 따라하기
Meteor React Tutorial 따라하기Meteor React Tutorial 따라하기
Meteor React Tutorial 따라하기
 
Domain Specific Languages With Groovy
Domain Specific Languages With GroovyDomain Specific Languages With Groovy
Domain Specific Languages With Groovy
 
React 실무활용 이야기
React 실무활용 이야기React 실무활용 이야기
React 실무활용 이야기
 
Nest js 101
Nest js 101Nest js 101
Nest js 101
 

More from cho hyun jong

평범한 개발자 오픈소스로 먹고살기 2
평범한 개발자 오픈소스로 먹고살기 2평범한 개발자 오픈소스로 먹고살기 2
평범한 개발자 오픈소스로 먹고살기 2cho hyun jong
 
테드폴허브(올챙이) PostgreSQL 디비 확장하기
테드폴허브(올챙이) PostgreSQL 디비 확장하기테드폴허브(올챙이) PostgreSQL 디비 확장하기
테드폴허브(올챙이) PostgreSQL 디비 확장하기cho hyun jong
 
평범한 개발자 오픈소스로 먹고살기 2
평범한 개발자 오픈소스로 먹고살기 2평범한 개발자 오픈소스로 먹고살기 2
평범한 개발자 오픈소스로 먹고살기 2cho hyun jong
 
자바가 디비와 사귀기 까지 벌어지는 일들
자바가 디비와 사귀기 까지 벌어지는 일들자바가 디비와 사귀기 까지 벌어지는 일들
자바가 디비와 사귀기 까지 벌어지는 일들cho hyun jong
 
테드폴허브 오픈소스Vs엔터프라이즈
테드폴허브 오픈소스Vs엔터프라이즈테드폴허브 오픈소스Vs엔터프라이즈
테드폴허브 오픈소스Vs엔터프라이즈cho hyun jong
 
올챙이팜플렛
올챙이팜플렛올챙이팜플렛
올챙이팜플렛cho hyun jong
 
Tadpole db hub-monitoring
Tadpole db hub-monitoring Tadpole db hub-monitoring
Tadpole db hub-monitoring cho hyun jong
 
올챙이 확장으로 살펴보는 이클립스 확장
올챙이 확장으로 살펴보는 이클립스 확장올챙이 확장으로 살펴보는 이클립스 확장
올챙이 확장으로 살펴보는 이클립스 확장cho hyun jong
 
오픈소스 프로젝트 올챙이
오픈소스 프로젝트 올챙이오픈소스 프로젝트 올챙이
오픈소스 프로젝트 올챙이cho hyun jong
 
Tadpole DB Hub 1.0.0
Tadpole DB Hub 1.0.0Tadpole DB Hub 1.0.0
Tadpole DB Hub 1.0.0cho hyun jong
 
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAPcho hyun jong
 
올챙이 현재와 미래
올챙이 현재와 미래올챙이 현재와 미래
올챙이 현재와 미래cho hyun jong
 
올챙이로 살펴보는 Eclipse개발
올챙이로 살펴보는 Eclipse개발올챙이로 살펴보는 Eclipse개발
올챙이로 살펴보는 Eclipse개발cho hyun jong
 
올챙이로 살펴보는 개발툴과 Cloud
올챙이로 살펴보는 개발툴과 Cloud올챙이로 살펴보는 개발툴과 Cloud
올챙이로 살펴보는 개발툴과 Cloudcho hyun jong
 
Eclipse RAP - Single Source
Eclipse RAP - Single SourceEclipse RAP - Single Source
Eclipse RAP - Single Sourcecho hyun jong
 
Petra보고서 개발 open자료
Petra보고서 개발 open자료Petra보고서 개발 open자료
Petra보고서 개발 open자료cho hyun jong
 

More from cho hyun jong (20)

평범한 개발자 오픈소스로 먹고살기 2
평범한 개발자 오픈소스로 먹고살기 2평범한 개발자 오픈소스로 먹고살기 2
평범한 개발자 오픈소스로 먹고살기 2
 
테드폴허브(올챙이) PostgreSQL 디비 확장하기
테드폴허브(올챙이) PostgreSQL 디비 확장하기테드폴허브(올챙이) PostgreSQL 디비 확장하기
테드폴허브(올챙이) PostgreSQL 디비 확장하기
 
평범한 개발자 오픈소스로 먹고살기 2
평범한 개발자 오픈소스로 먹고살기 2평범한 개발자 오픈소스로 먹고살기 2
평범한 개발자 오픈소스로 먹고살기 2
 
자바가 디비와 사귀기 까지 벌어지는 일들
자바가 디비와 사귀기 까지 벌어지는 일들자바가 디비와 사귀기 까지 벌어지는 일들
자바가 디비와 사귀기 까지 벌어지는 일들
 
테드폴허브 오픈소스Vs엔터프라이즈
테드폴허브 오픈소스Vs엔터프라이즈테드폴허브 오픈소스Vs엔터프라이즈
테드폴허브 오픈소스Vs엔터프라이즈
 
올챙이팜플렛
올챙이팜플렛올챙이팜플렛
올챙이팜플렛
 
Tadpole db hub-monitoring
Tadpole db hub-monitoring Tadpole db hub-monitoring
Tadpole db hub-monitoring
 
올챙이 확장으로 살펴보는 이클립스 확장
올챙이 확장으로 살펴보는 이클립스 확장올챙이 확장으로 살펴보는 이클립스 확장
올챙이 확장으로 살펴보는 이클립스 확장
 
Swt bot
Swt botSwt bot
Swt bot
 
오픈소스 프로젝트 올챙이
오픈소스 프로젝트 올챙이오픈소스 프로젝트 올챙이
오픈소스 프로젝트 올챙이
 
Tadpole DB Hub 1.0.0
Tadpole DB Hub 1.0.0Tadpole DB Hub 1.0.0
Tadpole DB Hub 1.0.0
 
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
올챙이(Tadpole for DB Tools)로 살펴보는 Eclipse RAP
 
올챙이 현재와 미래
올챙이 현재와 미래올챙이 현재와 미래
올챙이 현재와 미래
 
올챙이로 살펴보는 Eclipse개발
올챙이로 살펴보는 Eclipse개발올챙이로 살펴보는 Eclipse개발
올챙이로 살펴보는 Eclipse개발
 
올챙이로 살펴보는 개발툴과 Cloud
올챙이로 살펴보는 개발툴과 Cloud올챙이로 살펴보는 개발툴과 Cloud
올챙이로 살펴보는 개발툴과 Cloud
 
Eclipse RAP design
Eclipse RAP designEclipse RAP design
Eclipse RAP design
 
WindowTester PRO
WindowTester PROWindowTester PRO
WindowTester PRO
 
Eclipse RAP - Single Source
Eclipse RAP - Single SourceEclipse RAP - Single Source
Eclipse RAP - Single Source
 
Petra보고서 개발 open자료
Petra보고서 개발 open자료Petra보고서 개발 open자료
Petra보고서 개발 open자료
 
Draw2D
Draw2DDraw2D
Draw2D
 

GEF

  • 1. Eclipse GEF ECLIPSE GEF 조현종(v.04, 12/12/12) http://cafe.naver.com/eclipseplugin http://hangumkj.blogspot.com/ hangum@gmail.com
  • 2. 목 차  Eclipse GEF란?  Eclipse GEF 살펴보기  각 Part 살펴보기  Big Picture MVC  Eclipse GEF 살펴보기  Graphical Editor 만들기  실행 환경  개발순서  HelloWorld GEF RCP  EditParts  Graphical View  Editing and Edit Policies  Editpart Lifecycle  Tools and Palette  Interactions  실습
  • 3. Eclipse GEF란?  SWT, Draw2D에 의존합니다.  Mouse, keyboard, workbench와 상호 작용 합니 다.  Model 기반으로 작동합니다.  www.eclipse.org/gef
  • 4. 시각 기반 편집은?  모델은 어떤 데이터를 가진 객체의 구성  뷰는 화면상의 그림으로 구성  사용자는 마우스나 키보드로 모델을 편집  뷰를 통해 사용자의 명령이 내려 지거나 모델이 변경 되었을 때 뷰와 모델 사이의 어떠한 연결에 대응합니다.
  • 5. 일반적인 시각 기반 편집 문제  모델은 화면에 어떻게 표시 될 것인지 모든 상 태 데이터를 포함 해야 합니다.  즉 뷰는 모델의 상태에 따라 어떻게 표현될지 전체가 결정될 수 있어야 합니다.  GUI 를 통한 사용자의 액션에 일어나는 모델을 수정  모델이 새로운 상태를 가짐으로 뷰를 업데이트
  • 6. GEF 도와주는 것  에디터가 열렸을 때, 모델에 정의해 준 뷰들 이 저절로 빌드되어 표시되는 매커니즘  모델의 어떤 상태가 변경되었을 때 그와 연 결된 뷰의 특성을 업데이트 하는 매커니즘  사용자의 액션을 잡아내어 그것을 모델을 수정하는 변경 객체로 변경하는 매커니즘
  • 7. GEF 모델  특성  모델은 편집하고자 하는 모든 데이터를 가지고 있어야 합니다.  모델은 뷰나 에디터를 구성하는 어떤 다른 요소 에 대해 아무것도 알아서 안됩니다. 참조도 안됩 니다.  모델은 변경이 일어나면 반드시 이벤트를 발신 하고 수신할 수 있어야 합니다.  java.beans.PropertyChangeListener
  • 8. GEF 뷰  특성  뷰는 모델에 이미 저장된 데이터를 가지고 있어 서는 안됩니다. 뷰는 단지 보여주는 용도로 사용 되어야 합니다.  뷰는 모델이나 에디터를 구성하는 다른 요소에 대해 아무것도 몰라야 합니다.  Draw2D 사용
  • 9. GEF 컨트롤러  특성  모델과 뷰를 연결을 합니다.  GEF에서 연결은 EditPart로 합니다.  하나의 모델 + 뷰 마다 EditPart가 존재 합니다. EditPart는 모델과 뷰 를 다 알고 있으며 모델이 수 정될 때 뷰를 반영해야 하는지 알고 있습니다.
  • 10. Eclipse GEF 살펴보기  Model : 표현하고자하는 Data.  자신의 변경을 통지받을수 있어야합니다.  java.beans.PropertyChangeListener  View : 보여주는 것.  IFigures, SWT의 Treeitem  Controller : Model과 View를 컨트롤  EditPart
  • 11. 각 Part설명 Graphical Viewer Outline Palette Thumbnail
  • 12. Graphical Editor 만들기  확장점  org.eclipse.ui.editors  Extendsion 클래스  GraphicalEditor : GEF 기본 에디터 클래스  GraphicalEditorWithPalette : 팔랫트를 포함한 에 디터 클래스  GraphicalEditorWithFlyoutPalette : 이동 가능한 팔 랫트를 포함한 에디터 클래스
  • 13. 실행환경  Eclipse 4.2 SR1  GEF SDK3.8.1 (update manager http://download.eclipse.org/tools/gef/updates/releases/)  Dependence - org.eclipse.gef
  • 14. 개발순서 1/4  org.eclipse.ui.editor확장점 정의  GraphicalEditorWithFlyoutPalette 클래스를 상속받은 클래스 정의  IEditInput 을 구현한 클래스 정의
  • 15. 개발순서 2/4  1. 모델 정의 Public class HelloworldModel() { String name; public HellowlrldModel(String name) { this.name = name; } getName().. setName(String name)…  2. 모델을 어떻게 보여줄 컨트롤로 구현 public class HelloworldEditPart extends AbstractGraphicalEditPart { protected IFigure createFigure () { HelloworldModel model = (HelloworldModel) getModel (); HelloworldFigure figure= new HelloworldFigure(model); return figure; } }
  • 16. 개발순서 3/4  Figure public class HelloFigure extend Label { public HelloFigure(String name) { super(name);  }  }
  • 17. 개발순서 4/4  3. 모델 + 뷰 연결 컨트롤러 구현 public class HelloworldEditPartFactory implements EditPartFactory { public EditPart createEditPart (EditPart context, Object model) { EditPart part = null; if (model instanceof HelloworldModel) { part = new HelloworldEditPart () } part.setModel (model) ; / / 모델 설정 return part; } }
  • 18. HelloWorld GEF RCP 1. Eclipse Plugin Project 생성 (HelloWorld GEF RCP) 2. Dependencies에 org.eclipse.gef 추가 3. Extensions에 org.eclipse.ui.editor추가  Id: com.sample.gef.helloworld.editor.gef  Name : First GEF – Helloworld  Class : com.sample.gef.helloworld.editor.HelloworldEditor  위의 클래스 생성
  • 19. Helloworld GEF RCP 4. HelloworldEditor 생성 public class HelloworldEditor extends GraphicalEditor { public static final String ID = "com.sample.gef.helloworld.editor.gef"; public HelloworldEditor() { } ….. }
  • 20. Helloworld GEF RCP 5. HelloworldInput public class HelloworldInput implements IEditorInput { public String name = null; public HelloworldInput(String name) { this.name = name; } public boolean exists() { return (this.name != null); } public boolean equals(Object o) { if(!(o instanceof HelloworldInput)) return false; return ((HelloworldInput)o).getName().equals(getName()); } public ImageDescriptor getImageDescriptor() { return ImageDescriptor.getMissingImageDescriptor(); } public String getName() { return this.name; } public IPersistableElement getPersistable() { return null; } public String getToolTipText() { return this.name; } public Object getAdapter(Class adapter) { return null; } }
  • 21. Helloworld GEF RCP 6. Helloworld - 모델클래스작성 public class HelloModel { private String text = "Hello World"; public String getText() { return text; } public void setText(String text) { this.text = text; } }
  • 22. Helloworld GEF RCP 7. 뷰 클래스작성 이번 예제 에서는 뷰는 org.eclipse.draw2d.Label class를 사용합니다. public class HelloworldFigure extends Label { public HelloworldFigure(String name) { super(name); } }
  • 23. Helloworld GEF RCP 8. HelloworldEditPart - Controller클래스작성 public class HelloEditPart extends AbstractGraphicalEditPart { protected IFigure createFigure() { HelloModel model = (HelloModel) getModel(); HelloworldFigure figure = new HelloworldFigure(model.getText()); return figure; } protected void createEditPolicies() { } }
  • 24. Helloworld GEF RCP 9. MyEditPartFactory – Model과 EditPart 연결클래스작성 public class MyEditPartFactory implements EditPartFactory { public EditPart createEditPart(EditPart context, Object model) { EditPart part = null; if (model instanceof HelloModel) part = new HelloEditPart(); part.setModel(model); return part; } }
  • 25. Helloworld GEF RCP 10. HelloworldEditor – EditorFactory 생성 public class HelloworldEditor extends GraphicalEditor { … // 편집 도메인 설정 public HelloworldEditor() { setEditDomain(new DefaultEditDomain(this)); } // EditorFactory 생성 protected void configureGraphicalViewer() { super.configureGraphicalViewer(); GraphicalViewer viewer = getGraphicalViewer(); viewer.setEditPartFactory(new HelloworldEditPartFactory()); } // 최 상위모델 설정 protected void initializeGraphicalViewer() { GraphicalViewer viewer = getGraphicalViewer(); viewer.setContents(new HelloModel()); } … }
  • 26. 모델 편집  Control(EditPart)의 모델의 변경 듣기위해
  • 28. 참고자료  http://wiki.eclipse.org/GEF_Description  http://eclipse.or.kr – 특집기사 : GEF의 이해 1부  Eclipse Help(http://help.eclipse.org/ganymede/index.jsp) – GEF편  Eclipse coon 2005 GEF in dept ppt  SWT/Jface 인 액션(이선아/제갈호준/에이콘)  http://www13.plala.or.jp/observe/draw2d/draw2d_overview.html  Eclipse Plug-in & RCP café의 번역문  http://eclipse-articles.springnote.com/pages/3666185  http://eclipse-articles.springnote.com/pages/3683263  Eclipse Development using the Graphical Editing Framework and the Eclipse Modeling Framework(IBM)  민물곰탱이님 블로그(http://esterel-dev.tistory.com/21)  http://www.ibm.com/developerworks/kr/library/os-eclipse-gef11/