【问题标题】:How to get a Listener in Eclipse FormPage如何在 Eclipse FormPage 中获取监听器
【发布时间】:2011-06-17 16:13:17
【问题描述】:

我正在通过 Eclipse 的 FormPage 在编辑器中添加 3 个页面。现在在选择每个页面时,我希望一个听众被解雇。我尝试在每个页面类中实现IPageListener,但没有一个响应我。在eclipse FormPage中选择任何页面时如何获取监听器?

我已经做了一个 FormEditor 类,

public class SimpleFormEditor extends FormEditor

然后我在里面添加了addPage,

addPage(new ApplicationFormPage(this));

现在在这个 ApplicationFormPage 中,我实现了 IPageListener,

public class ApplicationFormPage extends FormPage implements IPageListener{

其实我的计划是在我们点击这个页面标签后立即获取监听器。

【问题讨论】:

  • 您在 FormEditor 中添加了一个监听器,对吧?请给我们看一个sn-p的代码,甚至是伪代码。还是您的意思是您将多个页面放在一个 FormPage 而不是 FormEditor 中?

标签: eclipse eclipse-plugin


【解决方案1】:

当您的表单页面被实例化时,您需要将其添加到某处,以便在页面更改时收到通知。在 MultiPageEditorPart 他们使用 org.eclipse.jface.dialogs.IPageChangedListener。

formEditor.addPageChangedListener(page);

【讨论】:

    猜你喜欢
    • 2012-04-29
    • 2018-10-06
    • 2015-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-06
    • 1970-01-01
    相关资源
    最近更新 更多