2
我正在開發Eclipse編輯器項目,我應該在編輯器中獲取當前打開文件的位置。我搜索了Eclipse文檔以真正找到FileEditorInput類。但令我驚訝的是,我的項目無法在Eclipse中找到這個類。如何做呢 ?無法在Eclipse中使用FileEditorInput類
我正在開發Eclipse編輯器項目,我應該在編輯器中獲取當前打開文件的位置。我搜索了Eclipse文檔以真正找到FileEditorInput類。但令我驚訝的是,我的項目無法在Eclipse中找到這個類。如何做呢 ?無法在Eclipse中使用FileEditorInput類
FileEditorInput
是org.eclipse.ui.part.FileEditorInput
,但是這僅在您打開編輯器時使用。在查看現有編輯器的輸入時,請使用IFileEditorInput
界面(org.eclipse.ui.IFileEditorInput
)。
編輯器的輸入實際上定義爲IEditorInput
,其中擴展。如果編輯器正在編輯工作區中的文件,它通常會使用IFileEditorInput
。編輯也可以輸入IPathEditorInput
和IURIEditorInput
。
問題是你如何找到它。在我的編輯器中,它說'org.eclipse.ui.part.FileEditorInput不能被解析爲一個類型' – Mishax
@Mishax你需要在你的插件的依賴中有'org.eclipse.ui.ide',但是你通常不需要使用'FileEditorInput'。 –
是的!現在我將upvote you – Mishax