在開發eclipse插件時候,發現需要擷取到workspace下所有的項目。決定通過resourceplugin來擷取。
1、導入resourceplugin所在的jar包org.eclipse.core.resources_3.8.101.v20130717-0806.jar進lib目錄。
2、配置plugin.xml的runtime頁籤,在classpath中增加剛才在lib目錄上加進來的jar包.
3、配置plugin.xml的dependencies頁籤,另入依賴org.eclipse.core.resources.source。
4、在代碼中使用
5、注意:
如果沒配置第2步,會報resourceplugin classnotfound
如果沒配置第3步,會報java.lang.illegalstateexception: workspace is closed.