~berthold-daum/zora/trunk

« back to all changes in this revision

Viewing changes to com.bdaum.zoom.ui/src/com/bdaum/zoom/ui/internal/views/HistoryView.java

  • Committer: bdaum
  • Date: 2015-12-26 10:21:51 UTC
  • Revision ID: berthold.daum@bdaum.de-20151226102151-44f1j5113167thb9
VersionĀ 2.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
import org.eclipse.swt.widgets.Shell;
39
39
import org.eclipse.ui.IActionBars;
40
40
import org.eclipse.ui.IMemento;
 
41
import org.eclipse.ui.IPerspectiveDescriptor;
41
42
import org.eclipse.ui.IViewReference;
42
43
import org.eclipse.ui.IViewSite;
43
44
import org.eclipse.ui.IWorkbenchActionConstants;
 
45
import org.eclipse.ui.IWorkbenchPage;
44
46
import org.eclipse.ui.IWorkbenchPart;
45
47
import org.eclipse.ui.PartInitException;
46
48
import org.eclipse.ui.PlatformUI;
520
522
                        oneYearAction.setChecked(true);
521
523
                        break;
522
524
                }
 
525
        }
523
526
 
 
527
        @Override
 
528
        protected void fireSelection(SelectionChangedEvent event) {
 
529
                IStructuredSelection selection = (IStructuredSelection) event
 
530
                                .getSelection();
 
531
                Object obj = selection.getFirstElement();
 
532
                String perspId = null;
 
533
                if (obj instanceof SlideShowImpl) {
 
534
                        perspId = ((SlideShowImpl) obj).getPerspective();
 
535
                        if (perspId == null)
 
536
                                perspId = "com.bdaum.zoom.SlidesPerspective"; //$NON-NLS-1$
 
537
                } else if (obj instanceof ExhibitionImpl) {
 
538
                        perspId = ((ExhibitionImpl) obj).getPerspective();
 
539
                        if (perspId == null)
 
540
                                perspId = "com.bdaum.zoom.ExhibitionPerspective"; //$NON-NLS-1$
 
541
                } else if (obj instanceof WebGalleryImpl) {
 
542
                        perspId = ((WebGalleryImpl) obj).getPerspective();
 
543
                        if (perspId == null)
 
544
                                perspId = "com.bdaum.zoom.WebGalleryPerspective"; //$NON-NLS-1$
 
545
                } else if (obj instanceof SmartCollectionImpl) {
 
546
                        perspId = ((SmartCollectionImpl) obj).getPerspective();
 
547
                        if (perspId == null)
 
548
                                perspId = "com.bdaum.zoom.rcp.LightboxPerspective"; //$NON-NLS-1$
 
549
                }
 
550
                if (perspId != null) {
 
551
                        IWorkbenchPage page = getViewSite().getPage();
 
552
                        if (!page.getPerspective().getId().equals(perspId)) {
 
553
                                IPerspectiveDescriptor perspective = PlatformUI.getWorkbench()
 
554
                                                .getPerspectiveRegistry()
 
555
                                                .findPerspectiveWithId(perspId);
 
556
                                if (perspective != null)
 
557
                                        page.setPerspective(perspective);
 
558
                        }
 
559
                }
 
560
                super.fireSelection(event);
524
561
        }
525
562
 
526
563
        private void contributeToActionBars() {
664
701
 
665
702
        public void historyChanged() {
666
703
                // do nothing
667
 
 
668
704
        }
669
705
 
670
706
        public void queryHistoryChanged(IdentifiableObject obj) {