Search code examples
eclipseeditorrefreshrcp

Eclipse RCP EditorReference / IEditorPart


Eclipse RCP components

I have small experience with Eclipse RCP and I'm wondering if some thinks are possible from the framework, or I should implement them.
Regarding to the attached image from the upper link I have some questions:

1. Is it possible to detect what EditorReference is Focused, Visible or Not Visible(I'm speaking for the Editors that are on >>4, opened but not visible)?
For me FormData.java EditorReference is Visible but not Focused, FormLayout.java is Visible and Focused, the other EditorReference behind >>4 are Not Visible.

PS: I want to do this for an Eclipse RCP application that I write it now.


Solution

  • Check out this link : https://wiki.eclipse.org/FAQ_How_do_I_find_out_what_view_or_editor_is_selected%3F

    IWorkbenchPage page = ...;
    //the active part
    IWorkbenchPart active = page.getActivePart();
    //adding a listener
    IPartListener2 pl = new IPartListener2() {
       public void partActivated(IWorkbenchPartReference ref)
          System.out.println("Active: "+ref.getTitle());
       }
       ... other listener methods ...
    };
    page.addPartListener(pl);