String medium = WGADesignStructureHelper.determineMediaKey(activeFile);
ResourceIndexManager rsm = Plugin.getDefault().getResourceIndexManager();
if (rsm != null) {
// the path to the file which we are currently editing
IPath pathOfEditedFile = activeFile.getParent().getProjectRelativePath();
// the path of the medium of the current file
IPath mediumPath = designHelper.getTmlRoot().getFolder(new Path(medium)).getProjectRelativePath();
pathOfEditedFile = pathOfEditedFile.removeFirstSegments(mediumPath.segmentCount());
Iterator<String> scriptPaths = rsm.getScriptPaths(designRoot, type).iterator();
while (scriptPaths.hasNext()) {
String scriptPath = scriptPaths.next();
// scriptfile path
IPath scriptFile = new Path(scriptPath).removeFileExtension();
// path of the current file
IPath currentFilePath = scriptFile.removeLastSegments(1);
// removing the path of the selected medium
currentFilePath = currentFilePath.removeFirstSegments(mediumPath.segmentCount());
// removing the path of the elected medium
scriptFile = scriptFile.removeFirstSegments(mediumPath.segmentCount());
IPath tmp = null;
if (currentFilePath.segmentCount() >= pathOfEditedFile.segmentCount()) {
int a = currentFilePath.segmentCount();
int b = pathOfEditedFile.segmentCount();
tmp = currentFilePath.removeLastSegments(a - b);
if (tmp.equals(pathOfEditedFile)) {
currentFilePath = scriptFile.removeFirstSegments(tmp.segmentCount());
references.add("::" + currentFilePath.toString().replaceAll("\\/", ":"));
} else {
String reference = scriptFile.toString().replaceAll("\\/", ":");