ui: Show error in errors table when clicked in code view
bug id = 323
This commit is contained in:
@@ -33,10 +33,7 @@ void ErrorController::handleMessage(MessageShowErrors* message)
|
||||
{
|
||||
if (message->errorId)
|
||||
{
|
||||
if (message->isReplayed())
|
||||
{
|
||||
getView()->setErrorId(message->errorId);
|
||||
}
|
||||
getView()->setErrorId(message->errorId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "utility/messaging/type/MessageFocusIn.h"
|
||||
#include "utility/messaging/type/MessageFocusOut.h"
|
||||
#include "utility/messaging/type/MessageMoveIDECursor.h"
|
||||
#include "utility/messaging/type/MessageShowErrors.h"
|
||||
#include "utility/utility.h"
|
||||
|
||||
#include "data/location/TokenLocation.h"
|
||||
@@ -500,8 +501,15 @@ void QtCodeArea::mouseReleaseEvent(QMouseEvent* event)
|
||||
QTextCursor cursor = this->cursorForPosition(event->pos());
|
||||
std::vector<const Annotation*> annotations = getInteractiveAnnotationsForPosition(cursor.position());
|
||||
|
||||
activateTokenLocations(annotations);
|
||||
activateLocalSymbols(annotations);
|
||||
if (m_navigator->hasErrors())
|
||||
{
|
||||
activateErrors(annotations);
|
||||
}
|
||||
else
|
||||
{
|
||||
activateTokenLocations(annotations);
|
||||
activateLocalSymbols(annotations);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -551,7 +559,7 @@ void QtCodeArea::mouseMoveEvent(QMouseEvent* event)
|
||||
|
||||
setHoveredAnnotations(annotations);
|
||||
|
||||
if (annotations.size() == 1)
|
||||
if (m_navigator->hasErrors() && annotations.size() == 1)
|
||||
{
|
||||
std::string errorMessage = m_navigator->getErrorMessageForId(annotations[0]->tokenId);
|
||||
QToolTip::showText(event->globalPos(), QString::fromStdString(errorMessage));
|
||||
@@ -702,12 +710,29 @@ void QtCodeArea::activateLocalSymbols(const std::vector<const Annotation*>& anno
|
||||
}
|
||||
}
|
||||
|
||||
if (!allActive || !localSymbolIds.size())
|
||||
if (!allActive || localSymbolIds.size())
|
||||
{
|
||||
MessageActivateLocalSymbols(localSymbolIds).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeArea::activateErrors(const std::vector<const Annotation*>& annotations)
|
||||
{
|
||||
std::vector<Id> errorIds;
|
||||
for (const Annotation* annotation : annotations)
|
||||
{
|
||||
if (annotation->locationType == LOCATION_ERROR && annotation->tokenId > 0)
|
||||
{
|
||||
errorIds.push_back(annotation->tokenId);
|
||||
}
|
||||
}
|
||||
|
||||
if (errorIds.size() == 1)
|
||||
{
|
||||
MessageShowErrors(errorIds[0]).dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeArea::createAnnotations(std::shared_ptr<TokenLocationFile> locationFile)
|
||||
{
|
||||
locationFile->forEachStartTokenLocation(
|
||||
|
||||
@@ -145,6 +145,7 @@ private:
|
||||
std::vector<const Annotation*> getInteractiveAnnotationsForPosition(int pos) const;
|
||||
void activateTokenLocations(const std::vector<const Annotation*>& annotations);
|
||||
void activateLocalSymbols(const std::vector<const Annotation*>& annotations);
|
||||
void activateErrors(const std::vector<const Annotation*>& annotations);
|
||||
|
||||
void createAnnotations(std::shared_ptr<TokenLocationFile> locationFile);
|
||||
void annotateText();
|
||||
|
||||
Reference in New Issue
Block a user