Skip to content

Package: EcoreEditor

EcoreEditor

nameinstructionbranchcomplexitylinemethod
EcoreEditor()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
createDiangosticCache(Notifier)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
createTreeMasterDetail(Composite, Object, CreateElementCallback)
M: 0 C: 40
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 9
100%
M: 0 C: 1
100%
enableValidation()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getContextId()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getCreateElementCallback()
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%
getEditorTitle()
M: 0 C: 2
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: * cleme_000 - initial API and implementation
13: * Christian W. Damus - bug 527686
14: ******************************************************************************/
15: package org.eclipse.emfforms.internal.editor.ecore;
16:
17: import org.eclipse.emf.common.notify.Notifier;
18: import org.eclipse.emf.ecore.EcorePackage;
19: import org.eclipse.emf.ecp.view.spi.swt.masterdetail.BasicDetailViewCache;
20: import org.eclipse.emfforms.spi.editor.GenericEditor;
21: import org.eclipse.emfforms.spi.editor.InitializeChildCallback;
22: import org.eclipse.emfforms.spi.swt.treemasterdetail.TreeMasterDetailComposite;
23: import org.eclipse.emfforms.spi.swt.treemasterdetail.TreeMasterDetailSWTFactory;
24: import org.eclipse.emfforms.spi.swt.treemasterdetail.diagnostic.DiagnosticCache;
25: import org.eclipse.emfforms.spi.swt.treemasterdetail.util.CreateElementCallback;
26: import org.eclipse.swt.SWT;
27: import org.eclipse.swt.widgets.Composite;
28:
29: /**
30: * This class extends the GenericEditor to provide customized features for Ecore files.
31: */
32: public class EcoreEditor extends GenericEditor {
33:
34:         private static final String ECORE_EDITOR_CONTEXT = "org.eclipse.emfforms.editor.ecore.context";
35:
36:         @Override
37:         protected CreateElementCallback getCreateElementCallback() {
38:                 return new InitializeChildCallback();
39:         }
40:
41:         @Override
42:         protected String getEditorTitle() {
43:                 return "Ecore Model Editor";
44:         }
45:
46:         @Override
47:         protected TreeMasterDetailComposite createTreeMasterDetail(Composite composite, Object editorInput,
48:                 CreateElementCallback createElementCallback) {
49:                 final EcoreEditorTMDCustomization buildBehaviour = new EcoreEditorTMDCustomization(createElementCallback,
50:                         (Notifier) editorInput, (EcoreDiagnosticCache) getDiagnosticCache());
51:                 buildBehaviour.setTree(createTreeViewerBuilder());
52:•                buildBehaviour.setReadOnly(!isEditable(getEditorInput()));
53:
54:                 final TreeMasterDetailComposite result = TreeMasterDetailSWTFactory.createTreeMasterDetail(composite, SWT.NONE,
55:                         editorInput,
56:                         buildBehaviour);
57:                 result.setCache(new BasicDetailViewCache(EcorePackage.eINSTANCE.getEClassifiers().size()));
58:                 return result;
59:         }
60:
61:         @Override
62:         protected DiagnosticCache createDiangosticCache(Notifier input) {
63:                 return new EcoreDiagnosticCache(input);
64:         }
65:
66:         @Override
67:         protected String getContextId() {
68:                 return ECORE_EDITOR_CONTEXT;
69:         }
70:
71:         @Override
72:         protected boolean enableValidation() {
73:                 return true;
74:         }
75: }