Skip to content

Commit 5ec95d6

Browse files
authored
Merge pull request #2740 from Mailaender/hotkey-unknown-scans
Uncouple the unknown marker number of traces from copy traces to clipboard
2 parents 1072890 + d91df3c commit 5ec95d6

File tree

6 files changed

+37
-19
lines changed

6 files changed

+37
-19
lines changed

chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/model/TracesSupport.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2022, 2025 Lablicate GmbH.
2+
* Copyright (c) 2022, 2026 Lablicate GmbH.
33
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0
@@ -48,10 +48,9 @@ public static void setTracesExportOption(TracesExportOption tracesExportOption)
4848
preferenceStore.setValue(PreferenceSupplier.P_TRACES_EXPORT_OPTION, tracesExportOption.name());
4949
}
5050

51-
public static String getTraces(Object scan) {
51+
public static String getTraces(IScan scan, int maxCopyTraces) {
5252

5353
String traces;
54-
int maxCopyTraces = getNumberOfTraces();
5554
boolean sortTraces = isSortTraces();
5655

5756
if(scan instanceof IScanMSD scanMSD) {
@@ -67,9 +66,9 @@ public static String getTraces(Object scan) {
6766
return traces;
6867
}
6968

70-
public static void copyTracesToClipboard(Display display, TracesExportOption tracesExportOption, Object scan) {
69+
public static void copyTracesToClipboard(Display display, TracesExportOption tracesExportOption, IScan scan, int maxCopyTraces) {
7170

72-
String traces = getTraces(scan);
71+
String traces = getTraces(scan, maxCopyTraces);
7372
if(!traces.isEmpty()) {
7473
switch(tracesExportOption) {
7574
case NAMED_TRACE:
@@ -117,11 +116,6 @@ private static IScan getScanInstance(Object scan) {
117116
return scanInstance;
118117
}
119118

120-
private static int getNumberOfTraces() {
121-
122-
return preferenceStore.getInt(PreferenceSupplier.P_MAX_COPY_SCAN_TRACES);
123-
}
124-
125119
private static boolean isSortTraces() {
126120

127121
return preferenceStore.getBoolean(PreferenceSupplier.P_SORT_COPY_TRACES);

chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferencePageTargets.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2017, 2025 Lablicate GmbH.
2+
* Copyright (c) 2017, 2026 Lablicate GmbH.
33
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0
@@ -15,6 +15,7 @@
1515
import org.eclipse.chemclipse.support.ui.preferences.fieldeditors.ExtendedIntegerFieldEditor;
1616
import org.eclipse.chemclipse.support.ui.preferences.fieldeditors.FloatFieldEditor;
1717
import org.eclipse.chemclipse.support.ui.preferences.fieldeditors.SpacerFieldEditor;
18+
import org.eclipse.chemclipse.support.ui.preferences.fieldeditors.SpinnerFieldEditor;
1819
import org.eclipse.chemclipse.ux.extension.xxd.ui.Activator;
1920
import org.eclipse.chemclipse.ux.extension.xxd.ui.swt.ScanWebIdentifierUI;
2021
import org.eclipse.chemclipse.ux.extension.xxd.ui.swt.TargetWebIdentifierUI;
@@ -66,6 +67,7 @@ public void createFieldEditors() {
6667
addField(new FloatFieldEditor(PreferenceSupplier.P_MATCH_QUALITY_UNKNOWN_TARGET, "Match Quality (Unknown Target)", PreferenceSupplier.MIN_MATCH_QUALITY, PreferenceSupplier.MAX_MATCH_QUALITY, getFieldEditorParent()));
6768
addField(new BooleanFieldEditor(PreferenceSupplier.P_UNKNOWN_TARGET_ADD_RETENTION_INDEX, "Add Retention Index (Unknown Target)", getFieldEditorParent()));
6869
addField(new BooleanFieldEditor(PreferenceSupplier.P_VERIFY_UNKNOWN_TARGET, "Verify (Unknown Target)", getFieldEditorParent()));
70+
addField(new SpinnerFieldEditor(PreferenceSupplier.P_MAX_UNKNOWN_TRACES, "Show Traces", PreferenceSupplier.MIN_TRACES, PreferenceSupplier.MAX_TRACES, getFieldEditorParent()));
6971
}
7072

7173
@Override

chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/preferences/PreferenceSupplier.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ public class PreferenceSupplier extends AbstractPreferenceSupplier implements IP
250250
public static final boolean DEF_SCAN_CHART_ENABLE_COMPRESS = false;
251251
public static final String P_MAX_COPY_SCAN_TRACES = "maxCopyScanTraces";
252252
public static final int DEF_MAX_COPY_SCAN_TRACES = DEF_SCAN_TRACES;
253+
public static final String P_MAX_UNKNOWN_TRACES = "maxUnknownTraces";
254+
public static final int DEF_MAX_UNKNOWN_TRACES = DEF_SCAN_TRACES;
253255
public static final String P_SORT_COPY_TRACES = "sortCopyTraces";
254256
public static final boolean DEF_SORT_COPY_TRACES = true;
255257
public static final String P_TRACES_EXPORT_OPTION = "tracesExportOption";
@@ -1024,6 +1026,7 @@ public void initializeDefaults() {
10241026
putDefault(P_RETENTION_INDEX_DEVIATION_ABS_OK, DEF_RETENTION_INDEX_DEVIATION_ABS_OK);
10251027
putDefault(P_RETENTION_INDEX_DEVIATION_ABS_WARN, DEF_RETENTION_INDEX_DEVIATION_ABS_WARN);
10261028
putDefault(P_ADD_UNKNOWN_AFTER_DELETE_TARGETS_ALL, DEF_ADD_UNKNOWN_AFTER_DELETE_TARGETS_ALL);
1029+
putDefault(P_MAX_UNKNOWN_TRACES, DEF_MAX_UNKNOWN_TRACES);
10271030
putDefault(P_MATCH_QUALITY_UNKNOWN_TARGET, DEF_MATCH_QUALITY_UNKNOWN_TARGET);
10281031
putDefault(P_UNKNOWN_TARGET_ADD_RETENTION_INDEX, DEF_UNKNOWN_TARGET_ADD_RETENTION_INDEX);
10291032
putDefault(P_VERIFY_UNKNOWN_TARGET, DEF_VERIFY_UNKNOWN_TARGET);

chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/support/IdentificationTargetSupport.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2023, 2025 Lablicate GmbH.
2+
* Copyright (c) 2023, 2026 Lablicate GmbH.
33
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0
@@ -24,6 +24,8 @@ public class IdentificationTargetSupport {
2424

2525
private static final String IDENTIFIER_UNKNOWN = "Manual Identification";
2626

27+
private static final IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
28+
2729
public static IIdentificationTarget getTargetUnknown(IScan scan) {
2830

2931
IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
@@ -38,7 +40,8 @@ public static IIdentificationTarget getTargetUnknown(IScan scan) {
3840
public static String getUnknownTargetName(IScan scan, boolean addRetentionIndex) {
3941

4042
StringBuilder builder = new StringBuilder();
41-
String traces = TracesSupport.getTraces(scan);
43+
int maxCopyTraces = getNumberOfTraces();
44+
String traces = TracesSupport.getTraces(scan, maxCopyTraces);
4245

4346
builder.append("Unknown");
4447
if(!traces.isEmpty()) {
@@ -59,4 +62,9 @@ public static String getUnknownTargetName(IScan scan, boolean addRetentionIndex)
5962

6063
return builder.toString();
6164
}
65+
66+
private static int getNumberOfTraces() {
67+
68+
return preferenceStore.getInt(PreferenceSupplier.P_MAX_UNKNOWN_TRACES);
69+
}
6270
}

chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/swt/ExtendedPeakScanListUI.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ private void addKeyEventProcessors(Display display, ITableSettings tableSettings
462462
} else if(matchesKeyPress("DeleteTargets", e)) {
463463
deleteTargetsAll(e.display);
464464
} else if(matchesKeyPress("Unknown", e)) {
465-
addTargetsUnknown(e.display);
465+
addTargetsUnknown();
466466
} else if(matchesKeyPress("Query", e)) {
467467
scanIdentifierControl.get().runIdentification();
468468
tableViewer.get().refresh();
@@ -669,7 +669,7 @@ private IScan getScan(Object object) {
669669
return null;
670670
}
671671

672-
private void addTargetsUnknown(Display display) {
672+
private void addTargetsUnknown() {
673673

674674
for(Object object : tableViewer.get().getStructuredSelection().toList()) {
675675
IScan scan = getScan(object);
@@ -685,10 +685,10 @@ private void addTargetsUnknown(Display display) {
685685
* Send update.
686686
*/
687687
tableViewer.get().refresh();
688-
UpdateNotifierUI.update(display, chromatogramSelection);
688+
UpdateNotifierUI.update(getDisplay(), chromatogramSelection);
689689

690690
chromatogramSelection.getChromatogram().setDirty(true);
691-
UpdateNotifierUI.update(display, IChemClipseEvents.TOPIC_EDITOR_CHROMATOGRAM_UPDATE, "Peaks/Scans unknown targets have been set.");
691+
UpdateNotifierUI.update(getDisplay(), IChemClipseEvents.TOPIC_EDITOR_CHROMATOGRAM_UPDATE, "Peaks/Scans unknown targets have been set.");
692692
}
693693

694694
private void propagateSelection(Display display) {

chemclipse/plugins/org.eclipse.chemclipse.ux.extension.xxd.ui/src/org/eclipse/chemclipse/ux/extension/xxd/ui/swt/TracesClipboardUI.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2025 Lablicate GmbH.
2+
* Copyright (c) 2025, 2026 Lablicate GmbH.
33
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0
@@ -18,8 +18,11 @@
1818
import org.eclipse.chemclipse.rcp.ui.icons.core.ApplicationImageFactory;
1919
import org.eclipse.chemclipse.rcp.ui.icons.core.IApplicationImage;
2020
import org.eclipse.chemclipse.rcp.ui.icons.core.IApplicationImageProvider;
21+
import org.eclipse.chemclipse.ux.extension.xxd.ui.Activator;
2122
import org.eclipse.chemclipse.ux.extension.xxd.ui.model.TracesExportOption;
2223
import org.eclipse.chemclipse.ux.extension.xxd.ui.model.TracesSupport;
24+
import org.eclipse.chemclipse.ux.extension.xxd.ui.preferences.PreferenceSupplier;
25+
import org.eclipse.jface.preference.IPreferenceStore;
2326
import org.eclipse.swt.SWT;
2427
import org.eclipse.swt.events.SelectionAdapter;
2528
import org.eclipse.swt.events.SelectionEvent;
@@ -33,6 +36,8 @@
3336

3437
public class TracesClipboardUI extends Composite {
3538

39+
private static final IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
40+
3641
private AtomicReference<Button> buttonClipboard = new AtomicReference<>();
3742
private IScan scan = null;
3843

@@ -119,7 +124,13 @@ private void copyToClipboard(Display display) {
119124

120125
if(scan != null) {
121126
TracesExportOption tracesExportOption = TracesSupport.getTracesExportOption();
122-
TracesSupport.copyTracesToClipboard(display, tracesExportOption, scan);
127+
int maxCopyTraces = getNumberOfTraces();
128+
TracesSupport.copyTracesToClipboard(display, tracesExportOption, scan, maxCopyTraces);
123129
}
124130
}
131+
132+
private static int getNumberOfTraces() {
133+
134+
return preferenceStore.getInt(PreferenceSupplier.P_MAX_COPY_SCAN_TRACES);
135+
}
125136
}

0 commit comments

Comments
 (0)