logic: Fixed scrolling to line from plug-in and moved all code view scrolling into QtCodeNavigator
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include <memory>
|
||||
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/messaging/type/MessageScrollToLine.h"
|
||||
#include "utility/text/TextAccess.h"
|
||||
#include "utility/tracing.h"
|
||||
#include "utility/utility.h"
|
||||
@@ -213,7 +212,7 @@ void CodeController::handleMessage(MessageChangeFileView* message)
|
||||
params.locationFile = file;
|
||||
}
|
||||
|
||||
getView()->showCodeFile(params);
|
||||
getView()->addCodeSnippets(std::vector<CodeSnippetParams>(1, params), false);
|
||||
}
|
||||
view->setFileState(message->filePath, CodeView::FILE_MAXIMIZED);
|
||||
break;
|
||||
@@ -239,20 +238,20 @@ void CodeController::handleMessage(MessageFocusOut* message)
|
||||
|
||||
void CodeController::handleMessage(MessageScrollToLine* message)
|
||||
{
|
||||
getView()->scrollToLine(message->filename, message->line);
|
||||
getView()->scrollToLine(message->filePath, message->line);
|
||||
|
||||
if ( message->isModified )
|
||||
if (message->isModified)
|
||||
{
|
||||
MessageStatus(
|
||||
"File was modified. Showing the File: " + message->filename
|
||||
+ " at line " + std::to_string(message->line) + " now. Please refresh."
|
||||
"The file was modified, please refresh. Showing source location: " + message->filePath.str()
|
||||
+ " : " + std::to_string(message->line),
|
||||
true
|
||||
).dispatch();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageStatus(
|
||||
"Showing the File: " + message->filename
|
||||
+ " at line " + std::to_string(message->line) + "."
|
||||
"Showing source location: " + message->filePath.str() + " : " + std::to_string(message->line)
|
||||
).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,9 +77,10 @@ void FeatureController::handleMessage(MessageActivateFile* message)
|
||||
msg.setKeepContent(message->keepContent());
|
||||
msg.dispatchImmediately();
|
||||
}
|
||||
if( message->line > 0 )
|
||||
|
||||
if (message->line > 0)
|
||||
{
|
||||
MessageScrollToLine(message->filePath.str(), message->line, true).dispatch();
|
||||
MessageScrollToLine(message->filePath, message->line, true).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include "utility/messaging/type/MessageProjectNew.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/messaging/type/MessageActivateFile.h"
|
||||
#include "utility/messaging/type/MessageScrollCode.h"
|
||||
#include "utility/messaging/type/MessageScrollToLine.h"
|
||||
|
||||
IDECommunicationController::IDECommunicationController(StorageAccess* storageAccess)
|
||||
: m_storageAccess(storageAccess)
|
||||
@@ -70,32 +68,32 @@ void IDECommunicationController::handleSetActiveTokenMessage(
|
||||
{
|
||||
const unsigned int cursorColumn = message.column;
|
||||
|
||||
if(FileSystem::getFileInfoForPath(message.fileLocation).lastWriteTime
|
||||
== m_storageAccess->getFileInfoForFilePath(message.fileLocation).lastWriteTime)
|
||||
if (FileSystem::getFileInfoForPath(message.fileLocation).lastWriteTime
|
||||
== m_storageAccess->getFileInfoForFilePath(message.fileLocation).lastWriteTime)
|
||||
{
|
||||
// file was not modified
|
||||
std::shared_ptr<TokenLocationFile> tokenLocationFile = m_storageAccess->getTokenLocationsForLinesInFile(
|
||||
message.fileLocation, message.row, message.row
|
||||
message.fileLocation, message.row, message.row
|
||||
);
|
||||
|
||||
std::vector<Id> selectedLocationIds;
|
||||
tokenLocationFile->forEachStartTokenLocation(
|
||||
[&](TokenLocation* startLocation)
|
||||
{
|
||||
TokenLocation* endLocation = startLocation->getEndTokenLocation();
|
||||
[&](TokenLocation* startLocation)
|
||||
{
|
||||
TokenLocation* endLocation = startLocation->getEndTokenLocation();
|
||||
|
||||
if (!startLocation->isScopeTokenLocation()
|
||||
&& startLocation->getColumnNumber() <= cursorColumn
|
||||
&& endLocation->getColumnNumber() + 1 >= cursorColumn)
|
||||
{
|
||||
selectedLocationIds.push_back(startLocation->getId());
|
||||
}
|
||||
if (!startLocation->isScopeTokenLocation()
|
||||
&& startLocation->getColumnNumber() <= cursorColumn
|
||||
&& endLocation->getColumnNumber() + 1 >= cursorColumn)
|
||||
{
|
||||
selectedLocationIds.push_back(startLocation->getId());
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (selectedLocationIds.size() > 0)
|
||||
{
|
||||
MessageStatus("Activating a source location from external succeeded.").dispatch();
|
||||
MessageStatus("Activating a source location from plug-in succeeded.").dispatch();
|
||||
MessageDispatchWhenLicenseValid(
|
||||
std::make_shared<MessageActivateTokenLocations>(selectedLocationIds)
|
||||
).dispatch();
|
||||
@@ -105,7 +103,7 @@ void IDECommunicationController::handleSetActiveTokenMessage(
|
||||
}
|
||||
|
||||
Id fileId = m_storageAccess->getTokenIdForFileNode(message.fileLocation);
|
||||
if( fileId > 0)
|
||||
if (fileId > 0)
|
||||
{
|
||||
MessageDispatchWhenLicenseValid(
|
||||
std::make_shared<MessageActivateFile>(message.fileLocation, message.row)
|
||||
@@ -115,8 +113,9 @@ void IDECommunicationController::handleSetActiveTokenMessage(
|
||||
else
|
||||
{
|
||||
MessageStatus(
|
||||
"Activating a source location from external failed. No file " + message.fileLocation
|
||||
+ " have been found at in indexed source."
|
||||
"Activating source location from plug-in failed. File " + message.fileLocation
|
||||
+ " was not found in the project.",
|
||||
true
|
||||
).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ public:
|
||||
|
||||
virtual void showCodeSnippets(const std::vector<CodeSnippetParams>& snippets, const std::vector<Id>& activeTokenIds) = 0;
|
||||
virtual void addCodeSnippets(const std::vector<CodeSnippetParams>& snippets, bool insert) = 0;
|
||||
virtual void showCodeFile(const CodeSnippetParams& params) = 0;
|
||||
|
||||
virtual void setFileState(const FilePath filePath, FileState state) = 0;
|
||||
|
||||
@@ -49,7 +48,7 @@ public:
|
||||
virtual void showContents() = 0;
|
||||
|
||||
virtual void scrollToValue(int value) = 0;
|
||||
virtual void scrollToLine(std::string filename, unsigned int line) = 0;
|
||||
virtual void scrollToLine(const FilePath filePath, unsigned int line) = 0;
|
||||
|
||||
private:
|
||||
CodeController* getController();
|
||||
|
||||
Reference in New Issue
Block a user