Project

General

Profile

« Previous | Next » 

Revision 2abe4473

Added by Katja Luther almost 7 years ago

workaround to show media and facts view for derivateView

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
35 35
import org.eclipse.swt.widgets.Tree;
36 36
import org.eclipse.ui.IWorkbenchActionConstants;
37 37
import org.eclipse.ui.IWorkbenchPart;
38
import org.eclipse.ui.internal.E4PartWrapper;
38 39

  
39 40
import eu.etaxonomy.cdm.model.common.CdmBase;
40 41
import eu.etaxonomy.cdm.model.description.DescriptionBase;
......
153 154
	/** {@inheritDoc} */
154 155
	@Override
155 156
    protected void selectionChanged_internal(IWorkbenchPart part, ISelection selection) {
156
		if(AbstractUtility.getActiveE4Editor() == null){
157
			showEmptyPage();
158
			return;
159
		}
157
//		if(AbstractUtility.getActiveE4Editor() == null){
158
//			showEmptyPage();
159
//			return;
160
//		}
160 161

  
161 162
		if(part == this){
162 163
		    return;
......
168 169
            return;
169 170
        }
170 171
		// unpackage TreeNode of DerivateView
171
		else if(part instanceof DerivateView){
172
		else if(part instanceof E4PartWrapper && ((E4PartWrapper)part).getPartName().equals("%command.label.DERIVATIVE_EDITOR")){
172 173
		    TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(selection);
173 174
		    if(treeNodeOfSelection!=null){
174 175
		        selection = new StructuredSelection(treeNodeOfSelection.getValue());
176
		        showViewer(part, (IStructuredSelection) selection);
177
			    return;
175 178
		    }
176 179
		}
177 180
        else if(part instanceof ChecklistEditor){
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/CreateDescriptionHandler.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.editor.view.descriptive.handler;
10 10

  
11
import java.util.Collection;
12

  
11 13
import org.eclipse.core.commands.AbstractHandler;
12 14
import org.eclipse.core.commands.ExecutionEvent;
13 15
import org.eclipse.core.commands.ExecutionException;
......
51 53
		IPostOperationEnabled postOperationEnabled = (part instanceof IPostOperationEnabled) ? (IPostOperationEnabled) part : null;
52 54

  
53 55
		IEditorPart editor = HandlerUtil.getActiveEditor(event);
56
		
54 57
		if (editor instanceof FormEditor) {
55 58
			editor = ((FormEditor) editor).getActiveEditor();
56 59
		}
57
		IEditorInput input = editor.getEditorInput();
60
		Object input;
61
		if (editor == null && part instanceof DescriptiveViewPart){
62
			input =  ((DescriptiveViewPart)part).getViewer().getInput();
63
		}else{
64
			input = editor.getEditorInput();
65
		}
58 66
		AbstractPostOperation<?> operation;
59 67

  
60 68
		// taxon description
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/media/MediaViewPart.java
24 24
import org.eclipse.swt.widgets.Tree;
25 25
import org.eclipse.ui.IWorkbenchActionConstants;
26 26
import org.eclipse.ui.IWorkbenchPart;
27
import org.eclipse.ui.internal.E4PartWrapper;
27 28

  
29
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
28 30
import eu.etaxonomy.cdm.model.description.IDescribable;
31
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
29 32
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
30 33
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
31 34
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
......
96 99
			showEmptyPage();
97 100
			return;
98 101
		}
102
		
99 103

  
100 104
        if (part instanceof DetailsViewPart || part instanceof SupplementalDataViewPart
101 105
                || part instanceof DescriptiveViewPart) {
......
104 108
            return;
105 109
        }
106 110

  
107
		if(part instanceof IPartContentHasMedia && ((IPartContentHasMedia) part).canAttachMedia()){
111
		if(part instanceof IPartContentHasMedia && ((IPartContentHasMedia) part).canAttachMedia() ){
108 112
		    if(selection instanceof IStructuredSelection){
109 113
		    	Object firstElement = ((IStructuredSelection) selection).getFirstElement();
110 114
		        if(firstElement instanceof TreeNode){
......
118 122
		        }
119 123
		    }
120 124
		}
125
		if (selection instanceof IStructuredSelection){
126
			IStructuredSelection structuredSelection = (IStructuredSelection) selection;
127
			if(structuredSelection.getFirstElement() instanceof TreeNode){
128
					if (((TreeNode)structuredSelection.getFirstElement()).getValue() instanceof SpecimenOrObservationBase){
129
				    structuredSelection = new StructuredSelection(((TreeNode)structuredSelection.getFirstElement()).getValue());
130
				    showViewer(part, structuredSelection);
131
				    return;
132
				}
133
			}
134
		}
135
		
121 136
		showEmptyPage();
122 137
	}
123 138

  

Also available in: Unified diff