Detect tab close in Eclipse editor

前端 未结 1 1269
一整个雨季
一整个雨季 2021-01-14 21:22

I have an Eclipse RCP application with own editor. Class editor extends from org.eclipse.ui.texteditor.AbstractTextEditor and it is added in extension in

相关标签:
1条回答
  • 2021-01-14 21:57

    For editor close event do something like this:

    IWorkbenchPage page = ...;
    
        //adding a listener
    IPartListener2 pl = new IPartListener2() {
            // ... Other methods
            public void partClosed(IWorkbenchPartReference partRef)
            {
                //if(partRef.getId().equals(youreditor.id){ /* do something*/ }
            }
    
    };
    page.addPartListener(pl);
    

    Have a look at these links:

    1. How to add a listener to the default code editor in Eclipse?
    2. FAQ How do I find out what view or editor is selected?
    0 讨论(0)
提交回复
热议问题