Skip to content

Package: ECPCompositeFactory

ECPCompositeFactory

nameinstructionbranchcomplexitylinemethod
getAddRepositoryComposite()
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getAddRepositoryComposite(ECPProvider)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getCheckedModelClassComposite(Collection)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getCheckedTableSelectionComposite(Object)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getCheckoutProjectComposite(ECPCheckoutSource)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getCreateProjectComposite(List)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSelectModelClassComposite(Collection, Collection, Collection)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getSelectModelClassComposite(ECPProject)
M: 5 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-2013 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: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.ui.common;
15:
16: import java.util.Collection;
17: import java.util.HashSet;
18: import java.util.List;
19:
20: import org.eclipse.emf.ecore.EClass;
21: import org.eclipse.emf.ecore.EPackage;
22: import org.eclipse.emf.ecp.core.ECPProject;
23: import org.eclipse.emf.ecp.core.ECPProvider;
24: import org.eclipse.emf.ecp.core.util.ECPCheckoutSource;
25: import org.eclipse.emf.ecp.internal.ui.composites.AddRepositoryCompositeImpl;
26: import org.eclipse.emf.ecp.internal.ui.composites.CheckoutProjectCompositeImpl;
27: import org.eclipse.emf.ecp.internal.ui.composites.CreateProjectCompositeImpl;
28: import org.eclipse.emf.ecp.internal.ui.composites.ECPProjectSelectionModelClassCompositeImpl;
29: import org.eclipse.emf.ecp.spi.common.ui.CheckedModelClassComposite;
30: import org.eclipse.emf.ecp.spi.common.ui.composites.CheckedEStructuralFeatureComposite;
31: import org.eclipse.emf.ecp.spi.common.ui.composites.CheckedEStructuralFeatureCompositeImpl;
32: import org.eclipse.emf.ecp.spi.common.ui.composites.CheckedSelectModelClassCompositeImpl;
33: import org.eclipse.emf.ecp.spi.common.ui.composites.SelectModelClassCompositeImpl;
34: import org.eclipse.emf.ecp.spi.common.ui.composites.SelectionComposite;
35: import org.eclipse.jface.viewers.TreeViewer;
36:
37: /**
38: * @author Eugen Neufeld
39: *
40: */
41: public final class ECPCompositeFactory {
42:
43:         private ECPCompositeFactory() {
44:         }
45:
46:         /**
47:          *
48:          * @return a {@link AddRepositoryComposite}
49:          */
50:         public static AddRepositoryComposite getAddRepositoryComposite() {
51:                 return new AddRepositoryCompositeImpl(null);
52:         }
53:
54:         /**
55:          *
56:          * @param provider the provider to add a repository to.
57:          * @return a {@link AddRepositoryComposite}
58:          */
59:         public static AddRepositoryComposite getAddRepositoryComposite(ECPProvider provider) {
60:                 return new AddRepositoryCompositeImpl(provider);
61:         }
62:
63:         /**
64:          *
65:          * @param checkoutSource the source to check a project out from
66:          * @return an {@link CheckoutProjectComposite} allowing to check out a project
67:          */
68:         public static CheckoutProjectComposite getCheckoutProjectComposite(ECPCheckoutSource checkoutSource) {
69:                 return new CheckoutProjectCompositeImpl(checkoutSource);
70:         }
71:
72:         /**
73:          * Util method to create a composite which allows to ceate an ECP project.
74:          *
75:          * @param providers the providers to be considered to create a new project
76:          * @return A {@link CreateProjectComposite} allowing to create a new project
77:          */
78:         public static CreateProjectComposite getCreateProjectComposite(List<ECPProvider> providers) {
79:                 return new CreateProjectCompositeImpl(providers);
80:         }
81:
82:         /**
83:          * Util method to create a composite which allows to select Classes from {@link EPackage}s with a checkbox.
84:          *
85:          * @param ePackages The {@link EPackage}s to select from.
86:          * @return The {@link CheckedModelClassComposite}
87:          */
88:         public static CheckedModelClassComposite getCheckedModelClassComposite(Collection<EPackage> ePackages) {
89:                 return new CheckedSelectModelClassCompositeImpl(new HashSet<EPackage>(), ePackages, new HashSet<EClass>());
90:         }
91:
92:         /**
93:          * Util method to create a composite which allows to select an {@link EClass} based on all known {@link EPackage}s
94:          * in the registry by applying the provided filters.
95:          *
96:          * @param unsupportedEPackages The {@link EPackage}s that should not be available (blacklist)
97:          * @param filteredEPackages The {@link EPackage}s that should be available (whitelist)
98:          * @param filteredEClasses The {@link EClass}es that should be available (whitelist)
99:          * @return The {@link SelectionComposite} based on a {@link TreeViewer}
100:          */
101:         public static SelectionComposite<TreeViewer> getSelectModelClassComposite(
102:                 Collection<EPackage> unsupportedEPackages, Collection<EPackage> filteredEPackages,
103:                 Collection<EClass> filteredEClasses) {
104:                 return new SelectModelClassCompositeImpl(unsupportedEPackages, filteredEPackages, filteredEClasses);
105:         }
106:
107:         /**
108:          * Util method to create a composite which allows to select an {@link EClass} based on all known {@link EPackage}s
109:          * in the registry by applying the filters in the provided project.
110:          *
111:          * @param project The {@link ECPProject} to use as a filter
112:          * @return The {@link SelectionComposite} based on a {@link TreeViewer}
113:          */
114:         public static SelectionComposite<TreeViewer> getSelectModelClassComposite(ECPProject project) {
115:                 return new ECPProjectSelectionModelClassCompositeImpl(project);
116:         }
117:
118:         /**
119:          * Creates a {@link org.eclipse.emf.ecp.spi.common.ui.CompositeProvider CompositeProvider} for a composite
120:          * displaying a table with checkboxes.
121:          *
122:          * @param rootObject the viewer input
123:          * @return the composite provider
124:          */
125:         public static CheckedEStructuralFeatureComposite getCheckedTableSelectionComposite(Object rootObject) {
126:                 return new CheckedEStructuralFeatureCompositeImpl(rootObject);
127:         }
128:
129: }