How do I stop an Eclipse Editor from closing in an RCP

后端 未结 3 641
轻奢々
轻奢々 2021-01-01 06:37

I am working on an Eclipse based RCP. We have a need to prevent one of the opened editors from being closed by the user.

The desired behavior is:

  1. the
3条回答
  •  死守一世寂寞
    2021-01-01 07:05

    Not directly related but I was looking for a way to prevent an Editor to be closed and found this little hack, hope it could help.

    page.addPartListener(new IPartListener2() {
        // [...]
        @Override
        public void partClosed(IWorkbenchPartReference partRef) {
            try {
                page.openEditor(input, id);
            } catch (PartInitException e) {
                e.printStackTrace();
            }
        }
    });
    

提交回复
热议问题