Eclipse 플러그인 내에서 Jface Filedialog를 모드가없는 방식으로 사용하는 방법은 무엇입니까?
문제
Eclipse 플러그인을 작성하고 있으며 일부 작업에 응답하여 일련의 작업을 시작하는 데 흥미 롭습니다 (별도의 작업 내). 이러한 작업 중 하나는 사용자에게 파일 이름을 제공하도록 요청하는 것입니다.
그러나 나는 모드가없는 방식으로 이것을 어떻게하는지 명확하지 않다. 예를 들어, 디스플레이와 쉘은 어디에서 얻습니까? 개발자가 대화 상자에서 내용을 편집 할 수있는 동안 UI가 계속 작동하는지 확인하려면 어떻게해야합니까?
해결책
일식 자체가 어떻게하는지 알 수 있습니다.
/**
* Creates a new dialog with the given shell as parent.
* @param parentShell the parent shell
*/
public FindReplaceDialog(Shell parentShell) {
super(parentShell);
fParentShell= null;
[...]
readConfiguration();
setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE | SWT.RESIZE);
setBlockOnOpen(false);
}
/**
* Returns this dialog's parent shell.
* @return the dialog's parent shell
*/
public Shell getParentShell() {
return super.getParentShell();
}
/**
* Sets the parent shell of this dialog to be the given shell.
*
* @param shell the new parent shell
*/
public void setParentShell(Shell shell) {
if (shell != fParentShell) {
if (fParentShell != null)
fParentShell.removeShellListener(fActivationListener);
fParentShell= shell;
fParentShell.addShellListener(fActivationListener);
}
fActiveShell= shell;
}
대화 상자의 초점에 따라 상위 쉘을 관리합니다.
/**
* Updates the find replace dialog on activation changes.
*/
class ActivationListener extends ShellAdapter {
/*
* @see ShellListener#shellActivated(ShellEvent)
*/
public void shellActivated(ShellEvent e) {
fActiveShell= (Shell)e.widget;
updateButtonState();
if (fGiveFocusToFindField && getShell() == fActiveShell &&
okToUse(fFindField))
fFindField.setFocus();
}
/*
* @see ShellListener#shellDeactivated(ShellEvent)
*/
public void shellDeactivated(ShellEvent e) {
fGiveFocusToFindField= false;
storeSettings();
[...]
fActiveShell= null;
updateButtonState();
}
}
ㅏ ShellAdapter
IS는 ShellListener
상태의 변화를 처리하는 방법을 제공하는 인터페이스 Shell
.
다른 팁
수입은 스타일 값에 swt.modeless가 포함되어야한다는 것입니다.
스타일은 SWT에서 가장 중요한 것 중 하나입니다. Styel 값으로 인해 많은 것을 제어하고 초기화 할 수 있기 때문입니다.
제휴하지 않습니다 StackOverflow