Changes between Version 2 and Version 3 of Entry_MS_Annotation_Migration


Ignore:
Timestamp:
11/10/2016 10:45:18 PM (4 years ago)
Author:
sena
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Entry_MS_Annotation_Migration

    v2 v3  
     1== Migration of static methods ==
     2
     3There are two static methods that are being used throughout the plugin to get active viewer and the active viewer for a given Entry. In some cases (mainly from command handlers), these are replaced with the use of injected variables and for some other parts that needs to access these, the static methods are migrated to use eclipse context.
     4
     5{{{
     6        public static MSAnnotationMultiPageViewer getActiveViewerForEntry(IEclipseContext context, Entry entry ) {
     7                EPartService partService = context.get(EPartService.class);
     8                for (MPart part: partService.getParts()) {
     9                        if (part.getObject() instanceof MSAnnotationMultiPageViewer) {
     10                                if (((MSAnnotationMultiPageViewer)part.getObject()).getEntry().equals(entry)) {
     11                                        return (MSAnnotationMultiPageViewer)part.getObject();
     12                                }
     13                        }
     14                }
     15                return null;
     16        }
     17       
     18        private static MSAnnotationMultiPageViewer getActiveViewer(IEclipseContext context) {
     19                MPart part = (MPart) context.get(IServiceConstants.ACTIVE_PART);
     20                if (part != null && part.getObject() instanceof MSAnnotationMultiPageViewer)
     21                        return (MSAnnotationMultiPageViewer) part.getObject();
     22                return null;
     23        }
     24}}}
     25
     26
    127== Propagation of checkbox changes ==
    228