簡體   English   中英

Gef:如何從EditPart訪問GraphicalEditor實例?

[英]Gef: How to access GraphicalEditor instance from EditPart?

在EditPart類中,我需要此EditPart所屬的GraphicalEditor的實例。 不將所需的對象傳遞給EditPartFactories並傳遞給EditParts的最簡單方法是什么?

我找到了解決問題的方法:我可以通過以下方式訪問EditPart

Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor();

之所以可行,是因為我可以假設執行此代碼時EditPart具有焦點,而我在問題中忘記提及了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM