Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 89761c037a1d0e56e1d19e5cfdf671ea73fafc0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*****************************************************************************
 * Copyright (c) 2013 CEA LIST.
 *
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  CEA LIST - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.moka.locator;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.moka.debug.MokaStackFrame;

// TODO: Auto-generated Javadoc
/**
 * A simple implementation of ISourceLookupDirector.
 * In this implementation, EObjects are considered as source elements.
 *
 */
public class MokaSourceLocator extends AbstractSourceLookupDirector implements ISourceLookupDirector {

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.debug.core.sourcelookup.ISourceLookupDirector#initializeParticipants()
	 */
	public void initializeParticipants() {
		// This initialization step does not have any particular impact.
		// All needed information comes from getSourceElement
		// Nevertheless, this code is kept there since the MokaSourceLookupParticipant could be used to account for additional information in the launch configuration.
		// For example, these information may include a list of di files where graphical representations have to be taken from a given semantic element.
		// This may be removed if we confirm that this mechanism only makes sense for text file resources.
		ISourceLookupParticipant[] participants = new ISourceLookupParticipant[] { new MokaSourceLookupParticipant() };
		this.addParticipants(participants);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector#getSourceElement(java.lang.Object)
	 */
	@Override
	public Object getSourceElement(Object element) {
		EObject sourceElement = null;
		MokaStackFrame stackFrame = (MokaStackFrame) element;
		sourceElement = stackFrame.getModelElement();
		return sourceElement;
	}

	/**
	 * An empty implementation of ISourceLookupParticipant.
	 * See comment on initializeParticipants.
	 *
	 */
	protected class MokaSourceLookupParticipant implements ISourceLookupParticipant {

		/*
		 * (non-Javadoc)
		 * 
		 * @see
		 * org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#sourceContainersChanged(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector
		 * )
		 */
		public void sourceContainersChanged(ISourceLookupDirector director) {
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#init(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector)
		 */
		public void init(ISourceLookupDirector director) {
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#getSourceName(java.lang.Object)
		 */
		public String getSourceName(Object object) throws CoreException {
			return null;
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#findSourceElements(java.lang.Object)
		 */
		public Object[] findSourceElements(Object object) throws CoreException {
			return null;
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant#dispose()
		 */
		public void dispose() {
		}
	};

}

Back to the top