2016-08-03 10 views
0

아래 코드를 사용하여 workbench.prefs 파일에있는 업데이트 된 환경 설정을 가져옵니다.일반 키 - 키 환경 설정 페이지에있는 Eclipse 기본 키 바인딩 값을 읽는 방법

private String nodeValue = "org.eclipse.ui.commands"; 

IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore(); 
String updatedKeyString = store.getString(nodeValue); 

하지만 이제 일반 키 키 환경 설정 페이지에있는 키 바인딩의 기본값을 가져와야합니다.

답변

0
당신은 바인딩 서비스에서 현재 키 바인딩을 얻을 수 있습니다

:.

IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class); 

Binding [] bindings = bindingService.getBindings(); 
+0

IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench() 대해 getAdapter (IBindingService.class를); bindingService.getBestActiveBindingFormattedFor (CMDID); 위의 코드로 시도했지만 여전히 null 값을 얻고 있습니다. –

+0

Eclipse 코드의 여러 위치에서 사용되므로 제대로 작동합니다. 올바른 명령 ID와 일부 바인딩이 명령에 실제로 활성화되어 있는지 확인하십시오. 모든 명령이 키에 바인딩되어있는 것은 아닙니다. –

+0

특정 명령에 대한 키 환경 설정 페이지에서 바인딩 값을 업데이트하면 위의 코드를 사용하여 업데이트 된 바인딩 값을 가져올 수 있습니까? –