Project

General

Profile

« Previous | Next » 

Revision ee1ed5a9

Added by Patrick Plitzner almost 11 years ago

  • simplified code for opening editor in TaxonNavigator

    • used IPartContentHasXYZ interfaces for selectionChanged() in Supplemental- and DetailsViewPart
    • formatted code
    • fixed warnings

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesViewPart.java
1 1
/**
2 2
 * Copyright (C) 2011 EDIT
3
 * European Distributed Institute of Taxonomy 
3
 * European Distributed Institute of Taxonomy
4 4
 * http://www.e-taxonomy.eu
5
 * 
5
 *
6 6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
 * See LICENSE.TXT at the top of this package for the full license terms.
8 8
 */
......
19 19
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementDropAdapter;
20 20
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptionElementTransfer;
21 21
import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
22
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
23
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
24 22

  
25 23

  
26 24
/**
27
 * The Class create a speific Use View to keep the taxonomic view clean
28
 * @author a.theys	
25
 * The Class create a specific Use View to keep the taxonomic view clean
26
 * @author a.theys
29 27
 * @created mar 13, 2012
30 28
 * @version 1.0
31 29
 */
32
public class UsesViewPart extends DescriptiveViewPart implements IPartContentHasDetails, IPartContentHasSupplementalData {
30
public class UsesViewPart extends DescriptiveViewPart {
33 31

  
34 32
	/** Constant <code>ID="eu.etaxonomy.taxeditor.editor.view.uses"</code> */
35 33
	public static final String ID = "eu.etaxonomy.taxeditor.editor.view.uses";
36 34
	/** {@inheritDoc} */
37 35
	@Override
38 36
	public void createViewer(Composite parent) {
39
		
37

  
40 38
		viewer = new TreeViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL
41 39
				| SWT.V_SCROLL | SWT.FULL_SELECTION));
42 40
		viewer.setContentProvider(new UsesContentProvider(featureNodeContainerCache));
43 41
		viewer.setLabelProvider(new UsesLabelProvider());
44 42
		viewer.setAutoExpandLevel(2);
45
		
46
		
47
		
43

  
44

  
45

  
48 46
		Transfer[] transfers = new Transfer[] { DescriptionElementTransfer.getInstance() };
49 47
		viewer.addDragSupport(dndOperations, transfers, new DescriptionElementDragListener(
50 48
				this));
51 49
		viewer.addDropSupport(dndOperations, transfers,
52 50
				new DescriptionElementDropAdapter(viewer));
53
						
51

  
54 52
		// Propagate selection from viewer
55 53
		getSite().setSelectionProvider(viewer);
56
		
57
		showAllElementsAction = new ToggleDescriptionAction(false);		
54

  
55
		showAllElementsAction = new ToggleDescriptionAction(false);
58 56
		hideAllElementsAction = new ToggleDescriptionAction(true);
59
		
57

  
60 58
		// Add context menu to tree
61 59
		createMenu();
62
		
60

  
63 61
		createToolbar();
64 62

  
65 63
	}
66
	
64

  
67 65
	/** {@inheritDoc} */
68 66
	@Override
69 67
	public boolean postOperation(CdmBase objectAffectedByOperation) {
70 68
		viewer.refresh();
71 69
		return super.postOperation(objectAffectedByOperation);
72 70
	}
73
	
71

  
74 72

  
75 73

  
76 74
}

Also available in: Unified diff