blob: 8394f4dae27283da0743d94f7aae2771dbffcfc2 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*/
package org.eclipse.osbp.preferences.ui.page;
import java.util.regex.Pattern;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.osbp.preferences.Preference;
import org.eclipse.osbp.preferences.ui.component.APreferencePage;
import org.eclipse.osbp.preferences.ui.component.Item;
import org.eclipse.osbp.preferences.ui.component.Type;
public class PreferencePageExternalDataSources extends APreferencePage {
public PreferencePageExternalDataSources() {
super(
"externalDataSources",
"external data sources"
);
}
@Override
protected Item[] initializeItems() {
return new Item[] {
new Item(Type.TEXT, Preference.SHOW_PRODUCT_CONFIGURATION, "Product Configuration", false),
new Item(""),
new Item("URL for external XML file provider for Euro based exchange rates"),
new Item(Type.TEXT, Preference.EXCHANGE_RATES_EURO_BASED_PREVIOUS, "All historic"),
new Item(Type.TEXT, Preference.EXCHANGE_RATES_EURO_BASED_DAILY, "Actual day"),
new Item(""),
new Item("JavaPOS Settings"),
new Item(Type.TEXT, Preference.JAVA_POS_CONFIGURATION, "Configuration file"),
new Item(""),
new Item("DataInterchange Settings"),
new Item(Type.TEXT, Preference.DATAINTERCHANGE_CONFIGURATION, "Configuration file"),
new Item(""),
new Item("Signal Settings"),
new Item(Type.TEXT, Preference.SIGNAL_CONFIGURATION, "Configuration file"),
};
}
@Override
public boolean doCheckState(FieldEditor editor, String input) {
switch (Preference.by(editor.getPreferenceName())) {
case EXCHANGE_RATES_EURO_BASED_DAILY:
case EXCHANGE_RATES_EURO_BASED_PREVIOUS:
return Pattern.matches(REGEX_URL_XML_FILE, input);
}
return true;
}
}