GlslEditor: Some editor creation related cleanup

Use a BaseEditorFactory derived class, move some code around.

Change-Id: Id560a215102016cdbe21809f97be8fc190ed5cf5
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-08-22 17:16:02 +02:00
parent 44f0f4dc95
commit 3430514eff
10 changed files with 134 additions and 296 deletions

View File

@@ -29,6 +29,7 @@
#include "glslhoverhandler.h"
#include "glsleditor.h"
#include "glsleditorconstants.h"
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editormanager/editormanager.h>
@@ -36,8 +37,6 @@
#include <extensionsystem/pluginmanager.h>
#include <texteditor/basetexteditor.h>
#include <QTextCursor>
using namespace Core;
namespace GlslEditor {
@@ -51,15 +50,13 @@ GlslHoverHandler::~GlslHoverHandler()
bool GlslHoverHandler::acceptEditor(IEditor *editor)
{
return qobject_cast<GlslEditor *>(editor) != 0;
return editor->context().contains(Constants::C_GLSLEDITOR_ID);
}
void GlslHoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos)
{
if (GlslEditorWidget *glslEditor = qobject_cast<GlslEditorWidget *>(editor->widget())) {
if (! glslEditor->extraSelectionTooltip(pos).isEmpty())
setToolTip(glslEditor->extraSelectionTooltip(pos));
}
if (!editor->editorWidget()->extraSelectionTooltip(pos).isEmpty())
setToolTip(editor->editorWidget()->extraSelectionTooltip(pos));
}
void GlslHoverHandler::decorateToolTip()