blob: 79335e5ed1da5a3db05892c3fe468bd82796378b (
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
|
/*******************************************************************************
* Copyright (c) 2009, 2013 R.Dvorak and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Radek Dvorak - initial API and implementation
*******************************************************************************/
package org.eclipse.m2m.qvt.oml.debug.core.srclookup;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
import org.eclipse.emf.common.util.URI;
import org.eclipse.m2m.qvt.oml.debug.core.QVTODebugCore;
import org.eclipse.m2m.qvt.oml.debug.core.QVTOStackFrame;
/**
* @since 1.3
*/
public class QVTOSourceLookupParticipant extends AbstractSourceLookupParticipant {
public QVTOSourceLookupParticipant() {
super();
}
public String getSourceName(Object object) throws CoreException {
if (object instanceof QVTOStackFrame) {
QVTOStackFrame frame = (QVTOStackFrame) object;
URI unitURI = frame.getUnitURI();
IFile sourceFile = findSourceFile(unitURI);
if(sourceFile != null) {
return sourceFile.getProjectRelativePath().toString();
}
}
return null;
}
private IFile findSourceFile(URI unitURI) {
return QVTODebugCore.getDefault().resolveWorskpaceFile(unitURI);
}
}
|