2017-11-28 6 views
-1

이클립스 플러그인의 마법사 페이지에 scrolledComposite를 추가하고 싶습니다. scrolledComposite를 구현 한 FirstPage에서 모든 것이 잘 작동합니다. 문제는 그 다음에 표시 할 SecondPage가 비어 있다는 것입니다. FirstPage에 대한Eclipse JFace WizardPage에서 SWT ScrolledComposite 사용

초기화 코드 :

public void createControl(Composite parent) { 

     ScrolledComposite scroll = new ScrolledComposite(parent, SWT.NULL | SWT.V_SCROLL); 
     scroll.setLayoutData(new GridData(GridData.FILL_VERTICAL)); 

     scroll.setAlwaysShowScrollBars(false); 
     scroll.setExpandVertical(true); 
     scroll.setExpandHorizontal(true); 

     scroll.setMinHeight(500); 
     scroll.setLayout(new GridLayout(1, false)); 

     Composite container = new Composite(scroll, SWT.NULL);  
     GridLayout layout = new GridLayout(); 
     container.setLayout(layout); 
     scroll.setContent(container); 


    setControl(container); 
    setPageComplete(false); 
} 

SecondPage CreateControl에 코드가 표준이지만, 또한 스크롤 될 것 부모를 찾기 위해 시도 - 나는 그것이 "중첩"ScrolledComposite의 문제가 될 것이라고 생각 - 그런 식으로 :

ScrolledComposite scroll = null; 
if(parent.getChildren() != null && parent.getChildren().length > 1 && parent.getChildren()[1] instanceof ScrolledComposite) { 
    scroll = (ScrolledComposite)parent.getChildren()[1]; 

} 

    scroll.setLayoutData(new GridData(GridData.FILL_VERTICAL)); 
    Composite container = new Composite(scroll, SWT.NULL); 
    scroll.setContent(container); 
    scroll.setAlwaysShowScrollBars(false); 
    scroll.setExpandVertical(true); 
    scroll.setExpandHorizontal(true); 

    scroll.setMinHeight(500); 
    scroll.setLayout(new GridLayout(1, false)); 


    GridLayout layout = new GridLayout(); 
    container.setLayout(layout); 
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); 

그러나 이러한 접근 방식은 작동하지 않습니다.

누구나 ScrolledComposites 및 다중 페이지 JFace 마법사와의 통합 경험이 있습니까?

+0

첫 번째 페이지와 같은 두 번째 페이지에 대한 코드를 사용하면 효과가 있습니다. –

답변

0

클래스 계층 구조 IDialogPage -> DialogPage -> WizardPage -> YourCustomPage를 볼 수 있습니다. 따라서 모든 페이지에 대해 Wizard에 의해 WizardPages에서 공유되는 상위 Composite 아래에 사용자 정의 컨텐츠를 작성해야합니다.

하지만 첫 번째 페이지에만 해당되며 두 번째 마법사 페이지와 공유 할 수없는 콘텐츠 요소 인이 루트 합성물 위에 ScollableComposite를 추가하고 있습니다.

두 번째 페이지에 대해 새로운 ScollableComposite를 만들고 내용을 별도로 추가해야합니다. 두 번째 페이지에서 동일한 ScollableComposite의 내용을 업데이트하려고하면 뒤로 버튼을 클릭 할 때 내용이 첫 페이지로 업데이트되지 않습니다. getPreviousPage()가 호출 될 때 createContent()가 호출되지 않기 때문입니다.

0

해결책을 찾았지만 인정해야합니다. 매우 바보 같은 오류였습니다. setControl(container);setControl(scroll);으로 변경하면 충분합니다. 이제 모든 페이지가 올바르게 표시됩니다. 제발, 미래에 그런 것들을 돌보아주세요 :)

관련 문제