-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed #184 - Time Ratio Classifier - upgrade to new editor style
- Loading branch information
1 parent
98d9f4c
commit 8feba74
Showing
8 changed files
with
581 additions
and
351 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
56 changes: 56 additions & 0 deletions
56
.../openchrom/xxd/classifier/supplier/ratios/ui/adapter/TimeRatioSettingsAdapterFactory.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,56 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 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 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Philip Wenig - initial API and implementation | ||
*******************************************************************************/ | ||
package net.openchrom.xxd.classifier.supplier.ratios.ui.adapter; | ||
|
||
import java.io.IOException; | ||
|
||
import org.eclipse.chemclipse.processing.supplier.ProcessorPreferences; | ||
import org.eclipse.chemclipse.ux.extension.xxd.ui.methods.SettingsUIProvider; | ||
import org.eclipse.core.runtime.IAdapterFactory; | ||
import org.eclipse.swt.widgets.Composite; | ||
|
||
import net.openchrom.xxd.classifier.supplier.ratios.settings.TimeRatioSettings; | ||
import net.openchrom.xxd.classifier.supplier.ratios.ui.swt.TimeRatioListEditor; | ||
|
||
public class TimeRatioSettingsAdapterFactory implements IAdapterFactory { | ||
|
||
@Override | ||
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { | ||
|
||
if(adaptableObject instanceof TimeRatioSettings) { | ||
TimeRatioSettings settings = (TimeRatioSettings)adaptableObject; | ||
if(adapterType == SettingsUIProvider.class) { | ||
return adapterType.cast(createSettingsUIProvider(settings)); | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
private static SettingsUIProvider<TimeRatioSettings> createSettingsUIProvider(TimeRatioSettings adaptedSettings) { | ||
|
||
return new SettingsUIProvider<TimeRatioSettings>() { | ||
|
||
@Override | ||
public SettingsUIProvider.SettingsUIControl createUI(Composite parent, ProcessorPreferences<TimeRatioSettings> preferences, boolean showProfileToolbar) throws IOException { | ||
|
||
TimeRatioSettings userSettings = preferences.getUserSettings(); | ||
return new TimeRatioListEditor(parent, preferences, userSettings == null ? adaptedSettings : userSettings); | ||
} | ||
}; | ||
} | ||
|
||
@Override | ||
public Class<?>[] getAdapterList() { | ||
|
||
return new Class<?>[]{SettingsUIProvider.class}; | ||
} | ||
} |
Oops, something went wrong.