Skip to content

Package: LinkedWithEditorPartListener

LinkedWithEditorPartListener

nameinstructionbranchcomplexitylinemethod
LinkedWithEditorPartListener(ILinkedWithEditorView)
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%
partActivated(IWorkbenchPartReference)
M: 18 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
partBroughtToTop(IWorkbenchPartReference)
M: 19 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
partClosed(IWorkbenchPartReference)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
partDeactivated(IWorkbenchPartReference)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
partHidden(IWorkbenchPartReference)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
partInputChanged(IWorkbenchPartReference)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
partOpened(IWorkbenchPartReference)
M: 19 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
partVisible(IWorkbenchPartReference)
M: 19 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 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: package org.eclipse.emf.ecp.ui.linkedView;
16:
17: import org.eclipse.ui.IEditorPart;
18: import org.eclipse.ui.IPartListener2;
19: import org.eclipse.ui.IWorkbenchPartReference;
20:
21: /**
22: * An {@link IPartListener2} notifying an {@link ILinkedWithEditorView}, if the active editor changes.
23: *
24: * @author Eugen Neufeld
25: *
26: */
27: public class LinkedWithEditorPartListener implements IPartListener2 {
28:
29:         private final ILinkedWithEditorView view;
30:
31:         /**
32:          * Default constructor.
33:          *
34:          * @param view The {@link ILinkedWithEditorView} to be notified, if the active editor changes.
35:          */
36:         public LinkedWithEditorPartListener(ILinkedWithEditorView view) {
37:                 this.view = view;
38:         }
39:
40:         /** {@inheritDoc} */
41:         @Override
42:         public void partActivated(IWorkbenchPartReference ref) {
43:•                if (ref.getPart(true) instanceof IEditorPart) {
44:                         final IEditorPart editor = view.getViewSite().getPage().getActiveEditor();
45:•                        if (editor != null) {
46:                                 view.editorActivated(editor);
47:                         }
48:                 }
49:         }
50:
51:         /** {@inheritDoc} */
52:         @Override
53:         public void partBroughtToTop(IWorkbenchPartReference ref) {
54:•                if (ref.getPart(true) == view) {
55:                         final IEditorPart editor = view.getViewSite().getPage().getActiveEditor();
56:•                        if (editor != null) {
57:                                 view.editorActivated(editor);
58:                         }
59:                 }
60:         }
61:
62:         /** {@inheritDoc} */
63:         @Override
64:         public void partOpened(IWorkbenchPartReference ref) {
65:•                if (ref.getPart(true) == view) {
66:                         final IEditorPart editor = view.getViewSite().getPage().getActiveEditor();
67:•                        if (editor != null) {
68:                                 view.editorActivated(editor);
69:                         }
70:                 }
71:         }
72:
73:         /** {@inheritDoc} */
74:         @Override
75:         public void partVisible(IWorkbenchPartReference ref) {
76:•                if (ref.getPart(true) == view) {
77:                         final IEditorPart editor = view.getViewSite().getPage().getActiveEditor();
78:•                        if (editor != null) {
79:                                 view.editorActivated(editor);
80:                         }
81:
82:                 }
83:         }
84:
85:         /** {@inheritDoc} */
86:         @Override
87:         public void partClosed(IWorkbenchPartReference ref) {
88:         }
89:
90:         /** {@inheritDoc} */
91:         @Override
92:         public void partDeactivated(IWorkbenchPartReference ref) {
93:         }
94:
95:         /** {@inheritDoc} */
96:         @Override
97:         public void partHidden(IWorkbenchPartReference ref) {
98:         }
99:
100:         /** {@inheritDoc} */
101:         @Override
102:         public void partInputChanged(IWorkbenchPartReference ref) {
103:         }
104:
105: }