Revision 2d3da144
Added by Patrick Plitzner over 8 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java | ||
---|---|---|
31 | 31 |
import org.eclipse.jface.viewers.TableViewer; |
32 | 32 |
import org.eclipse.jface.viewers.TableViewerColumn; |
33 | 33 |
import org.eclipse.jface.viewers.TextCellEditor; |
34 |
import org.eclipse.jface.viewers.TreeNode; |
|
34 | 35 |
import org.eclipse.jface.viewers.Viewer; |
35 | 36 |
import org.eclipse.swt.SWT; |
36 | 37 |
import org.eclipse.swt.widgets.Composite; |
... | ... | |
57 | 58 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
58 | 59 |
import eu.etaxonomy.cdm.model.reference.Reference; |
59 | 60 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
60 |
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor; |
|
61 | 61 |
import eu.etaxonomy.taxeditor.model.DescriptionHelper; |
62 |
import eu.etaxonomy.taxeditor.model.LineSelection; |
|
63 | 62 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
64 | 63 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
65 | 64 |
import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart; |
... | ... | |
283 | 282 |
if(part == this){ |
284 | 283 |
return; |
285 | 284 |
} |
286 |
if(! (part instanceof BulkEditor)){ |
|
287 |
setContentDescription(""); |
|
288 |
showEmptyPage(); |
|
289 |
return; |
|
290 |
} |
|
291 |
|
|
292 |
if(! (selection instanceof LineSelection)){ |
|
293 |
return; |
|
294 |
} |
|
295 |
LineSelection lineSelection = (LineSelection) selection; |
|
296 |
|
|
297 |
if(lineSelection.size() != 1){ |
|
298 |
return; |
|
299 |
} |
|
300 |
|
|
301 |
if(! (lineSelection.getFirstElement() instanceof IdentifiableEntity)){ |
|
302 |
return; |
|
303 |
} |
|
304 |
|
|
305 |
showViewer(part, lineSelection); |
|
285 |
if(selection instanceof IStructuredSelection){ |
|
286 |
showViewer(part, (IStructuredSelection) selection); |
|
287 |
} |
|
306 | 288 |
} |
307 | 289 |
|
308 | 290 |
/** {@inheritDoc} */ |
... | ... | |
310 | 292 |
public void showViewer(IWorkbenchPart part, IStructuredSelection selection) { |
311 | 293 |
// this.part = part; |
312 | 294 |
|
313 |
updateReferencingObjects(((IdentifiableEntity) selection.getFirstElement()).getUuid(),selection.getFirstElement().getClass() ); |
|
295 |
Object firstElement = selection.getFirstElement(); |
|
296 |
if(firstElement instanceof TreeNode){ |
|
297 |
firstElement = ((TreeNode) firstElement).getValue(); |
|
298 |
} |
|
299 |
if(firstElement instanceof IdentifiableEntity){ |
|
300 |
updateReferencingObjects(((IdentifiableEntity) firstElement).getUuid(),firstElement.getClass() ); |
|
301 |
} |
|
302 |
else{ |
|
303 |
setContentDescription(""); |
|
304 |
} |
|
314 | 305 |
} |
315 | 306 |
|
316 | 307 |
/** {@inheritDoc} */ |
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
776 | 776 |
<menuContribution |
777 | 777 |
locationURI="popup:eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"> |
778 | 778 |
<command |
779 |
commandId="eu.etaxonomy.taxeditor.editor.derivate.delete"
|
|
779 |
commandId="org.eclipse.ui.edit.delete"
|
|
780 | 780 |
label="%command.label.52" |
781 | 781 |
style="push"> |
782 | 782 |
</command> |
... | ... | |
787 | 787 |
style="push"> |
788 | 788 |
</command> |
789 | 789 |
<dynamic |
790 |
class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu" |
|
791 |
id="eu.etaxonomy.taxeditor.editor.derivativeEditor.CdmViewerContextMenu"> |
|
792 |
</dynamic> |
|
793 |
<dynamic |
|
790 | 794 |
class="eu.etaxonomy.taxeditor.editor.view.derivate.contextMenu.DerivateViewContextMenu" |
791 | 795 |
id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateContextMenu"> |
792 | 796 |
</dynamic> |
... | ... | |
1120 | 1124 |
</handler> |
1121 | 1125 |
<handler |
1122 | 1126 |
class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler" |
1123 |
commandId="eu.etaxonomy.taxeditor.editor.view.derivate.command.delete">
|
|
1127 |
commandId="org.eclipse.ui.edit.delete">
|
|
1124 | 1128 |
<activeWhen> |
1125 | 1129 |
<with |
1126 | 1130 |
variable="activePartId"> |
... | ... | |
1152 | 1156 |
</reference> |
1153 | 1157 |
</activeWhen> |
1154 | 1158 |
</handler> |
1159 |
<handler |
|
1160 |
class="eu.etaxonomy.taxeditor.handler.defaultHandler.OpenReferencingObjectsView" |
|
1161 |
commandId="eu.etaxonomy.taxeditor.openReferencingObjectsView"> |
|
1162 |
<activeWhen> |
|
1163 |
<with |
|
1164 |
variable="activePartId"> |
|
1165 |
<equals |
|
1166 |
value="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"> |
|
1167 |
</equals> |
|
1168 |
</with> |
|
1169 |
</activeWhen> |
|
1170 |
</handler> |
|
1155 | 1171 |
</extension> |
1156 | 1172 |
<extension |
1157 | 1173 |
name="%extension.name" |
Also available in: Unified diff
Add referencing objects view functionality to derivative editor #5403