Merge branch 'release/3.12.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / preference / BulkEditorMarkerPreferencePage.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.bulkeditor.preference;
12
13 import org.eclipse.jface.preference.BooleanFieldEditor;
14 import org.eclipse.jface.preference.FieldEditorPreferencePage;
15 import org.eclipse.ui.IWorkbench;
16 import org.eclipse.ui.IWorkbenchPreferencePage;
17
18 import eu.etaxonomy.cdm.model.common.MarkerType;
19 import eu.etaxonomy.taxeditor.model.MessagingUtils;
20 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
21 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
22 import eu.etaxonomy.taxeditor.store.CdmStore;
23 import eu.etaxonomy.taxeditor.store.TermStore;
24
25 /**
26 * @author p.ciardelli
27 * @created 17.08.2009
28 * @version 1.0
29 */
30 public class BulkEditorMarkerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
31
32
33 @Override
34 public void init(IWorkbench workbench) {
35 setPreferenceStore(PreferencesUtil.getPreferenceStore());
36 if(!CdmStore.isActive()) {
37 MessagingUtils.noDataSourceWarningDialog(null);
38 }
39 }
40
41 @Override
42 protected void createFieldEditors() {
43 if(CdmStore.isActive()){
44 for (final MarkerType markerType : TermStore.getTerms(MarkerType.class)) {
45 addField(new BooleanFieldEditor(IPreferenceKeys.EDIT_MARKER_TYPE_PREFIX
46 + markerType.getClass().getName() + markerType.getLabel(), String.format("Edit '%s' markers",
47 markerType.getLabel()), getFieldEditorParent()));
48 }
49 }
50
51 }
52 }