Eclipse
[Eclipse] extension 의 IConfigurationElement 으로 부터 해당 Bundle 얻어오기
leechwin
2013. 10. 2. 17:47
Eclipse 의 extension point 를 extension 한경우 그값으로 IConfigurationElement 를 얻어 올 수 있다.
extension 을 한 해당 plugin 에 대한 Bundle 을 얻고 싶은 경우가 있는데 다음과 같이 수행하면 해당 Bundle 을 얻어 올 수 있다.
Bundle bundle = Platform.getBundle( IConfigurationElement.getContributor().getName() );
해당 번들에서 어떠한 리소스들 찾고 싶다면 다음과 같이 수행하면된다.
Bundle bundle = Platform.getBundle( IConfigurationElement.getContributor().getName() ); URL url = bundle.getResource( filepath ); URL resolvedURL = FileLocator.resolve( url );
참고로 번들에서 Resource 를 얻어오면 "bundleresource://" 등의 prefix 가 붙는 경우가 있는데,
이런때에는 org.eclipse.core.runtime.FileLocator.resolve(URL url) 함수를 사용하면 된다.
참고: http://www.eclipsezone.com/eclipse/forums/t82616.html
참고: http://stackoverflow.com/questions/9030830/file-and-bundleresource-urls