Project

General

Profile

« Previous | Next » 

Revision 0aeb6eff

Added by Patrick Plitzner over 6 years ago

Double click on taxon search opens Name Editor #5689

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java
25 25
import org.eclipse.ui.PlatformUI;
26 26
import org.eclipse.ui.navigator.CommonViewer;
27 27

  
28
import eu.etaxonomy.cdm.api.service.ITaxonService;
28 29
import eu.etaxonomy.cdm.model.common.ICdmBase;
29 30
import eu.etaxonomy.cdm.model.description.PolytomousKey;
30 31
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
......
33 34
import eu.etaxonomy.cdm.model.taxon.Taxon;
34 35
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
35 36
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
37
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
36 38
import eu.etaxonomy.taxeditor.editor.EditorUtil;
37 39
import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
38 40
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
......
41 43
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
42 44
import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
43 45
import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
46
import eu.etaxonomy.taxeditor.store.CdmStore;
44 47
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
45 48

  
46 49
/**
......
58 61
	 *
59 62
	 * @param selectedObject a {@link eu.etaxonomy.cdm.model.common.CdmBase} object.
60 63
	 */
64
	public static void openEditor(UuidAndTitleCache uuidAndTitleCache){
65
	    TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(uuidAndTitleCache.getUuid());
66
	    if(taxonBase==null){
67
	        MessagingUtils.warn(NavigationUtil.class, "No taxon stored with UUID "+uuidAndTitleCache.getUuid());
68
	        return;
69
	    }
70
	    openEditor(taxonBase);
71
	}
61 72
	public static void openEditor(ICdmBase selectedObject){
62 73
		UUID entityUuid = selectedObject.getUuid();
63 74
		try {
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java
21 21
import org.eclipse.jface.viewers.ArrayContentProvider;
22 22
import org.eclipse.jface.viewers.DoubleClickEvent;
23 23
import org.eclipse.jface.viewers.IDoubleClickListener;
24
import org.eclipse.jface.viewers.ISelection;
24 25
import org.eclipse.jface.viewers.IStructuredSelection;
25 26
import org.eclipse.jface.viewers.TableViewer;
26 27
import org.eclipse.swt.SWT;
......
46 47
import eu.etaxonomy.taxeditor.model.AbstractUtility;
47 48
import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
48 49
import eu.etaxonomy.taxeditor.model.IContextListener;
50
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
49 51
import eu.etaxonomy.taxeditor.navigation.search.SearchBar.SearchOption;
50 52
import eu.etaxonomy.taxeditor.store.CdmStore;
51
import eu.etaxonomy.taxeditor.view.CdmViewerChooser;
52 53

  
53 54
/**
54 55
 * <p>SearchResultView class.</p>
......
117 118
		resultViewer.addDoubleClickListener(new IDoubleClickListener() {
118 119
			@Override
119 120
            public void doubleClick(DoubleClickEvent event) {
120
			    if(event.getSelection() instanceof IStructuredSelection){
121
			        Object selectedObject = ((IStructuredSelection) event.getSelection()).getFirstElement();
122
			        CdmViewerChooser chooser = new CdmViewerChooser(getSite().getShell());
123
			        chooser.chooseViewer(selectedObject);
121
			    ISelection selection = event.getSelection();
122
			    if(selection instanceof IStructuredSelection){
123
			        Object firstElement = ((IStructuredSelection) selection).getFirstElement();
124
			        if(firstElement instanceof UuidAndTitleCache){
125
			            NavigationUtil.openEditor((UuidAndTitleCache) firstElement);
126
			        }
124 127
			    }
125 128
			}
126 129
		});

Also available in: Unified diff