Skip to content

Package: ECPSWTAction

ECPSWTAction

nameinstructionbranchcomplexitylinemethod
ECPSWTAction(EditingDomain, EStructuralFeature.Setting)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
equals(Object)
M: 24 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
getEditingDomain()
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%
getSetting()
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%
hashCode()
M: 0 C: 11
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-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.edit.spi.swt.actions;
15:
16: import org.eclipse.emf.ecore.EStructuralFeature.Setting;
17: import org.eclipse.emf.edit.domain.EditingDomain;
18: import org.eclipse.jface.action.Action;
19:
20: /**
21: * An abstract action used by ecp.
22: *
23: * @author Eugen Neufeld
24: * @since 1.5
25: *
26: */
27: public abstract class ECPSWTAction extends Action {
28:         private final EditingDomain editingDomain;
29:         private final Setting setting;
30:
31:         /**
32:          * The constructor of all ecp actions.
33:          *
34:          * @param editingDomain the {@link EditingDomain} to use
35:          * @param setting the {@link Setting} to use
36:          */
37:         public ECPSWTAction(EditingDomain editingDomain, Setting setting) {
38:                 this.editingDomain = editingDomain;
39:                 this.setting = setting;
40:
41:         }
42:
43:         /**
44:          * The set {@link Setting}.
45:          *
46:          * @return the {@link Setting}
47:          */
48:         protected Setting getSetting() {
49:                 return setting;
50:         }
51:
52:         /**
53:          * The set {@link EditingDomain}.
54:          *
55:          * @return the {@link EditingDomain}
56:          */
57:         public EditingDomain getEditingDomain() {
58:                 return editingDomain;
59:         }
60:
61:         /**
62:          * {@inheritDoc}
63:          *
64:          * @see java.lang.Object#hashCode()
65:          */
66:         @Override
67:         public int hashCode() {
68:                 return this.getClass().getName().hashCode() * setting.getEStructuralFeature().getName().hashCode();
69:         }
70:
71:         /**
72:          * {@inheritDoc}
73:          *
74:          * @see java.lang.Object#equals(java.lang.Object)
75:          */
76:         @Override
77:         public boolean equals(Object other) {
78:•                if (other == null) {
79:                         return false;
80:                 }
81:•                if (!other.getClass().isInstance(this)) {
82:                         return false;
83:                 }
84:                 final ECPSWTAction otherAction = (ECPSWTAction) other;
85:                 return setting.getEStructuralFeature().getName().equals(otherAction.setting.getEStructuralFeature().getName());
86:         }
87: }