Skip to content

Package: TreeViewerSWTFactory

TreeViewerSWTFactory

nameinstructionbranchcomplexitylinemethod
createTreeViewer(Composite, Object)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
createTreeViewer(Composite, Object, TreeViewerCustomization)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
fillDefaults(Composite, Object)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Johannes Faltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.swt.treemasterdetail;
15:
16: import org.eclipse.emfforms.internal.swt.treemasterdetail.DefaultTreeViewerCustomization;
17: import org.eclipse.jface.viewers.TreeViewer;
18: import org.eclipse.swt.widgets.Composite;
19:
20: /**
21: * This factory allows to create {@link TreeViewer TreeViewers}.
22: *
23: * @author Johannes Faltermeier
24: * @since 1.8
25: *
26: */
27: public final class TreeViewerSWTFactory {
28:
29:         private TreeViewerSWTFactory() {
30:                 // factory
31:         }
32:
33:         /**
34:          * Use this method if you want to customize any behavior of the {@link TreeViewer}. This will return
35:          * a {@link TreeViewerSWTBuilder} which allows to customize certain aspects.
36:          *
37:          * @param composite the parent composite
38:          * @param input the input object
39:          * @return the builder
40:          */
41:         public static TreeViewerSWTBuilder fillDefaults(Composite composite, Object input) {
42:                 return new TreeViewerSWTBuilder(composite, input);
43:         }
44:
45:         /**
46:          * Creates a {@link TreeViewer} with the default behavior.
47:          *
48:          * @param parent the parent composite
49:          * @param input the input object
50:          * @return the tree viewer
51:          */
52:         public static TreeViewer createTreeViewer(Composite parent, Object input) {
53:                 return TreeViewerSWTBuilder.create(new DefaultTreeViewerCustomization(), parent,
54:                         TreeViewerSWTBuilder.getEditingDomain(input), input);
55:         }
56:
57:         /**
58:          * Creates a {@link TreeViewer} with a customized behavior. Please note that there is also the
59:          * {@link #fillDefaults(Composite, Object)} method which allows to customize single aspects of the default
60:          * behavior without having to provider a full implementation of {@link TreeViewerCustomization}.
61:          *
62:          * @param parent the parent composite
63:          * @param input the input object
64:          * @param buildBehaviour the custom behavior
65:          * @return the tree viewer
66:          */
67:         public static TreeViewer createTreeViewer(Composite parent, Object input,
68:                 TreeViewerCustomization buildBehaviour) {
69:                 return TreeViewerSWTBuilder.create(buildBehaviour, parent, TreeViewerSWTBuilder.getEditingDomain(input), input);
70:         }
71:
72: }