Commit Graph

648 Commits

Author SHA1 Message Date
hjk
0fcca946ad Rename {Core,TextEditor},{Base,}TextDocument classes
First step of some more 'Base' removal in TextEditor.
s/Core::TextDocument/Core::BaseTextDocument/
s/TextEditor::BaseTextDocument/TextEditor::TextDocument/

Change-Id: I71ba325a2f0ad72ec9dae0d96846cbae72d326f7
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-09-25 18:00:51 +02:00
hjk
b26a17f30d CppTools: Change CppModelManager implementation pattern
Replace the CppModelManagerInterface/derived CppModelManager
combo by a more common CppModelManager/CppModelManagerPrivate
pimpl pattern.

Change-Id: Ia4582845ed94d5ef60b8571bab9b2260c6290287
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-09-19 13:17:55 +02:00
Erik Verbruggen
cc6a9babe0 C++: Move preprocessor settings handling to the document.
This cleans up the handling of those settings, and makes sure that the
C++ document is setting those settings before parsing. This also
prevents lock contention in the parser, because before this patch the
document would kick of the initial parse (after opening a document),
after which the editor would come in and try to set the preprocessor
settings, resulting in the UI thread locking until the initial parse was
done.

Change-Id: Ia2e18a9667e10279f045c1c5849046ec4cfe85ae
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-09-16 15:38:20 +02:00
hjk
0edefc4c2b TextEditor: Merge some "assist" related classes
Simplifies the code base by removing one level of unused
and unneeded abstraction.

- Merge {I,Default}AssistInterface to AssistInterface
- Merge {IAssist,Basic}ProposalItem to AssistProposalItem
- Merge {IGenericProposal,BasicProposalItemList}Model to GenericProposalModel

Change-Id: I54ee7b095427383d67a00fc1d87c3808c21d812d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-09-09 21:01:22 +02:00
Nikolai Kosjar
e9e111ffa8 CppEditor: Fix local renaming
CppLocalRenaming was connected to the initial QPlainTextEdit::document()
and not the "updated" QTextDocument set by
BaseTextEditorWidgetPrivate::setupDocumentSignals().

Broken by

    commit c655d7e598
    CppEditor: Convert to new construction scheme

Change-Id: I2e785a9d62a3bd39d9e613776cfc8e35dd9ff5d4
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-09-09 12:07:18 +02:00
hjk
0feb80fa00 CppEditor: Re-add check for editor existence in updateFunctionDeclDefLink
Fixes a recent regression.

Change-Id: Iaa4eb936274b33057fc6c8fdcfbe751b9ab28b75
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-09-08 13:47:30 +02:00
hjk
aa52cd83a6 CppEditor: Remove unused Project parameter
Change-Id: I3bfa201352127b34d46fe5bb4b18fab12aeafa3a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-09-04 12:01:18 +02:00
hjk
7aa7f6bdfa CppEditor: de-noise
Change-Id: I8b5c160912ca7da4bbd4ebb01a8b7d5360fb3bbc
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-09-04 11:04:31 +02:00
hjk
2e17339b05 TextEditor: Reset mimetype after open() in all BaseTextEditors
This was already done in all major editors and should not harm
all others.

Change-Id: I7e19d285c4b85419a9a1f9afa961addecf682eaf
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-09-04 10:15:40 +02:00
Eike Ziller
49db3a450a Merge remote-tracking branch 'origin/3.2'
Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/coreplugin/editormanager/editormanager.cpp
	src/plugins/cppeditor/cppeditor.cpp
	src/plugins/remotelinux/remotelinuxdebugsupport.cpp
	src/plugins/texteditor/basetexteditor.cpp

Change-Id: I0da7c1cf2506b12d0563795aa8177fc45e97050f
2014-09-03 16:08:02 +02:00
hjk
afd56bd8ad CppEditor: Don't set TextEditor context twice
Change-Id: I9ea66b8a890c75cd993a0e160d79231e5662a1e3
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-09-03 15:53:03 +02:00
hjk
4d93bb8216 TextEditor: Flip default to 'duplicatedSupported'
opt-out now, for all editors created by BaseTextEditorFactories.

Change-Id: I01d0a9ff26320fcd0b84ff90ff22c747cf84b84c
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-09-03 14:10:47 +02:00
hjk
e3bc7d19cf TextEditor: Move CompletionAssistProvider to *Widget
All the others live there, too.

Change-Id: I0a418bf235343d40a53fbee089234765386ee05d
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-09-03 14:02:38 +02:00
Eike Ziller
7224ccb2e7 Editors: Automatically add editor/document id to context and use that
instead of manually adding a context everywhere.

Change-Id: I4336015a6d19349171a255e949da89b0013d6700
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-09-02 16:48:13 +02:00
hjk
6775e623ee TextEditor: Move comment definitions back to *Widget
Only used there, and avoids back-links to editors.

Change-Id: I81206057ce89d42aef7febb840cf9e44b869df0e
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-09-02 10:06:54 +02:00
hjk
2b44c977ba CppEditor: Replace two editor() self-checks with direct checks
Change-Id: Ice47cc3ad86bd8d1fe6eaa812bf6fbb096fdd56c
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
2014-09-02 08:20:10 +02:00
Nikolai Kosjar
45570d4068 CppTools: Provide the editor snapshot for SemanticInfoUpdater
...so that SemanticInfoUpdater does not depend anymore on the
EditorDocumentParser. Accessing the snapshot was a blocking operation
that delayed the semantic info update longer than actually needed.

Change-Id: I348d22ef83ab310d4319b2e8b9678fe90ee24d6a
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-08-29 16:12:57 +02:00
Nikolai Kosjar
7bfe231897 CppEditor: Make local renaming more robust again
This will update the use selections synchronously again in case the user
triggered "Rename Symbol Under Cursor", just as before

    commit 89bd4ee
    C++: Base parsing on editor document instead of widget

Change-Id: I8d4d3dcc7140a61f9ac611a505db09dc96a17740
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-08-29 16:04:48 +02:00
Erik Verbruggen
82325d1046 C++: add env. var. to disable decl/def link tracking.
When the environment variable QTC_NO_FUNCTION_DECL_DEF_LINK_TRACKING is
set, no method declaration/definition tracking is performed. This is to
see if QTCREATORBUG-11262 is triggered due to the tracking.

Task-number: QTCREATORBUG-11262
Change-Id: Id4cb1fabf9304f8bf42393cb65c402adf8818e2a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-29 15:10:33 +02:00
Erik Verbruggen
4a3cc6d2b2 C++: set the objectName of QTimers.
This will hopefully help a bit in resolving the crashes that happen in
QCoreApplication::notifyInternal.

Change-Id: Ib3aa8c1a1f50778bd89938d7c529d8399ccf91ea
Task-number: QTCREATORBUG-11262
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-29 13:21:06 +02:00
Nikolai Kosjar
9e3441df8b {Cpp,Text}Editor: Fix duplicating CppEditorWidget
Fixes local use highlighting and renaming in new split, among others.

Done-with: hjk <hjk121@nokiamail.com>
Change-Id: Ic604d37d2dc0082fa4a75c2af457f60d6d6cfa66
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-08-29 10:21:54 +02:00
hjk
12642cc49a TextEditor: Remove some *Widget::createEditor implementation
This removes the ones that were not to be used anymore.
The fallback in the base class is left in for now.

Change-Id: I5e7ab16497a83eff9b11deb9e1feb390757eac0e
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-28 17:36:36 +02:00
hjk
c655d7e598 CppEditor: Convert to new construction scheme
Change-Id: I947f76b4dbc3a197cd49993855c3b0f5e3dc7b49
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-27 15:39:25 +02:00
hjk
d2c243464e CppEditor: Rename CPPEditor{,Document} to CppEditor{,Document}
Better in line with the rest.

Change-Id: I692c8b6b9bebf22f059709fb60e53ea04fcb7d53
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-08-27 14:18:05 +02:00
Nikolai Kosjar
89bd4ee3c4 C++: Base parsing on editor document instead of widget
This mainly takes CppEditorSupport apart.

* Parsing is now invoked by CPPEditorDocument itself by listening to
  QTextDocument::contentsChanged().

* Upon construction and destruction CPPEditorDocument creates and
  deletes an EditorDocumentHandle for (un)registration in the model
  manager. This handle provides everything to generate the working copy
  and to access the editor document processor.

* A CPPEditorDocument owns a BaseEditorDocumentProcessor instance that
  controls parsing, semantic info recalculation and the semantic
  highlighting for the document. This is more or less what is left from
  CppEditorSupport and can be considered as the backend of a
  CPPEditorDocument. CPPEditorDocument itself is quite small.

    * BuiltinEditorDocumentProcessor and ClangEditorDocumentProcessor
      derive from BaseEditorDocumentProcessor and implement the gaps.

    * Since the semantic info calculation was bound to the widget, it
      also calculated the local uses, which depend on the cursor
      position. This calculation got moved into the extracted class
      UseSeletionsUpdater in the cppeditor plugin, which is run once the
      cursor position changes or the semantic info document is updated.

    * Some more logic got extracted:
	- SemanticInfoUpdater (logic was in CppEditorSupport)
	- SemanticHighlighter (logic was in CppEditorSupport)

    * The *Parser and *Processor classes can be easily accessed by the
      static function get().

* CppHighlightingSupport is gone since it turned out to be useless.

* The editor dependency in CompletionAssistProviders is gone since we
  actually only need the file path now.

Change-Id: I49d3a7bd138c5ed9620123e34480772535156508
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-08-25 13:06:01 +02:00
hjk
268a9a1042 CppEditor: Remove some pointer indirection in timer access
Change-Id: Id2531b7841a0a173f07f7310fb0dc434ac5ec5f8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-22 11:25:58 +02:00
hjk
307129bf8f CppEditor: Partially move to new editor setup scheme
This needs more reorganization. For now, use a method to
add cpp editor support directly without relying on a fully
set up editor/widget/document combo.

Change-Id: Id8631c75ccd209f418faef31f8b8a4c71e53d87d
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-22 10:06:59 +02:00
hjk
cc351381ae TextEditor: Replace in-class connection by virtual function
Change-Id: Ifb51606f71100223631d086318c230a478d70712
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-21 09:37:26 +02:00
hjk
cb35594800 TextEditor: Centralize settings connections setup
All editors did that manually, with varying approaches. Connect once
when the document is made known to the EditorWidget instead.

Change-Id: Ib0828b08158539859f6f89c8080435a027aa06ed
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-20 13:28:44 +02:00
Nikolai Kosjar
e072527779 CppEditor: Remove CppEditorWidget dependency of CanonicalSymbol
Change-Id: I3c42d9df93756d9f85682465b9661d7e75ffa71e
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-08-20 11:16:47 +02:00
Nikolai Kosjar
7c21f2ec69 CppTools: Denoise with BuiltinEditorDocumentParser::Ptr
Change-Id: I1d572e8cc3e76ef6bbae720e3c3482292aab9609
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-08-20 11:13:51 +02:00
Nikolai Kosjar
7d35212f60 CppTools: Rename SnapshotUpdater to BuiltinEditorDocumentParser
Change-Id: I554b5e9e3f1ef7c167fa45b5cd0c230fdf63073b
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-08-20 11:12:48 +02:00
Nikolai Kosjar
b8a6a4dd4e CppTools: Move WorkingCopy to new cppworkingcopy.{h,cpp}
Change-Id: I447acf28849bffb52c1e6b6eafdde221ec0b179e
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-08-20 10:26:47 +02:00
Nikolai Kosjar
fa4e839bbe CppEditor: Move two functions to cpptoolsreuse.{h,cpp}
They do not really depend on CppEditorWidget and will be re-used in a
follow-up change.

    CppEditorWidget::identifierUnderCursor()
    CppEditorWidget::findCanonicalMacro()

Change-Id: I553bb68694fb4b5f1baa331debf33ae234e3dedf
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-08-20 10:24:23 +02:00
Eike Ziller
c4e51e7405 Merge remote-tracking branch 'origin/3.2'
Conflicts:
	qtcreator.pri
	qtcreator.qbs

Change-Id: I926bdfc7df6158207cfc07f3c6c591d0a59b7667
2014-08-19 12:34:58 +02:00
hjk
c5fae0e8da TextEditor: Further *Editor/*EditorWidget disentangling
In most cases, the *Editor constructor does not need to
access the *EditorWidget.

Change-Id: I1f5c076a0f723d5d82b398e8c250c7bd1d47eb17
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-19 10:32:12 +02:00
hjk
d2ec7d80d9 TextEditor: Merge the two sets of *EditorWidget constructors
Change-Id: I45d87d0be722ac36d64af222f03f8cb76242c9df
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-19 09:19:33 +02:00
hjk
3c3c896d55 CppEditor: Move indenter construction to document constructor
A more direct approach than going through the widget's baseTextDocument,
relying on widget life time.

Change-Id: I62c10e53b1a9a1e6717c6eb3e3cc78dcbfd2868e
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-08-18 17:18:59 +02:00
hjk
844c734d5e CppEditor: Move revisionVisible construction to constructor
Change-Id: I6462403d2d06c7c6c3f79627fbba80f0ce0683ef
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-18 15:48:18 +02:00
Erik Verbruggen
be3dbd2699 CppEditor: copy snapshot before FunctionDeclDefLink change calculation.
FunctionDeclDefLink::changes is called from
CPPEditorWidget::updateFunctionDeclDefLinkNow() where it receives the
snapshot by reference from the semantic info. The semantic info is
recalculated in a/the future, so it might change the snapshot or its
documents while it's still being used by the decl/def link finder.

So, this patch takes a copy of all relevant semantic info (snapshot and
document) before starting to calculate the changes.

Change-Id: I78244a4ca8149233403b3c35ee05a2d4ed4b2770
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-18 13:40:37 +02:00
hjk
6a75f05489 CppEditor: Move toolbar creation to Widget constructor
It doesn't need the editor parameter anymore, so the two-phase
setup can go. Note that both paths through ctor() finally hit
*Widget::createEditor() (one directly, one indirectly through
the first BaseTextEditorWidget::editor() call), so this doesn't
change what's set up, only when.

Change-Id: I65d9e317d796c8a5fe755d3d674cf79801e60617
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-04 13:32:16 +02:00
hjk
d7c2b0b681 TextEditor: Consolidate document access functions.
There was document(), textDocument() and baseTextDocument().
Two should be enough...

Change-Id: Id9e41c8d857c5cb3269a9fce5ab594d34448c982
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-08-04 10:43:56 +02:00
hjk
a9b7045803 TextEditor: Move toolbar widgets from *Editor to *Widget
Lifetime is coupled to the widgets, not the editor.

Change-Id: I01560bbdd6c399376d3a4184f0eb83e4153f830e
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-08-01 17:57:26 +02:00
hjk
98fd59fd09 TextEditor: Start moving data from *EditorWidget to *Editor
Goal is to consolidate "controller" related data in the *Editor hierarchy.
This patch introduces temporary "cross-Private" accessors dd() to
keep the patches small.

First item moved is the AutoCompleter, a glimps at long term benefits
is the simplification in the JavaEditorWidget which is now essentially
a BaseTextEditorWidget, only containing the still-wrong createEditor().
But that can only be move if the *Editors are self-contained, i.e.
keep data themselves, not indirectly through the *EditorWidgets.

Change-Id: Ia0ab90f0322bb17ac20458e6581069eed30acbaf
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-07-31 16:45:31 +02:00
hjk
9fd2fe5a9a TextEditor: Make completion assist provider a data member
In case of the CppEditor a direct member is not possible due
to setup restrictions inside the CppEditor machinery. I'd expect
that to be fixable when the editor base system is in good shape.

Change-Id: I184e219ca2dff6f67c9b58c182212eb12972cc84
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-07-31 12:40:52 +02:00
hjk
210321377e Editors: Some renamings to enhance consistency
The base pattern is FooEditor for BaseTextEditor derived classes
and FooEditorWidget for BaseTextEditorWidget derived classes. So:

CPPEditorWidget -> CppEditorWidget
CPPEditorWidgetPrivate -> CppEditorWidgetPrivate
...::EditorWidget -> PythonEditorWidget
GLSLTextEditorWidget -> GlslEditorWidget
GLSLEditorEditable -> GlslEditor

Change-Id: I76d34a3694c2fb35491982d86e83f7e4774c0be6
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-07-31 10:54:58 +02:00
hjk
f6b48950ed TextEditor: Re-work comment definition handling
No need for most of the machinery.

Change-Id: I9078174582d83da94c6c7f20282fd3a5f1742911
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-07-31 10:54:49 +02:00
hjk
adfb30743d TextEditor: Merge BaseTextEditorDocument into BaseTextDocument
That was the only user of that layer of abstraction.

Change-Id: I2bdc4abb8b2b33bfb70398dd11f7ecc4745ddc43
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-07-28 12:33:47 +02:00
hjk
bf5e43be94 TextEditor: Merge ITextEditor and BaseTextEditor
Adjust all callers, de-export BaseTextEditorAnimator

Change-Id: I2329d976c1398e2449844bb480a4d4ed29859506
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-07-25 13:45:55 +02:00
Nikolai Kosjar
6a700ff057 CppEditor: Extract CanonicalSymbol
Change-Id: I42c55f844c4228725251df8c985bfc275925f2ff
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-06-13 18:21:48 +02:00