| 1485 | } |
| 1486 | |
| 1487 | void QmitkExtWorkbenchWindowAdvisor::UpdateTitle(bool editorHidden) |
| 1488 | { |
| 1489 | berry::IWorkbenchWindowConfigurer::Pointer configurer = GetWindowConfigurer(); |
| 1490 | berry::IWorkbenchWindow::Pointer window = configurer->GetWindow(); |
| 1491 | berry::IEditorPart::Pointer activeEditor; |
| 1492 | berry::IWorkbenchPage::Pointer currentPage = window->GetActivePage(); |
| 1493 | berry::IPerspectiveDescriptor::Pointer persp; |
| 1494 | berry::IAdaptable* input = nullptr; |
| 1495 | |
| 1496 | if (currentPage) |
| 1497 | { |
| 1498 | activeEditor = currentPage->GetActiveEditor(); |
| 1499 | persp = currentPage->GetPerspective(); |
| 1500 | input = currentPage->GetInput(); |
| 1501 | } |
| 1502 | |
| 1503 | if (editorHidden) |
| 1504 | { |
| 1505 | activeEditor = nullptr; |
| 1506 | } |
| 1507 | |
| 1508 | // Nothing to do if the editor hasn't changed |
| 1509 | if (activeEditor == lastActiveEditor.Lock() && currentPage == lastActivePage.Lock() |
| 1510 | && persp == lastPerspective.Lock() && input == lastInput) |
| 1511 | { |
| 1512 | return; |
| 1513 | } |
| 1514 | |
| 1515 | auto lockedLastActiveEditor = lastActiveEditor.Lock(); |
| 1516 | |
| 1517 | if (lockedLastActiveEditor.IsNotNull()) |
| 1518 | { |
| 1519 | lockedLastActiveEditor->RemovePropertyListener(editorPropertyListener.data()); |
| 1520 | } |
| 1521 | |
| 1522 | lastActiveEditor = activeEditor; |
| 1523 | lastActivePage = currentPage; |
| 1524 | lastPerspective = persp; |
| 1525 | lastInput = input; |
| 1526 | |
| 1527 | if (activeEditor) |
| 1528 | { |
| 1529 | activeEditor->AddPropertyListener(editorPropertyListener.data()); |
| 1530 | } |
| 1531 | |
| 1532 | RecomputeTitle(); |
| 1533 | } |
| 1534 | |
| 1535 | void QmitkExtWorkbenchWindowAdvisor::PropertyChange(const berry::Object::Pointer& /*source*/, int propId) |
| 1536 | { |
no test coverage detected