From: Patric Plitzner Date: Tue, 26 May 2015 07:04:04 +0000 (+0000) Subject: - added id to entity selection dialogs (#4799) X-Git-Tag: 3.6.0~24^2~21 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/22cb603825dec922afa5ae4b0014642f872666ff - added id to entity selection dialogs (#4799) --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java index c34d4b7e0..337849c0f 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java @@ -50,6 +50,11 @@ public interface IPreferenceKeys { */ public static final String SHOW_DEBUG_INFORMATION = "eu.etaxonomy.taxeditor.showDebugInformation"; + /** + * Whether to show UUID and database id in the supplemental data view. + */ + public static final String SHOW_ID_IN_ENTITY_SELECTION_DIAOLOG = "eu.etaxonomy.taxeditor.showIdInEntitySelectionDiaolog"; + /** * */ @@ -91,7 +96,7 @@ public interface IPreferenceKeys { public static final String SORT_RANKS_HIERARCHICHALLY = "eu.etaxonomy.taxeditor.menus.sortRanksHierarchichally"; /** Constant SORT_NODES_NATURALL="eu.etaxonomy.taxeditor.menus.sortNodesN"{trunked} */ public static final String SORT_NODES_NATURALLY = "eu.etaxonomy.taxeditor.menus.sortNodesNaturally"; - + /** * Whether multilanguage text fields should be editable in multiple languages. */ diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java index 08a1a3673..cae829782 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java @@ -40,6 +40,9 @@ public class TaxonomicEditorGeneralPreferences extends addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_DEBUG_INFORMATION, "Show UUID and object ID in supplemental data view.", getFieldEditorParent())); + addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_ID_IN_ENTITY_SELECTION_DIAOLOG, + "Show object id in entity selection dialogs.", + getFieldEditorParent())); addField(new BooleanFieldEditor( IPreferenceKeys.SHOULD_EXPAND_SECTION_WHEN_DATA_AVAILABLE, "Should expand sections when data is available (Details View). This might make the Editor slow.", diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java index dcb689d0e..b70352309 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java @@ -1,9 +1,9 @@ // $Id$ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -49,6 +49,8 @@ import eu.etaxonomy.cdm.model.common.UuidAndTitleCache; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; import eu.etaxonomy.taxeditor.model.MessagingUtils; import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard; +import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; +import eu.etaxonomy.taxeditor.preference.PreferencesUtil; import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; /** @@ -66,14 +68,14 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog> model; private final Set transientCdmObjects = new HashSet(); private final String settings; - + protected T cdmBaseToBeFiltered; - + /** *

Constructor for AbstractFilteredCdmResourceSelectionDialog.

* * @param shell a {@link org.eclipse.swt.widgets.Shell} object. - * @param conversation + * @param conversation * @param title a {@link java.lang.String} object. * @param multi a boolean. * @param settings a {@link java.lang.String} object. @@ -85,29 +87,29 @@ public abstract class AbstractFilteredCdmResourceSelectionDialoggetSelectionFromDialog

* @@ -140,18 +142,18 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog TYPE getSelectionFromDialog(AbstractFilteredCdmResourceSelectionDialog dialog) { //dialog.setInitialPattern(""); int result = dialog.open(); - + if (result == Window.CANCEL) { return null; } - + UUID uuid = dialog.getSelectedUuidAndTitleCache().getUuid(); if(uuid == null){ return null; - } + } return dialog.getCdmObjectByUuid(uuid); } - + /** * Check if object was created during the life of this dialog. If not, * retrieve it from the CdmStore. @@ -167,7 +169,7 @@ public abstract class AbstractFilteredCdmResourceSelectionDialoggetPersistentObject

* @@ -204,16 +206,16 @@ public abstract class AbstractFilteredCdmResourceSelectionDialoginitModel

*/ @@ -243,7 +245,7 @@ public abstract class AbstractFilteredCdmResourceSelectionDialog element : model){ contentProvider.add(element, itemsFilter); @@ -371,7 +373,7 @@ public abstract class AbstractFilteredCdmResourceSelectionDialoggetSelectedUuidAndTitleCache

* @@ -381,7 +383,7 @@ public abstract class AbstractFilteredCdmResourceSelectionDialogGetter for the field settings.

* @@ -393,9 +395,9 @@ public abstract class AbstractFilteredCdmResourceSelectionDialoggetNewWizardLinkText

* * @return a {@link java.lang.String} object. */ protected abstract String getNewWizardLinkText(); - + /** *

getNewEntityWizard

- * @param parameter + * @param parameter * @return a {@link eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard} object. */ protected abstract AbstractNewEntityWizard getNewEntityWizard(String parameter); - + public class FilteredCdmResourceLabelProvider extends LabelProvider { @Override public String getText(Object element) { if (element == null) { return null; } - return ((UuidAndTitleCache) element).getTitleCache(); - } + UuidAndTitleCache uuidAndTitleCache = (UuidAndTitleCache) element; + String titleCache = uuidAndTitleCache.getTitleCache(); + if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_DEBUG_INFORMATION)){ + titleCache += " ["+uuidAndTitleCache.getId()+"]"; + } + return titleCache; + } }; /* (non-Javadoc) @@ -457,10 +464,10 @@ public abstract class AbstractFilteredCdmResourceSelectionDialoggetConversationHolder

* @@ -497,26 +504,26 @@ public abstract class AbstractFilteredCdmResourceSelectionDialogcdmBaseToBeFiltered) * so it is not available in the filtered list. */ private void filterExcludedObjects() { if (model != null && cdmBaseToBeFiltered != null) { - + UuidAndTitleCache uuidAndTitleCacheToRemove = null; - + for (UuidAndTitleCache uuidAndTitleCache : model){ if ((cdmBaseToBeFiltered.getUuid()).equals(uuidAndTitleCache.getUuid())) { uuidAndTitleCacheToRemove = uuidAndTitleCache; - } + } } model.remove(uuidAndTitleCacheToRemove); }