Changes between Version 5 and Version 6 of Entry_MS_Migration


Ignore:
Timestamp:
11/11/2016 05:12:01 PM (4 years ago)
Author:
sena
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Entry_MS_Migration

    v5 v6  
    4141}}}
    4242
     43== Migrating the pages ===
     44
     45Pages (tabs) of the multi-page viewers in MS plugins extend from either EntryEditorPart or ScrollableEntryEditorPart or implement IEntryEditorPart interface. In all cases, their input is the Entry object and it needs to be injected (through the constructor) for most of these pages.
     46
     47{{{
     48        @Inject
     49        public MassSpecSpectraView(@Optional Entry entry) {
     50                this.entry = entry;
     51        }
     52}}}
     53
     54The other common part for the pages is the "postConstruct" method to set the part. Part is later used to access the context, change the label and so on as necessary.
     55
     56{{{
     57        @PostConstruct
     58        public void postConstruct(MPart part) {
     59                this.part = part;
     60        }
     61
     62}}}
     63
     64Normally the saving of the pages' contents is handled by overwriting "updateProjectProperty" method but if the page overwrites "doSave" method (from EntryEditorPart) itself, it should be annotated with "@Persist":
     65
     66{{{
     67        @Persist
     68        public void doSave(IProgressMonitor monitor) {
     69                this.viewBase.doSave(monitor);
     70                setDirty(false);
     71        }
     72}}}
     73
     74Similarly, any setFocus() methods should be annotated with "@Focus".
    4375== Updating the pages ==
    4476One important aspect of the multi-page editor is to react to the changes in any of the pages (tabs) so that the editor gets marked dirty. In order to handle this behavior, the MassSpecMultiPageViewer needs to subscribe to the changes in the tabs. This is done by publishing EntryEditorPart.EVENT_TOPIC_CONTENT_MODIFIED event every time a page gets dirty as shown below: