Project

General

Profile

Revision 5ec2e7d4

ID5ec2e7d4eecfab150f197f4c2657ae1462b2128c
Parent 595bbde7
Child be9600f6

Added by Patrick Plitzner over 1 year ago

ref #6913 Remove concept graph view

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/graph/ConceptGraphView.java
1
/**
2
 *
3
 */
4
package eu.etaxonomy.taxeditor.editor.view.concept.graph;
5

  
6
import org.eclipse.jface.viewers.ISelection;
7
import org.eclipse.jface.viewers.Viewer;
8
import org.eclipse.swt.SWT;
9
import org.eclipse.swt.widgets.Composite;
10
import org.eclipse.ui.IWorkbenchPart;
11
import org.eclipse.zest.core.viewers.GraphViewer;
12
import org.eclipse.zest.core.widgets.ZestStyles;
13
import org.eclipse.zest.layouts.LayoutAlgorithm;
14
import org.eclipse.zest.layouts.LayoutStyles;
15
import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
16

  
17
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
18
import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
19

  
20
/**
21
 * @author andreas
22
 *
23
 */
24
public class ConceptGraphView extends AbstractCdmEditorViewPart {
25

  
26
	public static final String ID = "eu.etaxonomy.taxeditor.editor.view.concept.graph"; //$NON-NLS-1$
27

  
28
	private GraphViewer viewer;
29
	private LayoutAlgorithm layoutAlgoritm;
30

  
31
	/* (non-Javadoc)
32
	 * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
33
	 */
34
	@Override
35
	protected void selectionChanged_internal(IWorkbenchPart workbenchPart, ISelection selection) {
36
	    //FIXME E4 migrate or delete
37
//        Object partObject = workbenchPart;
38
//        Object wrappedPart = WorkbenchUtility.getE4WrappedPart(partObject);
39
//        if(wrappedPart!=null){
40
//            partObject = wrappedPart;
41
//        }
42
////		if(part instanceof ConceptGraphView){
43
////			// ConceptGraphView is maximized
44
////			return;
45
////		}
46
//
47
//		if(EditorUtil.getActiveE4Editor() == null){
48
//			showEmptyPage();
49
//			return;
50
//		}
51
//
52
//		if(partObject instanceof BulkEditor){
53
//			showEmptyPage();
54
//			return;
55
//		}
56
//
57
//
58
//		if(partObject instanceof MultiPageTaxonEditor){
59
//			if(! partObject.equals(this.part)){
60
//				IEditorInput input = ((IEditorPart) partObject).getEditorInput();
61
//				showViewer(partObject, new StructuredSelection(input));
62
//			}
63
//		}
64

  
65
	}
66

  
67
	/* (non-Javadoc)
68
	 * @see eu.etaxonomy.taxeditor.operation.IPostOperationEnabled#onComplete()
69
	 */
70
	@Override
71
	public boolean onComplete() {
72
		// TODO IGNORED
73
		return false;
74
	}
75

  
76
	/* (non-Javadoc)
77
	 * @see eu.etaxonomy.taxeditor.view.AbstractCdmViewPart#getViewer()
78
	 */
79
	@Override
80
	public Viewer getViewer() {
81
		return viewer;
82
	}
83

  
84
	/* (non-Javadoc)
85
	 * @see eu.etaxonomy.taxeditor.view.AbstractCdmViewPart#createViewer(org.eclipse.swt.widgets.Composite)
86
	 */
87
	@Override
88
	public void createViewer(Composite parent) {
89

  
90
		viewer = new GraphViewer(parent, SWT.NONE);
91
		getSite().setSelectionProvider(viewer);
92

  
93
		viewer.setContentProvider(new ConceptGraphContentProvider());
94
		viewer.setLabelProvider(new ConceptGraphLabelProvider());
95

  
96
		viewer.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
97

  
98
		viewer.setLayoutAlgorithm(getLayoutAlgoritm(), false);
99

  
100
//		createMenu();
101
//
102
//		createToolbar();
103

  
104

  
105
	}
106

  
107
	private LayoutAlgorithm getLayoutAlgoritm() {
108

  
109
		if (layoutAlgoritm == null) {
110
			// layoutAlgoritm = new CompositeLayoutAlgorithm(
111
			// LayoutStyles.NO_LAYOUT_NODE_RESIZING,
112
			// new LayoutAlgorithm[] {
113
			// new TreeLayoutAlgorithm(
114
			// LayoutStyles.NO_LAYOUT_NODE_RESIZING),
115
			// new HorizontalShift(
116
			// LayoutStyles.NO_LAYOUT_NODE_RESIZING) });
117

  
118
			layoutAlgoritm = new TreeLayoutAlgorithm(
119
					LayoutStyles.NO_LAYOUT_NODE_RESIZING);
120
			layoutAlgoritm.setEntityAspectRatio(0.5);
121
		}
122
		return layoutAlgoritm;
123
	}
124

  
125
	@Override
126
	protected String getViewName() {
127
		return Messages.ConceptGraphView_VIEWER_NAME;
128
	}
129

  
130

  
131
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)