Reputation: 33
I am working in an RCP application similar to Eclipse where the user can navigate in Project Explorer tree and opens any file in the Editor
i am Setting the RCP application title in a class which extends "WorkbenchWindowAdvisor" as the following:
IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); configurer.setTitle("My RCP Application title");
But what i need to show up in title bar the perspective name and the opened file path like in normal eclipse:
any suggestions
Thanks
Upvotes: 1
Views: 228
Reputation: 111142
This is requires listening to a lot of events in your WorkbenchWindowAdvisor.
In the preWindowOpen
method you need to add listeners for:
configurer.getWindow().addPageListener(listener)
The pageActivated
and pageClosed
listener methods need to update the title. configurer.getWindow().addPerspectiveListener(listener)
. The perspectiveActivated
, perspectiveSavedAs
, perspectiveDeactivated
methods need to update the title.configurer.getWindow().getPartService().addPartListener(listener)
. This need to use an IPartListener2
. The partActivated
, partBroughtToTop
, partClosed
, partHidden
, partVisible
methods need to update the title. You get the open file path from the active editor:
IWorkbenchPage currentPage = configurer.getWindow().getActivePage();
IEditorPart activeEditor = currentPage.getActiveEditor();
if (activeEditor != null) {
path = activeEditor.getTitleToolTip();
}
and the perspective name:
IPerspectiveDescriptor persp = currentPage.getPerspective();
if (persp != null) {
label = persp.getLabel();
}
The full, even more complex, code for this is in org.eclipse.ui.internal.ide.application.IDEWorkbenchWindowAdvisor
Upvotes: 2