Skip to content

Package: MEEditorInput

MEEditorInput

nameinstructionbranchcomplexitylinemethod
MEEditorInput(ECPEditorContext)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
MEEditorInput(ECPEditorContext, EStructuralFeature)
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
dispose()
M: 7 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
equals(Object)
M: 30 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
exists()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getAdapter(Class)
M: 13 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getImageDescriptor()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getModelElementContext()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getName()
M: 11 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getPersistable()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getProblemFeature()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getToolTipText()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
hashCode()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setProblemFeature(EStructuralFeature)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 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: *******************************************************************************/
15:
16: package org.eclipse.emf.ecp.editor.e3;
17:
18: import org.eclipse.emf.ecore.EObject;
19: import org.eclipse.emf.ecore.EStructuralFeature;
20: import org.eclipse.jface.resource.ImageDescriptor;
21: import org.eclipse.ui.IEditorInput;
22: import org.eclipse.ui.IPersistableElement;
23:
24: /**
25: * The {@link IEditorInput} for the {@link org.eclipse.emf.ecp.editor.internal.e3.MEEditor MEEditor}.
26: *
27: * @author helming
28: * @author shterev
29: * @author naughton
30: */
31: public class MEEditorInput implements IEditorInput {
32:
33:         private EStructuralFeature problemFeature;
34:         private ECPEditorContext modelElementContext;
35:
36:         /**
37:          * Constructor to add a probleFeature.
38:          *
39:          * @param context context of the model element
40:          * @param problemFeature the problem feature
41:          */
42:         public MEEditorInput(ECPEditorContext context, EStructuralFeature problemFeature) {
43:                 this(context);
44:                 this.problemFeature = problemFeature;
45:         }
46:
47:         /**
48:          * Default constructor.
49:          *
50:          * @param context context of the modelelement
51:          */
52:         public MEEditorInput(ECPEditorContext context) {
53:                 super();
54:                 modelElementContext = context;
55:         }
56:
57:         /**
58:          * {@inheritDoc}
59:          */
60:         @Override
61:         public boolean exists() {
62:                 // TODO Auto-generated method stub
63:                 return false;
64:         }
65:
66:         /**
67:          * {@inheritDoc}
68:          */
69:         @Override
70:         public IPersistableElement getPersistable() {
71:                 // TODO Auto-generated method stub
72:                 return null;
73:         }
74:
75:         /**
76:          * @return the problemFeature
77:          */
78:         public EStructuralFeature getProblemFeature() {
79:                 return problemFeature;
80:         }
81:
82:         /**
83:          * @param problemFeature the problemFeature to set
84:          */
85:         public void setProblemFeature(EStructuralFeature problemFeature) {
86:                 this.problemFeature = problemFeature;
87:         }
88:
89:         /**
90:          * Custom equals() for this class.
91:          *
92:          * @param obj the compared object.
93:          * @return the boolean state. {@inheritDoc}
94:          */
95:         @Override
96:         public boolean equals(Object obj) {
97:•                if (obj instanceof MEEditorInput) {
98:                         final MEEditorInput other = (MEEditorInput) obj;
99:•                        if (modelElementContext == other.modelElementContext) {
100:                                 return true;
101:                         }
102:•                        if (other.modelElementContext == null) {
103:                                 return false;
104:                         }
105:                         final boolean ret = modelElementContext.getDomainObject().equals(
106:                                 other.modelElementContext.getDomainObject());
107:                         return ret;
108:                 }
109:                 return false;
110:         }
111:
112:         /**
113:          * {@inheritDoc}
114:          */
115:         @Override
116:         public int hashCode() {
117:                 return 0;
118:         }
119:
120:         /**
121:          * {@inheritDoc}
122:          */
123:         @SuppressWarnings("unchecked")
124:         @Override
125:         public Object getAdapter(@SuppressWarnings("rawtypes") Class clazz) {
126:
127:•                if (clazz.equals(EObject.class) && modelElementContext != null) {
128:                         return modelElementContext.getDomainObject();
129:                 }
130:                 return null;
131:         }
132:
133:         /**
134:          * Returns the {@link ECPEditorContext}.
135:          *
136:          * @return {@link ECPEditorContext}
137:          */
138:         public ECPEditorContext getModelElementContext() {
139:                 return modelElementContext;
140:         }
141:
142:         /**
143:          * Disposes the input.
144:          */
145:         public void dispose() {
146:                 modelElementContext.dispose();
147:                 modelElementContext = null;
148:         }
149:
150:         /**
151:          * {@inheritDoc}
152:          */
153:         @Override
154:         public ImageDescriptor getImageDescriptor() {
155:                 // TODO Auto-generated method stub
156:                 return null;
157:         }
158:
159:         /**
160:          * {@inheritDoc}
161:          */
162:         @Override
163:         public String getName() {
164:•                if (modelElementContext == null) {
165:                         return "Error"; //$NON-NLS-1$
166:                 }
167:                 return modelElementContext.getDomainObject().eClass().getName();
168:         }
169:
170:         /**
171:          * {@inheritDoc}
172:          */
173:         @Override
174:         public String getToolTipText() {
175:                 return getName();
176:         }
177: }