Skip to content

Package: TreeMasterDetailCache

TreeMasterDetailCache

nameinstructionbranchcomplexitylinemethod
cacheView(ECPSWTView)
M: 2 C: 17
89%
M: 4 C: 4
50%
M: 4 C: 1
20%
M: 0 C: 3
100%
M: 0 C: 1
100%
isCached(EObject)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2019 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: * Christian W. Damus - bug 527686
14: ******************************************************************************/
15: package org.eclipse.emfforms.spi.swt.treemasterdetail;
16:
17: import org.eclipse.emf.ecore.EObject;
18: import org.eclipse.emf.ecp.ui.view.swt.ECPSWTView;
19: import org.eclipse.emf.ecp.view.spi.swt.masterdetail.BasicDetailViewCache;
20: import org.eclipse.emf.ecp.view.spi.swt.masterdetail.DetailViewCache;
21:
22: /**
23: * A cache for the TreeMasterDetail that allows to cache rendered ECPSWTViews and reuse them when switching between
24: * elements in the tree.
25: *
26: * @author Eugen Neufeld
27: * @since 1.9
28: *
29: * @deprecated As of 1.22, use the {@link DetailViewCache} API, instead, or extend the {@link BasicDetailViewCache}
30: * class
31: */
32: @Deprecated
33: public interface TreeMasterDetailCache extends DetailViewCache {
34:
35:         /**
36:          * Checks whether there is already a cached view available.
37:          *
38:          * @param selection The new selection of the tree
39:          * @return true if there is a cached view for the provided selection, false otherwise
40:          */
41:         boolean isChached(EObject selection);
42:
43:         @Override
44:         default boolean isCached(EObject selection) {
45:                 return isChached(selection);
46:         }
47:
48:         /**
49:          * Returns the previously cached view for the provided selection.
50:          *
51:          * @param selection The new selection of the tree
52:          * @return The cached view
53:          */
54:         @Override
55:         ECPSWTView getCachedView(EObject selection);
56:
57:         /**
58:          * Caches the provided {@link ECPSWTView} to allow it to be reused later.
59:          *
60:          * @param ecpView The {@link ECPSWTView} to cache.
61:          */
62:         void cache(ECPSWTView ecpView);
63:
64:         @Override
65:         default boolean cacheView(ECPSWTView ecpView) {
66:                 // Don't attempt to cache a view already disposed
67:•                if (ecpView != null && !ecpView.getSWTControl().isDisposed()) {
68:                         cache(ecpView);
69:                 }
70:
71:•                return ecpView != null && !ecpView.getSWTControl().isDisposed();
72:         }
73: }