Skip to content

Commit

Permalink
Fixed #684 - Process Supplier - System Options
Browse files Browse the repository at this point in the history
  • Loading branch information
eselmeister committed Jul 14, 2021
1 parent 7ff4d30 commit 413ac6d
Show file tree
Hide file tree
Showing 17 changed files with 240 additions and 139 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ Export-Package: org.eclipse.chemclipse.chromatogram.filter.core.chromatogram,
org.eclipse.chemclipse.chromatogram.filter.result,
org.eclipse.chemclipse.chromatogram.filter.settings
Import-Package: org.osgi.service.component.annotations;version="1.2.0"
Service-Component: OSGI-INF/org.eclipse.chemclipse.chromatogram.filter.core.chromatogram.ChromatogramFilterProcessSupplier.xml
Service-Component: OSGI-INF/org.eclipse.chemclipse.chromatogram.filter.core.chromatogram.ChromatogramFilterProcessSupplier.xml,
OSGI-INF/org.eclipse.chemclipse.chromatogram.filter.system.FilterIonRounding.xml,
OSGI-INF/org.eclipse.chemclipse.chromatogram.filter.system.FilterRetentionIndexQC.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.chemclipse.chromatogram.filter.system.FilterIonRounding">
<service>
<provide interface="org.eclipse.chemclipse.processing.supplier.IProcessTypeSupplier"/>
</service>
<implementation class="org.eclipse.chemclipse.chromatogram.filter.system.FilterIonRounding"/>
</scr:component>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.chemclipse.chromatogram.filter.system.FilterRetentionIndexQC">
<service>
<provide interface="org.eclipse.chemclipse.processing.supplier.IProcessTypeSupplier"/>
</service>
<implementation class="org.eclipse.chemclipse.chromatogram.filter.system.FilterRetentionIndexQC"/>
</scr:component>
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,12 @@
filterName="Scan Targets to References Transfer"
filterSettings="org.eclipse.chemclipse.chromatogram.filter.impl.settings.ScanTargetsToReferencesSettings"
id="org.eclipse.chemclipse.chromatogram.filter.scanTargetsToReferencesTransfer">
</ChromatogramFilterSupplier>
<ChromatogramFilterSupplier
description="This filter sets the system quality control settings."
filter="org.eclipse.chemclipse.chromatogram.filter.impl.ChromatogramFilterQC"
filterName="Quality Control (System)"
filterSettings="org.eclipse.chemclipse.chromatogram.filter.impl.settings.FilterSettingsQC"
id="org.eclipse.chemclipse.chromatogram.filter.setSettingsQC">
</ChromatogramFilterSupplier>
<ChromatogramFilterSupplier
description="This filter sets the system ion round method settings."
filter="org.eclipse.chemclipse.chromatogram.filter.impl.ChromatogramFilterIonRounding"
filterName="Ion Round Method (System)"
filterSettings="org.eclipse.chemclipse.chromatogram.filter.impl.settings.FilterSettingsIonRounding"
id="org.eclipse.chemclipse.chromatogram.filter.setSettingsIonRounding">
</ChromatogramFilterSupplier>
</ChromatogramFilterSupplier>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="org.eclipse.chemclipse.chromatogram.filter.impl.preferences.PreferenceInitializer">
</initializer>
</extension>
</plugin>
</plugin>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
import java.util.Map;

import org.eclipse.chemclipse.chromatogram.filter.Activator;
import org.eclipse.chemclipse.chromatogram.filter.impl.settings.FilterSettingsIonRounding;
import org.eclipse.chemclipse.chromatogram.filter.impl.settings.FilterSettingsQC;
import org.eclipse.chemclipse.chromatogram.filter.impl.settings.FilterSettingsReset;
import org.eclipse.chemclipse.chromatogram.filter.impl.settings.FilterSettingsSelection;
import org.eclipse.chemclipse.chromatogram.filter.impl.settings.PeakTargetsToReferencesSettings;
import org.eclipse.chemclipse.chromatogram.filter.impl.settings.ScanTargetsToPeakSettings;
import org.eclipse.chemclipse.chromatogram.filter.impl.settings.ScanTargetsToReferencesSettings;
import org.eclipse.chemclipse.chromatogram.filter.settings.MaxDetectorFilterSettings;
import org.eclipse.chemclipse.chromatogram.filter.system.SettingsRetentionIndexQC;
import org.eclipse.chemclipse.chromatogram.filter.system.SettingsIonRounding;
import org.eclipse.chemclipse.model.math.IonRoundMethod;
import org.eclipse.chemclipse.support.preferences.IPreferenceSupplier;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
Expand Down Expand Up @@ -140,10 +140,10 @@ public static FilterSettingsReset getFilterSettingsReset() {
return new FilterSettingsReset();
}

public static FilterSettingsIonRounding getFilterSettingsIonRounding() {
public static SettingsIonRounding getFilterSettingsIonRounding() {

IEclipsePreferences preferences = INSTANCE().getPreferences();
FilterSettingsIonRounding settings = new FilterSettingsIonRounding();
SettingsIonRounding settings = new SettingsIonRounding();
try {
settings.setIonRoundMethod(IonRoundMethod.valueOf(preferences.get(P_ION_ROUND_METHOD, DEF_ION_ROUND_METHOD)));
} catch(Exception e) {
Expand All @@ -152,10 +152,10 @@ public static FilterSettingsIonRounding getFilterSettingsIonRounding() {
return settings;
}

public static FilterSettingsQC getFilterSettingsQC() {
public static SettingsRetentionIndexQC getFilterSettingsQC() {

IEclipsePreferences preferences = INSTANCE().getPreferences();
FilterSettingsQC settings = new FilterSettingsQC();
SettingsRetentionIndexQC settings = new SettingsRetentionIndexQC();
settings.setUseRetentionIndexQC(preferences.getBoolean(P_USE_RETENTION_INDEX_QC, DEF_USE_RETENTION_INDEX_QC));
return settings;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*******************************************************************************
* Copyright (c) 2021 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Philip Wenig - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.filter.system;

import java.util.Collection;
import java.util.Collections;

import org.eclipse.chemclipse.model.math.IonRoundMethod;
import org.eclipse.chemclipse.processing.supplier.IProcessSupplier;
import org.eclipse.chemclipse.processing.supplier.IProcessTypeSupplier;
import org.eclipse.chemclipse.processing.supplier.ProcessExecutionContext;
import org.eclipse.chemclipse.processing.system.AbstractSystemProcessSettings;
import org.eclipse.chemclipse.processing.system.AbstractSystemProcessSupplier;
import org.eclipse.chemclipse.processing.system.ISystemProcessSettings;
import org.osgi.service.component.annotations.Component;

@Component(service = {IProcessTypeSupplier.class})
public class FilterIonRounding extends AbstractSystemProcessSettings {

private static final String ID = "org.eclipse.chemclipse.chromatogram.filter.system.ionRounding";
private static final String NAME = "Ion Round Method";
private static final String DESCRIPTION = "This filter sets the system ion round method settings.";

@Override
public Collection<IProcessSupplier<?>> getProcessorSuppliers() {

return Collections.singleton(new ProcessSupplier(this));
}

private static final class ProcessSupplier extends AbstractSystemProcessSupplier<SettingsIonRounding> {

public ProcessSupplier(IProcessTypeSupplier parent) {

super(ID, NAME, DESCRIPTION, SettingsIonRounding.class, parent);
}

@Override
public void executeUserSettings(ISystemProcessSettings settings, ProcessExecutionContext context) throws Exception {

if(settings instanceof SettingsIonRounding) {
SettingsIonRounding processSettings = (SettingsIonRounding)settings;
IonRoundMethod.setActive(processSettings.getIonRoundMethod());
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*******************************************************************************
* Copyright (c) 2021 Lablicate GmbH.
*
* All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Philip Wenig - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.filter.system;

import java.util.Collection;
import java.util.Collections;

import org.eclipse.chemclipse.processing.supplier.IProcessSupplier;
import org.eclipse.chemclipse.processing.supplier.IProcessTypeSupplier;
import org.eclipse.chemclipse.processing.supplier.ProcessExecutionContext;
import org.eclipse.chemclipse.processing.system.AbstractSystemProcessSettings;
import org.eclipse.chemclipse.processing.system.AbstractSystemProcessSupplier;
import org.eclipse.chemclipse.processing.system.ISystemProcessSettings;
import org.osgi.service.component.annotations.Component;

@Component(service = {IProcessTypeSupplier.class})
public class FilterRetentionIndexQC extends AbstractSystemProcessSettings {

private static final String ID = "org.eclipse.chemclipse.chromatogram.filter.system.retentionIndexQualityControl";
private static final String NAME = "Quality Control - Retention Index";
private static final String DESCRIPTION = "This filter sets the system quality control settings.";

@Override
public Collection<IProcessSupplier<?>> getProcessorSuppliers() {

return Collections.singleton(new ProcessSupplier(this));
}

private static final class ProcessSupplier extends AbstractSystemProcessSupplier<SettingsRetentionIndexQC> {

public ProcessSupplier(IProcessTypeSupplier parent) {

super(ID, NAME, DESCRIPTION, SettingsRetentionIndexQC.class, parent);
}

@Override
public void executeUserSettings(ISystemProcessSettings settings, ProcessExecutionContext context) throws Exception {

if(settings instanceof SettingsRetentionIndexQC) {
SettingsRetentionIndexQC processSettings = (SettingsRetentionIndexQC)settings;
org.eclipse.chemclipse.model.preferences.PreferenceSupplier.setUseRetentionIndexQC(processSettings.isUseRetentionIndexQC());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
* Contributors:
* Philip Wenig - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.filter.impl.settings;
package org.eclipse.chemclipse.chromatogram.filter.system;

import org.eclipse.chemclipse.chromatogram.filter.settings.AbstractChromatogramFilterSettings;
import org.eclipse.chemclipse.model.math.IonRoundMethod;
import org.eclipse.chemclipse.processing.system.ISystemProcessSettings;
import org.eclipse.chemclipse.support.settings.EnumSelectionSettingProperty;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;

public class FilterSettingsIonRounding extends AbstractChromatogramFilterSettings {
public class SettingsIonRounding implements ISystemProcessSettings {

@JsonProperty(value = "Ion Round Method", defaultValue = "DEFAULT")
@JsonPropertyDescription(value = "Set the used m/z round method on a system level.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
* Contributors:
* Philip Wenig - initial API and implementation
*******************************************************************************/
package org.eclipse.chemclipse.chromatogram.filter.impl.settings;
package org.eclipse.chemclipse.chromatogram.filter.system;

import org.eclipse.chemclipse.chromatogram.filter.settings.AbstractChromatogramFilterSettings;
import org.eclipse.chemclipse.processing.system.ISystemProcessSettings;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;

public class FilterSettingsQC extends AbstractChromatogramFilterSettings {
public class SettingsRetentionIndexQC implements ISystemProcessSettings {

@JsonProperty(value = "QC: Use Retention Index", defaultValue = "false")
@JsonPropertyDescription(value = "Set this system value to use retention indices for quality control purposes.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Export-Package: org.eclipse.chemclipse.processing;version="1.0.0",
org.eclipse.chemclipse.processing.filter;version="1.0.0",
org.eclipse.chemclipse.processing.methods;version="1.0.0",
org.eclipse.chemclipse.processing.procedures;version="1.0.0",
org.eclipse.chemclipse.processing.supplier;version="1.0.0"
org.eclipse.chemclipse.processing.supplier;version="1.0.0",
org.eclipse.chemclipse.processing.system
Import-Package: org.eclipse.chemclipse.support.settings,
org.eclipse.chemclipse.support.settings.parser,
org.eclipse.chemclipse.support.settings.serialization,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019 Lablicate GmbH.
* Copyright (c) 2019, 2021 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 @@ -8,10 +8,11 @@
*
* Contributors:
* Christoph Läubrich - initial API and implementation
* Philip Wenig - code style
*******************************************************************************/
package org.eclipse.chemclipse.processing.supplier;

public interface ProcessExecutor {

<X> void execute(ProcessorPreferences<X> preferences, ProcessExecutionContext context) throws Exception;
}
}
Loading

0 comments on commit 413ac6d

Please sign in to comment.