Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [chemclipse-dev] What is the proper way to update the ChromatogramEditorMSD?

You can rely on the functionality that the framework handles to open the chromatogram files correctly. Just use the ChromatogramSelectionMSD and its update method. There's no need to create a new ChromatogramSelectionMSD on change.


Philip

Am 07.09.2016 um 11:30 schrieb Trig Chen:
Hi all,

1. I created a ChromatogramMSD firstly,
          final TideMSChromatogram tideMSChromatogram = new TideMSChromatogram();
2. and then acquired some spectra from our home-built in situ TOF mass spectrometer and added these spectra to the tideMSChromatogram. After acquired more than 2 spectra, opened (or create if not existed) a ChromatogramEditorMSD editor part to display tideMSChromatogram. It's just because  ChromatogramEditorMSD open a empty ChromatogramMSD will cause exceptions.

      for(int i = 0; (i < getSpectraNumber()) && (!stopFlag); i++) {
acquireMassSpectrum(tideMSChromatogram, writer, i);
if(i == 10) {
openMSDEditor(tideMSChromatogram);
}
}


3.  In the method acquireMassSpectrum(tideMSChromatogram, writer, i) in step 2, I created scans to hold acquired data and added these scans to tideMSChromatogram, and then called the fireupdate method of tideMSChromatogram

tideMSChromatogram.addScan(scan);
try {
tideMSChromatogram.fireUpdate(new ChromatogramSelectionMSD(tideMSChromatogram, true));
} catch(final ChromatogramIsNullException e) {
logger.warn(e);
}

The tideMSChromatogram.fireUpdate(new ChromatogramSelectionMSD(tideMSChromatogram, true)) statement seems awkward. I doubt if the step 3 is the proper way to update a chromatogram in the chromatogram's editor? If not, what is the proper one?

PS:
In step 2, I used the following codes to create MSD Editor:
final MPart part = MBasicFactory.INSTANCE.createInputPart();
part.setElementId(ChromatogramEditorMSD.ID);
part.setContributionURI(ChromatogramEditorMSD.CONTRIBUTION_URI);
if(chromatogram != null) {
part.setObject(chromatogram);
part.setLabel(chromatogram.getName());
} else {
part.setObject(null);
part.setLabel("No valid chromatogram");
}
part.setIconURI(ChromatogramEditorMSD.ICON_URI);
part.setTooltip(ChromatogramEditorMSD.TOOLTIP);
part.setCloseable(true);
final MPartStack partStack = (MPartStack)modelService.find(IPerspectiveAndViewIds.EDITOR_PART_STACK_ID, application);
partStack.getChildren().add(part);
partService.showPart(part, PartState.ACTIVATE);
one more question:
               I created this ChromatogramEditorMSD part and shew it, but I could not cast it to ChromatogramEditorMSD lately in another way. Excepton occured:
java.lang.ClassCastException: org.eclipse.e4.ui.model.application.ui.basic.impl.InputPartImpl cannot be cast to org.eclipse.chemclipse.ux.extension.msd.ui.editors.ChromatogramEditorMSD
How can I convert a Part to the class object which this Part's contributionURI points to? 

Best regards,

Trig


_______________________________________________
chemclipse-dev mailing list
chemclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/chemclipse-dev

-- 
~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Philip Wenig » Founder » philip.wenig@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~

Back to the top