Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Peak Traces not updating properly #924

Merged
merged 3 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2021 Lablicate GmbH.
* Copyright (c) 2020, 2022 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -37,6 +37,12 @@ protected ExtendedPeakTracesUI createControl(Composite parent) {
return new ExtendedPeakTracesUI(parent, SWT.NONE);
}

@Override
public void setFocus() {

getControl().setFocus();
}

@Override
protected boolean updateData(List<Object> objects, String topic) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2020, 2021 Lablicate GmbH.
* Copyright (c) 2020, 2022 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -22,16 +22,20 @@
import javax.inject.Inject;

import org.eclipse.chemclipse.logging.core.Logger;
import org.eclipse.chemclipse.model.core.IChromatogramPeak;
import org.eclipse.chemclipse.model.core.IPeak;
import org.eclipse.chemclipse.model.core.IScan;
import org.eclipse.chemclipse.msd.model.core.IPeakMSD;
import org.eclipse.chemclipse.msd.model.core.IPeakModelMSD;
import org.eclipse.chemclipse.msd.model.core.IScanMSD;
import org.eclipse.chemclipse.rcp.ui.icons.core.ApplicationImageFactory;
import org.eclipse.chemclipse.rcp.ui.icons.core.IApplicationImage;
import org.eclipse.chemclipse.support.events.IChemClipseEvents;
import org.eclipse.chemclipse.support.ui.provider.AbstractLabelProvider;
import org.eclipse.chemclipse.swt.ui.components.InformationUI;
import org.eclipse.chemclipse.swt.ui.notifier.UpdateNotifierUI;
import org.eclipse.chemclipse.ux.extension.xxd.ui.Activator;
import org.eclipse.chemclipse.ux.extension.xxd.ui.part.support.DataUpdateSupport;
import org.eclipse.chemclipse.ux.extension.xxd.ui.preferences.PreferencePagePeakTraces;
import org.eclipse.chemclipse.ux.extension.xxd.ui.preferences.PreferencePageScans;
import org.eclipse.chemclipse.ux.extension.xxd.ui.support.charts.PeakDataSupport;
Expand Down Expand Up @@ -88,9 +92,18 @@ public ExtendedPeakTracesUI(Composite parent, int style) {
createControl();
}

@Override
@Focus
public boolean setFocus() {

DataUpdateSupport dataUpdateSupport = Activator.getDefault().getDataUpdateSupport();
List<Object> objects = dataUpdateSupport.getUpdates(IChemClipseEvents.TOPIC_PEAK_XXD_UPDATE_SELECTION);
if(!objects.isEmpty()) {
Object last = objects.get(0);
if(last instanceof IPeak) {
peak = (IPeak)last;
}
}
update(peak);
return true;
}
Expand Down Expand Up @@ -329,7 +342,7 @@ public void handleSeriesResetEvent(String seriesId) {

private IChartMenuEntry createMenuDeleteHiddenSeries() {

IChartMenuEntry menuEntry = new IChartMenuEntry() {
return new IChartMenuEntry() {

@Override
public String getName() {
Expand All @@ -351,13 +364,11 @@ public void execute(Shell shell, ScrollableChart scrollableChart) {
}
}
};
//
return menuEntry;
}

private IChartMenuEntry createMenuDeleteSelectedSeries() {

IChartMenuEntry menuEntry = new IChartMenuEntry() {
return new IChartMenuEntry() {

@Override
public String getName() {
Expand All @@ -379,8 +390,6 @@ public void execute(Shell shell, ScrollableChart scrollableChart) {
}
}
};
//
return menuEntry;
}

private Set<Integer> getTraces(ScrollableChart scrollableChart, boolean useHidden) {
Expand Down Expand Up @@ -448,6 +457,10 @@ private void deleteTraces(Display display, Set<Integer> traces) {
}
}
}
if(peak instanceof IChromatogramPeak) {
IChromatogramPeak chromatogramPeak = (IChromatogramPeak)peak;
chromatogramPeak.getChromatogram().setDirty(true);
}
}

private void applySettings() {
Expand Down Expand Up @@ -488,7 +501,7 @@ private void enableDeleteButton(boolean enabled) {
private void selectComboSeries(int index) {

comboViewerTraces.getCombo().select(index);
enableDeleteButton(index > 0 ? true : false);
enableDeleteButton(index > 0);
}

private boolean peakIsEditable() {
Expand Down