From: Katja Luther Date: Thu, 20 Oct 2016 12:26:18 +0000 (+0200) Subject: add the nameDetails configuration X-Git-Tag: 4.4.0^2~91 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/f32ec72f5e7c2ff63d0859cedd1a42eb94c1bb3b add the nameDetails configuration --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java new file mode 100755 index 000000000..a24eac024 --- /dev/null +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java @@ -0,0 +1,226 @@ +package eu.etaxonomy.taxeditor.preference; + + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.jface.preference.PreferencePage; + + +public class NameDetailsViewConfiguration extends PreferencePage implements IWorkbenchPreferencePage { + boolean isSimpleDetailsViewActivated; + Composite child ; + @Override + public void init(IWorkbench workbench) { + + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors + * () + */ + @Override + protected Control createContents(Composite parent) { + + Composite composite = new Composite(parent, SWT.NULL); + composite.setLayout(new GridLayout()); + isSimpleDetailsViewActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION); + final Button activateCheckButton = new Button(composite, SWT.CHECK); + activateCheckButton.setText("Show only a simple name details view"); + activateCheckButton.setSelection(isSimpleDetailsViewActivated); + activateCheckButton.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + isSimpleDetailsViewActivated = activateCheckButton.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated); + if(isSimpleDetailsViewActivated){ + child.setVisible(true); + child.setEnabled(true); + }else{ + child.setVisible(false); + child.setEnabled(false); + } + } + }); + + child = new Composite(composite, SWT.NULL); + child.setLayout(new GridLayout()); + child.setVisible(isSimpleDetailsViewActivated); + + final Button showTaxon = new Button(child, SWT.CHECK); + boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON); + showTaxon.setText("Show taxon of the name"); + showTaxon.setSelection(isShowTaxon); + showTaxon.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowTaxon = showTaxon.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon); + } + }); + + final Button showLsid = new Button(child, SWT.CHECK); + boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID); + showLsid.setText("Show Lsid of the name"); + showLsid.setSelection(isShowLSID); + showLsid.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowLSID = showLsid.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID); + } + }); + + final Button showNomenclaturalCode = new Button(child, SWT.CHECK); + boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE); + showNomenclaturalCode.setText("Show the nomenclatural code"); + showNomenclaturalCode.setSelection(isShowNomenclaturalCode); + showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowNomenclaturalCode = showNomenclaturalCode.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode); + } + }); + + final Button showNameCache = new Button(child, SWT.CHECK); + boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE); + showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)"); + showNameCache.setSelection(isShowNomenclaturalCode); + showNameCache.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowNameCache = showNameCache.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache); + } + }); + final Button showAppendedPhrase = new Button(child, SWT.CHECK); + boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE); + showAppendedPhrase.setText("Show appended phrase"); + showAppendedPhrase.setSelection(isShowAppendedPhrase); + showAppendedPhrase.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowAppendedPhrase = showAppendedPhrase.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowAppendedPhrase); + } + }); + + final Button showRank = new Button(child, SWT.CHECK); + boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK); + showRank.setText("Show rank of the name"); + showRank.setSelection(isShowRank); + showRank.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowRank = showRank.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank); + } + }); + final Button showEpithets = new Button(child, SWT.CHECK); + boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS); + showEpithets.setText("Show atomised epithets"); + showEpithets.setSelection(isShowEpithets); + showEpithets.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowEpithets = showEpithets.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets); + } + }); + final Button showAuthorship = new Button(child, SWT.CHECK); + boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP); + showAuthorship.setText("Show authorship section"); + showAuthorship.setSelection(isShowAuthorship); + showAuthorship.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowAuthorship = showAuthorship.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship); + } + }); + + final Button showNomenclaturalRef = new Button(child, SWT.CHECK); + boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE); + showNomenclaturalRef.setText("Show nomenclatural reference section"); + showNomenclaturalRef.setSelection(isShowNomenclaturalRef); + showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowNomenclaturalRef = showNomenclaturalRef.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef); + } + }); + + final Button showNomenclaturalStatus = new Button(child, SWT.CHECK); + boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS); + showNomenclaturalStatus.setText("Show nomenclatural status section"); + showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus); + showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus); + } + }); + + final Button showProtologue = new Button(child, SWT.CHECK); + boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE); + showProtologue.setText("Show protologue section"); + showProtologue.setSelection(isShowProtologue); + showProtologue.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowProtologue = showProtologue.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue); + } + }); + + final Button showTypeDesignation = new Button(child, SWT.CHECK); + boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION); + showTypeDesignation.setText("Show name type designation section"); + showTypeDesignation.setSelection(isShowTypeDesignation); + showTypeDesignation.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowTypeDesignation = showTypeDesignation.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation); + } + }); + + + final Button showNameRelationship = new Button(child, SWT.CHECK); + boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP); + showNameRelationship.setText("Show name relationship section"); + showNameRelationship.setSelection(isShowNameRelationship); + showNameRelationship.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean isShowNameRelationship = showNameRelationship.getSelection(); + PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowNameRelationship); + } + }); + + if(isSimpleDetailsViewActivated){ + child.setEnabled(true); + }else{ + child.setEnabled(false); + } + + return composite; + + + + } + +}