-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit bfaf0d3 Author: Christoph Läubrich <[email protected]> Date: Mon Sep 30 10:19:05 2019 +0200 Fix #42 commit a6a2a59 Author: Christoph Läubrich <[email protected]> Date: Sun Sep 29 19:19:43 2019 +0200 #39 add option to use a preference page instead of a button commit f92601d Author: Christoph Läubrich <[email protected]> Date: Sun Sep 29 18:13:05 2019 +0200 Fix #36 commit 97ac273 Author: Christoph Läubrich <[email protected]> Date: Sun Sep 29 14:49:03 2019 +0200 Fix #39 commit 8f3aa74 Author: Christoph Läubrich <[email protected]> Date: Fri Sep 27 15:14:28 2019 +0200 Fix #33 commit 5b0845d Author: Christoph Läubrich <[email protected]> Date: Fri Sep 27 15:00:11 2019 +0200 Fix #32 commit 7e18420 Author: Christoph Läubrich <[email protected]> Date: Fri Sep 27 08:31:32 2019 +0200 Fix #31 commit 8a26934 Author: Christoph Läubrich <[email protected]> Date: Fri Sep 27 07:51:44 2019 +0200 Refactoring to support #31 commit b8aad6a Author: Christoph Läubrich <[email protected]> Date: Thu Sep 26 19:40:47 2019 +0200 Refactoring to support #31
- Loading branch information
1 parent
b8919e7
commit b9788db
Showing
44 changed files
with
1,630 additions
and
853 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...e/plugins/org.eclipse.chemclipse.converter/.settings/org.eclipse.pde.ds.annotations.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
eclipse.preferences.version=1 | ||
enabled=true | ||
generateBundleActivationPolicyLazy=true | ||
path=OSGI-INF | ||
validationErrorLevel=error | ||
validationErrorLevel.missingImplicitUnbindMethod=error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...converter/OSGI-INF/org.eclipse.chemclipse.converter.methods.MethodProcessTypeSupplier.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.converter.methods.MethodProcessTypeSupplier"> | ||
<service> | ||
<provide interface="org.eclipse.chemclipse.processing.supplier.IProcessTypeSupplier"/> | ||
</service> | ||
<implementation class="org.eclipse.chemclipse.converter.methods.MethodProcessTypeSupplier"/> | ||
</scr:component> |
87 changes: 87 additions & 0 deletions
87
...pse.converter/src/org/eclipse/chemclipse/converter/methods/MethodProcessTypeSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 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: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.chemclipse.converter.methods; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.eclipse.chemclipse.model.core.IMeasurement; | ||
import org.eclipse.chemclipse.model.methods.IProcessEntry; | ||
import org.eclipse.chemclipse.model.methods.IProcessMethod; | ||
import org.eclipse.chemclipse.model.selection.IChromatogramSelection; | ||
import org.eclipse.chemclipse.model.supplier.IChromatogramSelectionProcessSupplier; | ||
import org.eclipse.chemclipse.model.supplier.IMeasurementProcessSupplier; | ||
import org.eclipse.chemclipse.model.types.DataType; | ||
import org.eclipse.chemclipse.processing.DataCategory; | ||
import org.eclipse.chemclipse.processing.supplier.AbstractProcessSupplier; | ||
import org.eclipse.chemclipse.processing.supplier.IProcessSupplier; | ||
import org.eclipse.chemclipse.processing.supplier.IProcessTypeSupplier; | ||
import org.eclipse.chemclipse.processing.supplier.ProcessExecutionContext; | ||
import org.osgi.service.component.annotations.Component; | ||
|
||
@Component(service = {IProcessTypeSupplier.class}) | ||
public class MethodProcessTypeSupplier implements IProcessTypeSupplier { | ||
|
||
@Override | ||
public String getCategory() { | ||
|
||
return "User Methods"; | ||
} | ||
|
||
@Override | ||
public Collection<IProcessSupplier<?>> getProcessorSuppliers() { | ||
|
||
List<IProcessSupplier<?>> list = new ArrayList<>(); | ||
Collection<IProcessMethod> userMethods = MethodConverter.getUserMethods(); | ||
for(IProcessMethod processMethod : userMethods) { | ||
list.add(new MethodProcessSupplier(processMethod, this)); | ||
} | ||
return list; | ||
} | ||
|
||
private static final class MethodProcessSupplier extends AbstractProcessSupplier<Void> implements IMeasurementProcessSupplier<Void>, IChromatogramSelectionProcessSupplier<Void> { | ||
|
||
private IProcessMethod method; | ||
|
||
public MethodProcessSupplier(IProcessMethod method, IProcessTypeSupplier parent) { | ||
super("ProcessMethod." + method.getUUID(), method.getName(), method.getDescription(), null, parent, getDataTypes(method)); | ||
this.method = method; | ||
} | ||
|
||
@Override | ||
public IChromatogramSelection<?, ?> apply(IChromatogramSelection<?, ?> chromatogramSelection, Void processSettings, ProcessExecutionContext context) { | ||
|
||
return IChromatogramSelectionProcessSupplier.applyProcessMethod(chromatogramSelection, method, context); | ||
} | ||
|
||
@Override | ||
public Collection<? extends IMeasurement> applyProcessor(Collection<? extends IMeasurement> measurements, Void processSettings, ProcessExecutionContext context) { | ||
|
||
return IMeasurementProcessSupplier.applyProcessMethod(measurements, method, context); | ||
} | ||
} | ||
|
||
private static DataCategory[] getDataTypes(IProcessMethod method) { | ||
|
||
Set<DataCategory> categories = new HashSet<>(); | ||
for(IProcessEntry entry : method) { | ||
List<DataType> dataTypes = entry.getSupportedDataTypes(); | ||
for(DataType dataType : dataTypes) { | ||
categories.add(dataType.toDataCategory()); | ||
} | ||
} | ||
return categories.toArray(new DataCategory[0]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
...ipse.model/src/org/eclipse/chemclipse/model/methods/ProcessEntryProcessorPreferences.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019 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: | ||
* Christoph Läubrich - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.chemclipse.model.methods; | ||
|
||
import org.eclipse.chemclipse.processing.supplier.IProcessSupplier; | ||
import org.eclipse.chemclipse.processing.supplier.ProcessorPreferences; | ||
|
||
public final class ProcessEntryProcessorPreferences<T> implements ProcessorPreferences<T> { | ||
|
||
private IProcessEntry processEntry; | ||
private IProcessSupplier<T> supplier; | ||
|
||
public ProcessEntryProcessorPreferences(IProcessSupplier<T> supplier, IProcessEntry processEntry) { | ||
this.supplier = supplier; | ||
this.processEntry = processEntry; | ||
} | ||
|
||
@Override | ||
public DialogBehavior getDialogBehaviour() { | ||
|
||
return DialogBehavior.NONE; | ||
} | ||
|
||
@Override | ||
public void setAskForSettings(boolean askForSettings) { | ||
|
||
// no-op | ||
} | ||
|
||
@Override | ||
public void setUserSettings(String settings) { | ||
|
||
processEntry.setJsonSettings(settings); | ||
} | ||
|
||
@Override | ||
public boolean isUseSystemDefaults() { | ||
|
||
if(supplier.getSettingsClass() == null) { | ||
return true; | ||
} | ||
String jsonSettings = processEntry.getJsonSettings(); | ||
return jsonSettings == null || jsonSettings.isEmpty() || ProcessEntry.EMPTY_JSON_SETTINGS.equals(jsonSettings); | ||
} | ||
|
||
@Override | ||
public void setUseSystemDefaults(boolean useSystemDefaults) { | ||
|
||
if(useSystemDefaults) { | ||
processEntry.setJsonSettings(ProcessEntry.EMPTY_JSON_SETTINGS); | ||
} | ||
} | ||
|
||
@Override | ||
public void reset() { | ||
|
||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public IProcessSupplier<T> getSupplier() { | ||
|
||
return supplier; | ||
} | ||
|
||
@Override | ||
public String getUserSettingsAsString() { | ||
|
||
return processEntry.getJsonSettings(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.