ui: Added "Show Definition in IDE" action to graph context menu for nodes (issue #687)

This commit is contained in:
Eberhard Graether
2019-04-23 13:15:56 +02:00
parent 4984e23c07
commit a00cdc18ca
7 changed files with 48 additions and 14 deletions
@@ -9,6 +9,7 @@
#include "ApplicationSettings.h"
#include "FileInfo.h"
#include "logging.h"
#include "MessageMoveIDECursor.h"
#include "MessageStatus.h"
#include "TextAccess.h"
#include "tracing.h"
@@ -311,6 +312,7 @@ void CodeController::handleMessage(MessageCodeShowDefinition* message)
}
size_t lineNumber = 1;
size_t columnNumber = 1;
FilePath filePath;
// use first scope location for nodeId, otherwise first location
@@ -334,6 +336,7 @@ void CodeController::handleMessage(MessageCodeShowDefinition* message)
filePath = location->getFilePath();
lineNumber = location->getLineNumber();
columnNumber = location->getColumnNumber();
addedLocation = true;
return;
}
@@ -348,6 +351,7 @@ void CodeController::handleMessage(MessageCodeShowDefinition* message)
filePath = location->getFilePath();
lineNumber = location->getStartLocation()->getLineNumber();
columnNumber = location->getStartLocation()->getColumnNumber();
}
collection = filteredCollection;
@@ -357,6 +361,12 @@ void CodeController::handleMessage(MessageCodeShowDefinition* message)
filePath = collection->getSourceLocationFiles().begin()->second->getFilePath();
}
if (message->inIDE)
{
MessageMoveIDECursor(filePath, lineNumber, columnNumber).dispatch();
return;
}
std::vector<CodeSnippetParams> snippets = getSnippetsForFile(collection->getSourceLocationFiles().begin()->second);
if (snippets.size() != 1)
{