| /** |
| * |
| * 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 v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| */ |
| package org.eclipse.osbp.preferences.ui.page; |
| |
| import java.util.ArrayList; |
| |
| import org.apache.commons.lang3.reflect.FieldUtils; |
| 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; |
| import org.eclipse.osbp.preferences.ui.data.ProductConfigurationStore; |
| |
| public class PreferencePageVerifyDependencies extends APreferencePage { |
| |
| public PreferencePageVerifyDependencies() { |
| super( |
| "verifyDependencies", |
| "verifyDependencies" |
| ); |
| noDefaultAndApplyButton(); |
| } |
| |
| @Override |
| protected Item[] initializeItems() { |
| return new Item[] { |
| new Item(Type.TEXT, Preference.SHOW_PRODUCT_CONFIGURATION, "Product Configuration", false), |
| new Item(""), |
| new Item(Type.TREE_PRODUCTCONFIGURATION, Preference.PRODUCTCONFIGURATION, "Product Bundle Configuration"), |
| }; |
| } |
| |
| protected void refresh() { |
| // force reload the of product preferences |
| ProductConfigurationStore.instance().getProductConfigurationPrefs().forceReloadConfiguration(); |
| try { |
| // load any contained field editors, to force re-verifying the configuration files |
| Object value = FieldUtils.readField(this, "fields", true); |
| if ((value instanceof ArrayList<?>) && !((ArrayList<?>)value).isEmpty()) { |
| for (FieldEditor editor : (ArrayList<FieldEditor>)value) { |
| editor.load(); |
| } |
| } |
| } |
| catch (IllegalAccessException e) { |
| e.printStackTrace(); |
| } |
| } |
| |
| /** |
| * every time the property page gets visible - again - the configuration files will verification will be refreshed. |
| */ |
| @Override |
| public void setVisible(boolean visible) { |
| if (!getControl().isVisible() && visible) { |
| refresh(); |
| } |
| super.setVisible(visible); |
| } |
| } |