[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-devel
Subject:    Re: KDevelop and Java
From:       Detlev Casanova <detlev.casanova () gmail ! com>
Date:       2012-03-15 14:02:44
Message-ID: 6298531.jeWiJ5tyz9 () naboo
[Download RAW message or body]

On Wednesday 14 March 2012 13:42:10 Detlev Casanova wrote:
> 
> On Monday 12 March 2012 13:35:19 Milian Wolff wrote:
> > On Saturday 10 March 2012 12:41:32 Detlev Casanova wrote:
> > > On Thursday 08 March 2012 12:28:15 Milian Wolff wrote:
> > > > On Thursday 08 March 2012 10:25:22 Detlev Casanova wrote:
> > > > > On Wednesday 07 March 2012 16:11:38 Aleix Pol wrote:
> > > > > > On Wed, Mar 7, 2012 at 3:33 PM, Detlev Casanova
> > > > > > 
> > > > > > <detlev.casanova@gmail.com> wrote:
> > > > > > > Hello !
> > > > > > > I'd like to know what's the status of the Java plugin for
> > > > > > > KDevelop.
> > > > > > > After
> > > > > > > having a look on the git repository, it seems that it's been a
> > > > > > > while
> > > > > > > since
> > > > > > > the last commit.
> > > > > > > 
> > > > > > > Is it unmaintained ?
> > > > > > > Has it become not interresting anymore ?
> > > > > > > 
> > > > > > > Would you like to see it back on tracks or are there other
> > > > > > > priorities
> > > > > > > ?
> > > > > > > 
> > > > > > > Detlev Casanova.
> > > > > > > 
> > > > > > > --
> > > > > > > KDevelop-devel mailing list
> > > > > > > KDevelop-devel@kdevelop.org
> > > > > > > https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
> > > > > > 
> > > > > > Script Kiddy doesn't count as maintaining. :P
> > > > > > 
> > > > > > The last time I looked (last summer) the Java language support was
> > > > > > not
> > > > > > that bad, it has to be ported to new Kate ranges interface, 
because
> > > > > > the one we used to have was deprecated some time ago.
> > > > > > 
> > > > > > Short answer: needs work, but not a huge amount of work.
> > > > > 
> > > > > I'll try to make it compile with the new range interface, then make
> > > > > sure
> > > > > it
> > > > > works and see if it can be used properly with new versions of
> > > > > kdevelop.
> > > > > 
> > > > > Do people on this mailing list and on #kdevelop know about that new
> > > > > range
> > > > > interface ? In case I have questions :-)
> > > > 
> > > > Very nice.
> > > > 
> > > > commit dcbeb493ea86547af81d5a90fa168cc152ab4efa in kdev-php might be
> > > > interesting, yet there can of course be follow-up commits that fix the
> > > > odd
> > > > bug. I can of course assist you via email/irc if I have time. Just 
drop
> > > > the
> > > > mail to this mailing list.
> > > 
> > > I hit reply to author last time, sorry.
> > > 
> > > It now compiles and KDevelop loads it properly (I would say that kdev-
php
> > > and kdev-java are based on each other, as the code is a comparable.)
> > > 
> > > It still doesn't work properly and, for instance, doesn't find errors
> > > (System.out.printlnThatDoesNotExist("Hello world"); is not underlined,
> > > which it should be I suppose...)
> > 
> > Afaiks this never worked.
> >
> > > I'll keep looking into ParseJob::run() which is the most probable place
> > > that makes it not working.
> > 
> > No, this should actually be done by the usebuilder.
> 
> I see more clearly how all those classes work together now. So I'm looking 
where the problem could come from (for instance, contexts are not properly 
found, which makes the rest not foud either)
> 
> > > Also, autocompletion doesn't work but I haven't got there yet (except 
for
> > > porting)
> > 
> > It never worked for imports, only - barely - for file-local defined stuff.
> 
> I see how this could be complicated. Maybe the whole java sources will have 
to be loaded (at least the functions definitions and variables) when the 
plugin is loaded. But the user will have to provide the java source code...
> 
> For most cases, I have a look at the kdev-php code.
> 
> > > Also, I created a kdevelop template. Can the kdev-java plugin provide 
such
> > > templates when it is installed (for instance : CMake and Java) ?
> > 
> > Sure.
> > 
> > > Is there something like an Ant plugins yet ?
> > 
> > Not to my knowledge. You can write one based on the
> > AbstractFileManagerPlugin, it is (imo) quite straight forward. If you need
> > help, just ask here.
> > > Finally, how do you prefer getting the code ? I committed it into my 
local
> > > git repo, in master. Mail ? Reviewboard ? Something else ?
> > 
> > You probably don't have a developer account yet, hence I'd like to see the
> > patch on reviewboard first. If it's multiple commits, just to get it
> > compiling, please squash the commits for review, but send them later on as
> > created by "git format-patch".
> 
> I actually had a developer account for svn, but I haven't used it in a while 
now. I'm not event sure that the public key I provided for that account is the 
one I used now...
> I'll send the first patch to reviewboard.

Mmmh, I can't login on reviewboard. my login works for svn.reviewboard.kde.org 
but not for git.reviewboard.kde.org...
I attach the patch here.

As for java parsing, the grammar caontains lots of conflicts. I don't really 
understand why but I believe it may be the source of some problems : not 
creating a DuChain because the Ast is almost empty (The only Ast node  given 
by the parser is a CompilationUnit (equivalent to the Start in the PHP 
plugin))

I don't really now how to start fixing that, I just started my Compiler course 
:)

> Thanks,
> 
> Detlev. 
["make-compile-with-new-movingrange-interface.patch" (make-compile-with-new-movingrange-interface.patch)]

From a7125ea6debc20f3775315f6c371bd99e397e222 Mon Sep 17 00:00:00 2001
From: Detlev Casanova <detlev.casanova@gmail.com>
Date: Fri, 9 Mar 2012 15:07:22 +0100
Subject: [PATCH] Make compile with the new movingranges interface.

---
 CMakeLists.txt                 |   12 +++++--
 completion/context.cpp         |    2 +-
 completion/context.h           |    4 +-
 completion/items.cpp           |    2 +-
 completion/model.cpp           |    4 +-
 completion/worker.cpp          |    2 +-
 completion/worker.h            |    2 +-
 duchain/classdeclaration.cpp   |    2 +-
 duchain/classdeclaration.h     |    4 +-
 duchain/contextbuilder.cpp     |   29 +++++-------------
 duchain/contextbuilder.h       |   11 +++----
 duchain/declarationbuilder.cpp |   28 ++++++-----------
 duchain/declarationbuilder.h   |    2 +-
 duchain/ducontext.cpp          |    4 +-
 duchain/ducontext.h            |    4 +-
 duchain/dumpchain.cpp          |   18 +++++-----
 duchain/editorintegrator.cpp   |   26 +++++++--------
 duchain/editorintegrator.h     |   31 +++++++++++-------
 duchain/expressionvisitor.cpp  |    4 +-
 duchain/identifiercompiler.cpp |    2 +-
 duchain/overloadresolver.cpp   |    4 +-
 duchain/topducontext.cpp       |    4 +-
 duchain/topducontext.h         |    4 +-
 duchain/typebuilder.cpp        |   15 ++++-----
 duchain/typebuilder.h          |   11 ++++--
 duchain/typeutils.cpp          |    9 +++--
 duchain/usebuilder.cpp         |   11 ++-----
 duchain/usebuilder.h           |    1 -
 javalanguagesupport.cpp        |    4 +-
 javalanguagesupport.h          |    2 +-
 kdevjavasupport.desktop        |    2 +-
 parsejob.cpp                   |   50 ++++++++++++++----------------
 parser/CMakeLists.txt          |    1 +
 parser/java.g                  |    2 +-
 parser/parsesession.cpp        |   65 ++++++++++++++++++++++++++++++++++-----
 parser/parsesession.h          |   22 ++++++++-----
 36 files changed, 218 insertions(+), 182 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93eebfb..63575a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,10 +11,12 @@ find_package(KDevPlatform REQUIRED)
 
 find_package(KDevelop-PG-Qt REQUIRED)
 
-include_directories(${KDEVPGQT_INCLUDE_DIR})
+message(${KDEVPGQT_INCLUDE_DIR})
 
-add_subdirectory(parser)
-add_subdirectory(settings)
+include_directories(
+    ${KDEVPGQT_INCLUDE_DIR}
+    ${KDEVPGQT_INCLUDE_DIR}/kdevelop-pg-qt
+)
 
 include_directories(
     ${CMAKE_CURRENT_SOURCE_DIR}
@@ -22,11 +24,15 @@ include_directories(
     ${KDE4_INCLUDES}
     ${KDE4_INCLUDE_DIR}/threadweaver
     ${KDE4_INCLUDE_DIR}/kdevelop-pg-qt
+    ${KDE4_INCLUDE_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR}/parser
     ${CMAKE_CURRENT_BINARY_DIR}/parser
     ${KDEVPLATFORM_INCLUDE_DIR}
 )
 
+add_subdirectory(parser)
+add_subdirectory(settings)
+
 
 ########### next target ###############
 
diff --git a/completion/context.cpp b/completion/context.cpp
index e5b512e..7eda33a 100644
--- a/completion/context.cpp
+++ b/completion/context.cpp
@@ -74,7 +74,7 @@ QString extractLastLine(const QString& str) {
 
 int completionRecursionDepth = 0;
 
-CodeCompletionContext::CodeCompletionContext(DUContextPointer context, const \
QString& text, const QString& followingText, const KDevelop::SimpleCursor& position, \
int depth, const QStringList& knownArgumentExpressions, int line) \
+CodeCompletionContext::CodeCompletionContext(DUContextPointer context, const \
QString& text, const QString& followingText, const KDevelop::CursorInRevision& \
position, int depth, const QStringList& knownArgumentExpressions, int line)  : \
KDevelop::CodeCompletionContext(context, text, position, depth)  , \
m_memberAccessOperation(NoMemberAccess), m_followingText( followingText ),   \
                m_knownArgumentExpressions( knownArgumentExpressions)
diff --git a/completion/context.h b/completion/context.h
index afefe08..80135cb 100644
--- a/completion/context.h
+++ b/completion/context.h
@@ -55,7 +55,7 @@ namespace java {
        * @param text the text to analyze. It usually is the text in the range \
starting at the beginning of the context, and ending at the position where completion \
                should start
        * @warning The du-chain must be unlocked when this is called
        * */
-      CodeCompletionContext(KDevelop::DUContextPointer context, const QString& text, \
const QString &followingText, const KDevelop::SimpleCursor& cursor, int depth = 0, \
const QStringList &knownArgumentExpressions = QStringList(), int line = -1); +      \
CodeCompletionContext(KDevelop::DUContextPointer context, const QString& text, const \
QString &followingText, const KDevelop::CursorInRevision& cursor, int depth = 0, \
const QStringList &knownArgumentExpressions = QStringList(), int line = -1);  \
~CodeCompletionContext();  
       ///Computes the full set of completion items, using the information retrieved \
earlier. @@ -63,7 +63,7 @@ namespace java {
       ///@param Abort is checked regularly, and if it is false, the computation is \
                aborted.
       virtual QList<KDevelop::CompletionTreeItemPointer> completionItems(bool& \
abort, bool fullCompletion = true);  
-      void standardAccessCompletionItems(/*const KDevelop::SimpleCursor& position,*/ \
QList<KDevelop::CompletionTreeItemPointer>& items); +      void \
standardAccessCompletionItems(/*const KDevelop::CursorInRevision& position,*/ \
QList<KDevelop::CompletionTreeItemPointer>& items);  
       bool isValidPosition() const;
 
diff --git a/completion/items.cpp b/completion/items.cpp
index 86795d6..ae01684 100644
--- a/completion/items.cpp
+++ b/completion/items.cpp
@@ -52,7 +52,7 @@ void \
NormalDeclarationCompletionItem::executed(KTextEditor::Document* document,  {
   if( m_declaration && \
dynamic_cast<AbstractFunctionDeclaration*>(m_declaration.data()) ) {  //Do some \
                intelligent stuff for functions with the parens:
-    insertFunctionParenText(document, word, m_declaration);
+    insertFunctionParenText(document, word.end(), m_declaration);
   }
 }
 
diff --git a/completion/model.cpp b/completion/model.cpp
index 3afed23..784e8ea 100644
--- a/completion/model.cpp
+++ b/completion/model.cpp
@@ -40,7 +40,7 @@
 #include <language/duchain/ducontext.h>
 #include <language/duchain/duchain.h>
 #include <language/duchain/parsingenvironment.h>
-#include <language/editor/editorintegrator.h>
+//#include <language/editor/editorintegrator.h>
 #include <language/duchain/duchainlock.h>
 #include <language/duchain/duchainbase.h>
 #include <language/duchain/topducontext.h>
@@ -50,7 +50,7 @@
 #include "worker.h"
 #include "javalanguagesupport.h"
 
-using namespace KTextEditor;
+//using namespace KTextEditor;
 using namespace KDevelop;
 
 namespace java {
diff --git a/completion/worker.cpp b/completion/worker.cpp
index d26c9fc..df9a9f8 100644
--- a/completion/worker.cpp
+++ b/completion/worker.cpp
@@ -46,7 +46,7 @@ CodeCompletionWorker::CodeCompletionWorker(CodeCompletionModel* \
parent)  {
 }
 
-KDevelop::CodeCompletionContext* \
CodeCompletionWorker::createCompletionContext(KDevelop::DUContextPointer context, \
const QString &contextText, const QString &followingText, const \
KDevelop::SimpleCursor &position) const +KDevelop::CodeCompletionContext* \
CodeCompletionWorker::createCompletionContext(KDevelop::DUContextPointer context, \
const QString &contextText, const QString &followingText, const \
KDevelop::CursorInRevision &position) const  {
   return new java::CodeCompletionContext(context, contextText, followingText, \
position);  }
diff --git a/completion/worker.h b/completion/worker.h
index 34c6e96..3c1d8fc 100644
--- a/completion/worker.h
+++ b/completion/worker.h
@@ -40,7 +40,7 @@ class CodeCompletionWorker : public KDevelop::CodeCompletionWorker
     CodeCompletionWorker(CodeCompletionModel* parent);
     
   protected:
-    virtual KDevelop::CodeCompletionContext* \
createCompletionContext(KDevelop::DUContextPointer context, const QString \
&contextText, const QString &followingText, const KDevelop::SimpleCursor &position) \
const; +    virtual KDevelop::CodeCompletionContext* \
createCompletionContext(KDevelop::DUContextPointer context, const QString \
&contextText, const QString &followingText, const KDevelop::CursorInRevision \
&position) const;  
 };
 
diff --git a/duchain/classdeclaration.cpp b/duchain/classdeclaration.cpp
index 28bfc34..b0ac15c 100644
--- a/duchain/classdeclaration.cpp
+++ b/duchain/classdeclaration.cpp
@@ -30,7 +30,7 @@ namespace java {
 
 DEFINE_LIST_MEMBER_HASH(ClassDeclarationData, baseClasses, BaseClassInstance)
 
-ClassDeclaration::ClassDeclaration(const KDevelop::SimpleRange& range, DUContext* \
context) +ClassDeclaration::ClassDeclaration(const KDevelop::RangeInRevision& range, \
DUContext* context)  : ClassMemberDeclaration(*new ClassDeclarationData, range)
 {
   d_func_dynamic()->setClassId(this);
diff --git a/duchain/classdeclaration.h b/duchain/classdeclaration.h
index 4f6faf5..d281c5d 100644
--- a/duchain/classdeclaration.h
+++ b/duchain/classdeclaration.h
@@ -31,7 +31,7 @@ namespace KDevelop {
   class DUContext;
   class TopDUContext;
   class HashedString;
-  class SimpleRange;
+  class RangeInRevision;
 }
 
 namespace java {
@@ -80,7 +80,7 @@ class ClassDeclaration : public KDevelop::ClassMemberDeclaration
 public:
   ClassDeclaration(const ClassDeclaration& rhs);
   ClassDeclaration(ClassDeclarationData& data);
-  ClassDeclaration(const KDevelop::SimpleRange& range, KDevelop::DUContext* \
context); +  ClassDeclaration(const KDevelop::RangeInRevision& range, \
KDevelop::DUContext* context);  ~ClassDeclaration();
 
   void clearBaseClasses();
diff --git a/duchain/contextbuilder.cpp b/duchain/contextbuilder.cpp
index 0d26d43..c028fa7 100644
--- a/duchain/contextbuilder.cpp
+++ b/duchain/contextbuilder.cpp
@@ -32,13 +32,13 @@
 #include "topducontext.h"
 #include "ducontext.h"
 
-using namespace KTextEditor;
 using namespace KDevelop;
 
 namespace java {
 
 ContextBuilder::ContextBuilder()
   : m_identifierCompiler(0)
+  , m_editor(0)
   , m_mapAst(false)
   , m_computeOnlyVisible(false)
 {
@@ -81,16 +81,16 @@ bool ContextBuilder::hadUnresolvedIdentifiers() const
   return !m_unresolvedIDs.isEmpty();
 }
 
-KDevelop::TopDUContext* ContextBuilder::newTopContext(const KDevelop::SimpleRange& \
range, KDevelop::ParsingEnvironmentFile* file) +KDevelop::TopDUContext* \
ContextBuilder::newTopContext(const KDevelop::RangeInRevision& range, \
KDevelop::ParsingEnvironmentFile* file)  {
   if (!file) {
-      file = new ParsingEnvironmentFile(editor()->currentUrl());
+      file = new ParsingEnvironmentFile(editor()->parseSession()->currentDocument());
                
       /// Indexed string for 'Java', identifies environment files from this language \
plugin  static const IndexedString javaLangString("Java");
       file->setLanguage(javaLangString);
   }
 
-  TopDUContext* top = new java::TopDUContext(editor()->currentUrl(), range, file);
+  TopDUContext* top = new \
java::TopDUContext(editor()->parseSession()->currentDocument(), range, file);  
   Q_ASSERT(top);
   Q_ASSERT(JavaLanguageSupport::self()->allJavaContext());
@@ -100,24 +100,11 @@ KDevelop::TopDUContext* ContextBuilder::newTopContext(const \
KDevelop::SimpleRang  return top;
 }
 
-KDevelop::DUContext* ContextBuilder::newContext(const KDevelop::SimpleRange& range) \
{ +KDevelop::DUContext* ContextBuilder::newContext(const KDevelop::RangeInRevision& \
range) {  return new java::DUContext(range, currentContext());
 }
 
 
-void ContextBuilder::setEditor(EditorIntegrator* editor)
-{
-  m_identifierCompiler = new IdentifierCompiler(editor->parseSession());
-  ContextBuilderBase::setEditor(editor, false);
-}
-
-void ContextBuilder::setEditor(ParseSession* session)
-{
-  EditorIntegrator* e = new EditorIntegrator(session);
-  m_identifierCompiler = new IdentifierCompiler(e->parseSession());
-  ContextBuilderBase::setEditor(e, true);
-}
-
 ContextBuilder::~ContextBuilder ()
 {
   delete m_identifierCompiler;
@@ -140,12 +127,12 @@ KDevelop::DUContext* ContextBuilder::contextFromNode( AstNode* \
node )  
 EditorIntegrator* ContextBuilder::editor() const
 {
-  return static_cast<EditorIntegrator*>(ContextBuilderBase::editor());
+  return m_editor;
 }
 
-KTextEditor::Range ContextBuilder::editorFindRange( AstNode* fromRange, AstNode* \
toRange ) +KDevelop::RangeInRevision ContextBuilder::editorFindRange( AstNode* \
fromRange, AstNode* toRange )  {
-  return editor()->findRange(fromRange, toRange).textRange();
+  return editor()->findRange(fromRange, toRange);
 }
 
 QualifiedIdentifier ContextBuilder::identifierForNode(IdentifierAst* id)
diff --git a/duchain/contextbuilder.h b/duchain/contextbuilder.h
index 6f799c5..599c41e 100644
--- a/duchain/contextbuilder.h
+++ b/duchain/contextbuilder.h
@@ -24,6 +24,7 @@
 
 #include <language/duchain/builders/abstractcontextbuilder.h>
 
+#include "editorintegrator.h"
 #include "classdeclaration.h"
 
 class JavaLanguageSupport;
@@ -45,9 +46,6 @@ public:
   ContextBuilder();
   virtual ~ContextBuilder ();
 
-  void setEditor(EditorIntegrator* editor);
-  void setEditor(ParseSession* session);
-
   typedef QPair<KDevelop::DUContextPointer, KDevelop::QualifiedIdentifier> \
ContextID;  const QList<ContextID>& unresolvedIdentifiers() const;
   bool hadUnresolvedIdentifiers() const;
@@ -59,13 +57,13 @@ public:
 protected:
   EditorIntegrator* editor() const;
 
-  virtual KDevelop::TopDUContext* newTopContext(const KDevelop::SimpleRange& range, \
                KDevelop::ParsingEnvironmentFile* file = 0);
-  virtual KDevelop::DUContext* newContext(const KDevelop::SimpleRange& range);
+  virtual KDevelop::TopDUContext* newTopContext(const KDevelop::RangeInRevision& \
range, KDevelop::ParsingEnvironmentFile* file = 0); +  virtual KDevelop::DUContext* \
newContext(const KDevelop::RangeInRevision& range);  
   virtual void startVisiting( AstNode* node );
   virtual void setContextOnNode( AstNode* node, KDevelop::DUContext* ctx );
   virtual KDevelop::DUContext* contextFromNode( AstNode* node );
-  virtual KTextEditor::Range editorFindRange( AstNode* fromRange, AstNode* toRange \
); +  virtual KDevelop::RangeInRevision editorFindRange( AstNode* fromRange, AstNode* \
toRange );  
   /**
    * Compile an identifier for the specified AstNode \a id.
@@ -112,6 +110,7 @@ protected:
 
   // Variables
   IdentifierCompiler* m_identifierCompiler;
+  EditorIntegrator *m_editor;
 
 private:
   QList<ContextID> m_unresolvedIDs;
diff --git a/duchain/declarationbuilder.cpp b/duchain/declarationbuilder.cpp
index ed263a9..ec19b94 100644
--- a/duchain/declarationbuilder.cpp
+++ b/duchain/declarationbuilder.cpp
@@ -20,9 +20,6 @@
 
 #include <QByteArray>
 
-#include <ktexteditor/smartrange.h>
-#include <ktexteditor/smartinterface.h>
-
 #include "editorintegrator.h"
 #include "identifiercompiler.h"
 #include <language/duchain/functiondeclaration.h>
@@ -32,25 +29,17 @@
 #include <language/duchain/namespacealiasdeclaration.h>
 #include "javalanguagesupport.h"
 
-using namespace KTextEditor;
 using namespace KDevelop;
 
 namespace java {
 
 QualifiedIdentifier javaLang("java::lang::*");
 
-DeclarationBuilder::DeclarationBuilder (ParseSession* session)
-  : m_defaultImportCreated(false)
-  , m_inImplementsClause(false)
-{
-  setEditor(session);
-}
-
 DeclarationBuilder::DeclarationBuilder (EditorIntegrator* editor)
   : m_defaultImportCreated(false)
   , m_inImplementsClause(false)
 {
-  setEditor(editor);
+	m_editor = editor;
 }
 
 void DeclarationBuilder::closeDeclaration()
@@ -94,7 +83,8 @@ void DeclarationBuilder::visitClassDeclaration(ClassDeclarationAst \
* node)  // Provide java.lang.Object inheritance where it is not specified
   DUChainWriteLocker lock(DUChain::lock());
   //TODO : only count objects, not interfaces, in this check
-  if (buildCompleteTypes() && newClass->baseClassesSize() == 0) {
+  //TODO:reactivate this part !
+  /*if (buildCompleteTypes() && newClass->baseClassesSize() == 0) {
     static QualifiedIdentifier javaLangObject("java::lang::Object");
     if (newClass->qualifiedIdentifier() != javaLangObject) {
       QList<Declaration*> declarations = \
currentContext()->findDeclarations(javaLangObject, currentContext()->range().end, \
AbstractType::Ptr(), currentContext()->topContext()); @@ -114,7 +104,7 @@ void \
DeclarationBuilder::visitClassDeclaration(ClassDeclarationAst * node)  kDebug() << \
"Couldn't find declaration for java.lang.Object";  }
     }
-  }
+  }*/
   closeDeclaration();
 }
 
@@ -133,7 +123,8 @@ void \
DeclarationBuilder::visitClassExtendsClause(java::ClassExtendsClauseAst* no  {
   DeclarationBuilderBase::visitClassExtendsClause(node);
 
-  if (buildCompleteTypes()) {
+  //if (buildCompleteTypes())
+  {
     BaseClassInstance instance;
     {
       DUChainWriteLocker lock(DUChain::lock());
@@ -174,7 +165,8 @@ void \
DeclarationBuilder::visitClassOrInterfaceTypeName(ClassOrInterfaceTypeNameA  {
   DeclarationBuilderBase::visitClassOrInterfaceTypeName(node);
 
-  if (buildCompleteTypes()) {
+  //if (buildCompleteTypes())
+  {
     if (m_inImplementsClause) {
       BaseClassInstance instance;
       {
@@ -328,7 +320,7 @@ void \
DeclarationBuilder::visitImportDeclaration(ImportDeclarationAst* node)  \
Q_ASSERT(javaLang.count() == 3);  
     DUChainWriteLocker lock(DUChain::lock());
-    NamespaceAliasDeclaration* decl = \
openDeclaration<NamespaceAliasDeclaration>(QualifiedIdentifier(globalImportIdentifier()), \
SimpleRange()); +    NamespaceAliasDeclaration* decl = \
openDeclaration<NamespaceAliasDeclaration>(QualifiedIdentifier(globalImportIdentifier()), \
RangeInRevision());  decl->setImportIdentifier(javaLang);
     closeDeclaration();
     m_defaultImportCreated = true;
@@ -366,7 +358,7 @@ void \
DeclarationBuilder::visitPackageDeclaration(java::PackageDeclarationAst* no  if (node \
&& node->packageName) {  // Use this to import other items from the package
     QualifiedIdentifier id = identifierForNode(node->packageName);
-    KDevelop::SimpleRange range = editorFindRange(node->packageName, \
node->packageName); +    KDevelop::RangeInRevision range = \
editorFindRange(node->packageName, node->packageName);  
     {
       DUChainWriteLocker lock(DUChain::lock());
diff --git a/duchain/declarationbuilder.h b/duchain/declarationbuilder.h
index 28fcd74..d62681c 100644
--- a/duchain/declarationbuilder.h
+++ b/duchain/declarationbuilder.h
@@ -21,6 +21,7 @@
 
 #include "typebuilder.h"
 #include <language/duchain/builders/abstractdeclarationbuilder.h>
+#include <language/duchain/classdeclaration.h>
 
 namespace java {
 
@@ -34,7 +35,6 @@ typedef KDevelop::AbstractDeclarationBuilder<AstNode, \
IdentifierAst, java::TypeB  class DeclarationBuilder: public DeclarationBuilderBase
 {
 public:
-  DeclarationBuilder(ParseSession* session);
   DeclarationBuilder(EditorIntegrator* editor);
 
 protected:
diff --git a/duchain/ducontext.cpp b/duchain/ducontext.cpp
index 0224199..f370e78 100644
--- a/duchain/ducontext.cpp
+++ b/duchain/ducontext.cpp
@@ -24,7 +24,7 @@ using namespace KDevelop;
 
 namespace java {
 
-DUContext::DUContext(const KDevelop::SimpleRange& range, KDevelop::DUContext* \
parent, bool anonymous) +DUContext::DUContext(const KDevelop::RangeInRevision& range, \
KDevelop::DUContext* parent, bool anonymous)  : KDevelop::DUContext(range, parent, \
anonymous)  {
 }
@@ -39,7 +39,7 @@ REGISTER_DUCHAIN_ITEM(DUContext);
 
 const uint maxParentDepth = 20;
 
-bool DUContext::findDeclarationsInternal(const SearchItem::PtrList& identifiers, \
const KDevelop::SimpleCursor& position, const KDevelop::AbstractType::Ptr& dataType, \
DeclarationList& ret, const KDevelop::TopDUContext* source, SearchFlags flags, uint \
depth) const { +bool DUContext::findDeclarationsInternal(const SearchItem::PtrList& \
identifiers, const KDevelop::CursorInRevision& position, const \
KDevelop::AbstractType::Ptr& dataType, DeclarationList& ret, const \
KDevelop::TopDUContext* source, SearchFlags flags, uint depth) const {  if (depth > \
maxParentDepth) {  kDebug() << "maximum depth reached in" << scopeIdentifier(true);
     return false;
diff --git a/duchain/ducontext.h b/duchain/ducontext.h
index 3ea0010..b6678d9 100644
--- a/duchain/ducontext.h
+++ b/duchain/ducontext.h
@@ -35,7 +35,7 @@ public:
 class DUContext : public KDevelop::DUContext
 {
 public:
-  explicit DUContext(const KDevelop::SimpleRange& range, KDevelop::DUContext* parent \
= 0, bool anonymous = false); +  explicit DUContext(const KDevelop::RangeInRevision& \
range, KDevelop::DUContext* parent = 0, bool anonymous = false);  explicit \
DUContext(DUContextData&);  
   enum {
@@ -43,7 +43,7 @@ public:
   };
 
 protected:
-  virtual bool findDeclarationsInternal(const SearchItem::PtrList& identifiers, \
const KDevelop::SimpleCursor& position, const KDevelop::AbstractType::Ptr& dataType, \
DeclarationList& ret, const KDevelop::TopDUContext* source, SearchFlags flags, uint \
depth) const; +  virtual bool findDeclarationsInternal(const SearchItem::PtrList& \
identifiers, const KDevelop::CursorInRevision& position, const \
KDevelop::AbstractType::Ptr& dataType, DeclarationList& ret, const \
KDevelop::TopDUContext* source, SearchFlags flags, uint depth) const;  
 private:
   DUCHAIN_DECLARE_DATA(DUContext)
diff --git a/duchain/dumpchain.cpp b/duchain/dumpchain.cpp
index f0cf9e4..b1c1270 100644
--- a/duchain/dumpchain.cpp
+++ b/duchain/dumpchain.cpp
@@ -206,8 +206,8 @@ void DumpChain::visitNode(AstNode *node)
 
 
       kDebug() << indentation <<  "\\" << names[node->kind - 1000]
-              << "[" << node->startToken << m_editor->findPosition(node->startToken, \
                EditorIntegrator::FrontEdge).textCursor() << ", "
-              << node->endToken << m_editor->findPosition(node->endToken, \
EditorIntegrator::BackEdge).textCursor() << "]" << nodeText << endl; +              \
<< "[" << node->startToken << m_editor->findPosition(node->startToken, \
EditorIntegrator::FrontEdge) << ", " +              << node->endToken << \
m_editor->findPosition(node->endToken, EditorIntegrator::BackEdge) << "]" << nodeText \
<< endl;  } else {
       kDebug() << indentation << "\\" << names[node->kind - 1000]
               << "[" << node->startToken << "," << node->endToken << "]" << endl;
@@ -222,7 +222,7 @@ void DumpChain::visitNode(AstNode *node)
     if (m_editor) {
       kDebug() << indentation << "/" << names[node->kind - 1000]
               << "[("  << node->endToken << ") "/*<< \
                m_editor->findPosition(node->startToken, EditorIntegrator::FrontEdge) \
                << ", "*/
-              << m_editor->findPosition(node->endToken, \
EditorIntegrator::FrontEdge).textCursor() << "]" << endl; +              << \
m_editor->findPosition(node->endToken, EditorIntegrator::FrontEdge) << "]" << endl;  \
} else {  kDebug() << indentation << "/" << names[node->kind - 1000]
               << "[" << node->startToken << "," << node->endToken << ']' << endl;
@@ -237,18 +237,18 @@ DumpChain::~ DumpChain( )
 
 void DumpChain::dump( DUContext * context, bool imported )
 {
-  kDebug() << QString(indent * 2, ' ') << (imported ? "==import==> Context " : "New \
Context ") << context << "\"" <<  context->localScopeIdentifier() << "\" [" << \
context->scopeIdentifier() << "]" << context->range().textRange() << " " << \
(dynamic_cast<TopDUContext*>(context) ? "top-context" : ""); +  kDebug() << \
QString(indent * 2, ' ') << (imported ? "==import==> Context " : "New Context ") << \
context << "\"" <<  context->localScopeIdentifier() << "\" [" << \
context->scopeIdentifier() << "]" << context->range() << " " << \
(dynamic_cast<TopDUContext*>(context) ? "top-context" : "");  if( !context )
     return;
   if (!imported) {
     foreach (Declaration* dec, context->localDeclarations()) {
 
-      kDebug() << QString((indent+1) * 2, ' ') << "Declaration: " << dec->toString() \
<< /*(idType ? (" (type-identity: " + idType->identifier().toString() + ")") : \
QString()) <<*/ " [" << dec->qualifiedIdentifier() << "]" << dec << "(internal ctx" \
<< dec->internalContext() << ")" << dec->range().textRange() << "," << \
(dec->isDefinition() ? "definition, " : "declaration, ") << dec->uses().count() << \
                "use(s)," << (dec->inSymbolTable() ? " in symbol table" : " not in \
                symbol table");
-      QMap<IndexedString, QList<SimpleRange> > uses = dec->uses();
-      for(QMap<IndexedString, QList<SimpleRange> >::const_iterator it = \
uses.begin(); it != uses.end(); ++it) { +      kDebug() << QString((indent+1) * 2, ' \
') << "Declaration: " << dec->toString() << /*(idType ? (" (type-identity: " + \
idType->identifier().toString() + ")") : QString()) <<*/ " [" << \
dec->qualifiedIdentifier() << "]" << dec << "(internal ctx" << dec->internalContext() \
<< ")" << dec->range() << "," << (dec->isDefinition() ? "definition, " : \
"declaration, ") << dec->uses().count() << "use(s)," << (dec->inSymbolTable() ? " in \
symbol table" : " not in symbol table"); +      QMap<IndexedString, \
QList<RangeInRevision> > uses = dec->uses(); +      for(QMap<IndexedString, \
                QList<RangeInRevision> >::const_iterator it = uses.begin(); it != \
                uses.end(); ++it) {
         kDebug() << QString((indent+2) * 2, ' ') << "File:" << it.key().str();
-        foreach (const SimpleRange& range, *it)
-          kDebug() << QString((indent+2) * 2+1, ' ') << "Use:" << range.textRange();
+        foreach (const RangeInRevision& range, *it)
+          kDebug() << QString((indent+2) * 2+1, ' ') << "Use:" << range;
       }
     }
   }
diff --git a/duchain/editorintegrator.cpp b/duchain/editorintegrator.cpp
index 161f9ea..c62a4ca 100644
--- a/duchain/editorintegrator.cpp
+++ b/duchain/editorintegrator.cpp
@@ -19,8 +19,6 @@
 #include "editorintegrator.h"
 
 #include <ktexteditor/document.h>
-#include <ktexteditor/smartrange.h>
-#include <ktexteditor/smartinterface.h>
 
 #include <language/editor/documentrange.h>
 #include <language/editor/documentrangeobject.h>
@@ -28,7 +26,7 @@
 #include "javaast.h"
 #include "parsesession.h"
 
-using namespace KTextEditor;
+//using namespace KTextEditor;
 using namespace java;
 
 EditorIntegrator::EditorIntegrator( ParseSession* session )
@@ -36,13 +34,13 @@ EditorIntegrator::EditorIntegrator( ParseSession* session )
 {
 }
 
-KDevelop::SimpleCursor EditorIntegrator::findPosition( qint64 token, Edge edge ) \
const +KDevelop::CursorInRevision EditorIntegrator::findPosition( qint64 token, Edge \
edge ) const  {
-  const KDevPG::TokenStream::Token& t = m_session->tokenStream->token(token);
+  const KDevPG::TokenStream::Token& t = m_session->tokenStream->at(token);
   return findPosition(t, edge);
 }
 
-KDevelop::SimpleCursor EditorIntegrator::findPosition( const \
KDevPG::TokenStream::Token & token, Edge edge ) const +KDevelop::CursorInRevision \
EditorIntegrator::findPosition( const KDevPG::TokenStream::Token & token, Edge edge ) \
const  {
   if(edge == BackEdge)
     return m_session->positionAt(token.end);
@@ -50,25 +48,25 @@ KDevelop::SimpleCursor EditorIntegrator::findPosition( const \
KDevPG::TokenStream  return m_session->positionAt(token.begin);
 }
 
-KDevelop::SimpleRange EditorIntegrator::findRange( AstNode * node, RangeEdge edge )
+KDevelop::RangeInRevision EditorIntegrator::findRange( AstNode * node, RangeEdge \
edge )  {
   Q_UNUSED(edge);
-  return KDevelop::SimpleRange(findPosition(node->startToken, FrontEdge), \
findPosition(node->endToken, BackEdge)); +  return \
KDevelop::RangeInRevision(findPosition(node->startToken, FrontEdge), \
findPosition(node->endToken, BackEdge));  }
 
-KDevelop::SimpleRange EditorIntegrator::findRange( qint64 startToken, qint64 \
endToken ) +KDevelop::RangeInRevision EditorIntegrator::findRange( qint64 startToken, \
qint64 endToken )  {
-  return KDevelop::SimpleRange(findPosition(startToken, FrontEdge), \
findPosition(endToken, BackEdge)); +  return \
KDevelop::RangeInRevision(findPosition(startToken, FrontEdge), findPosition(endToken, \
BackEdge));  }
 
-KDevelop::SimpleRange EditorIntegrator::findRange(AstNode* from, AstNode* to)
+KDevelop::RangeInRevision EditorIntegrator::findRange(AstNode* from, AstNode* to)
 {
-  return KDevelop::SimpleRange(findPosition(from->startToken, FrontEdge), \
findPosition(to->endToken, BackEdge)); +  return \
KDevelop::RangeInRevision(findPosition(from->startToken, FrontEdge), \
findPosition(to->endToken, BackEdge));  }
 
-KDevelop::SimpleRange EditorIntegrator::findRange( const KDevPG::TokenStream::Token \
& token ) +KDevelop::RangeInRevision EditorIntegrator::findRange( const \
KDevPG::TokenStream::Token & token )  {
-  return KDevelop::SimpleRange(findPosition(token, FrontEdge), findPosition(token, \
BackEdge)); +  return KDevelop::RangeInRevision(findPosition(token, FrontEdge), \
findPosition(token, BackEdge));  }
 
 QString EditorIntegrator::tokenToString(qint64 token) const
diff --git a/duchain/editorintegrator.h b/duchain/editorintegrator.h
index b2bfd5a..c8ae841 100644
--- a/duchain/editorintegrator.h
+++ b/duchain/editorintegrator.h
@@ -19,8 +19,7 @@
 #ifndef JAVAEDITORINTEGRATOR_H
 #define JAVAEDITORINTEGRATOR_H
 
-#include <language/editor/editorintegrator.h>
-#include <language/editor/simplerange.h>
+#include <language/editor/rangeinrevision.h>
 
 #include "kdev-pg-token-stream.h"
 
@@ -38,13 +37,23 @@ class AstNode;
  *
  * \todo introduce stacks for the state?
  */
-class EditorIntegrator : public KDevelop::EditorIntegrator
+class EditorIntegrator
 {
 public:
   EditorIntegrator(ParseSession* session);
 
   ParseSession* parseSession() const;
 
+  enum Edge {
+    FrontEdge,
+    BackEdge
+  };
+
+  enum RangeEdge {
+    InnerEdge,
+    OuterEdge
+  };
+
   /**
    * Finds the location and \a file where the given \a token was parsed from.  This \
                function
    * does not change any of the EditorIntegrator's state.
@@ -54,7 +63,7 @@ public:
    *
    * \returns the requested cursor relating to the start or end of the given token.
    */
-  KDevelop::SimpleCursor findPosition(const KDevPG::TokenStream::Token& token, Edge \
edge = BackEdge) const; +  KDevelop::CursorInRevision findPosition(const \
KDevPG::TokenStream::Token& token, Edge edge = BackEdge) const;  
   /**
    * Finds the location and \a file where the given \a token was parsed from.
@@ -65,9 +74,7 @@ public:
    *
    * \returns the requested cursor relating to the start or end of the given token.
    */
-  KDevelop::SimpleCursor findPosition(qint64 token, Edge edge = BackEdge) const;
-
-  using KDevelop::EditorIntegrator::createRange;
+  KDevelop::CursorInRevision findPosition(qint64 token, Edge edge = BackEdge) const;
 
   /**
    * Create a range encompassing the given AstNode \a node.
@@ -75,7 +82,7 @@ public:
    *
    * \overload
    */
-  KDevelop::SimpleRange findRange(AstNode* node, RangeEdge = OuterEdge);
+  KDevelop::RangeInRevision findRange(AstNode* node, RangeEdge = OuterEdge);
 
   /**
    * Create a range encompassing the given AstNode \a nodes.
@@ -83,7 +90,7 @@ public:
    *
    * \overload
    */
-  KDevelop::SimpleRange findRange(AstNode* from, AstNode* to);
+  KDevelop::RangeInRevision findRange(AstNode* from, AstNode* to);
 
   /**
    * Create a range encompassing the given AstNode \a token.
@@ -91,7 +98,7 @@ public:
    *
    * \overload
    */
-  KDevelop::SimpleRange findRange(const KDevPG::TokenStream::Token& token);
+  KDevelop::RangeInRevision findRange(const KDevPG::TokenStream::Token& token);
 
   /**
    * Create a range encompassing the given AstNode \a token.
@@ -99,7 +106,7 @@ public:
    *
    * \overload
    */
-  KDevelop::SimpleRange findRange(qint64 token);
+  KDevelop::RangeInRevision findRange(qint64 token);
 
   /**
    * Create a range encompassing the given AstNode \a tokens.
@@ -107,7 +114,7 @@ public:
    *
    * \overload
    */
-  KDevelop::SimpleRange findRange(qint64 start_token, qint64 end_token);
+  KDevelop::RangeInRevision findRange(qint64 start_token, qint64 end_token);
 
   /**
    * Retrieve the string represented by a token.
diff --git a/duchain/expressionvisitor.cpp b/duchain/expressionvisitor.cpp
index a3e0207..28ca73c 100644
--- a/duchain/expressionvisitor.cpp
+++ b/duchain/expressionvisitor.cpp
@@ -520,8 +520,8 @@ void ExpressionVisitor::visitPrimaryAtom(PrimaryAtomAst* node) {
     QualifiedIdentifier id = identifierForNode(node->simpleNameAccess->name);
 
     DUChainReadLocker lock(DUChain::lock());
-    KTextEditor::Cursor start = editorFindRange(node, node).start();
-    QList<Declaration*> decls = currentContext()->findDeclarations(id, \
SimpleCursor(start)); +    KDevelop::CursorInRevision start = editorFindRange(node, \
node).start; +    QList<Declaration*> decls = currentContext()->findDeclarations(id, \
start);  if (!decls.isEmpty()) {
       setLastInstance(decls.first());
       useDecl = decls.first();
diff --git a/duchain/identifiercompiler.cpp b/duchain/identifiercompiler.cpp
index aaad037..548c963 100644
--- a/duchain/identifiercompiler.cpp
+++ b/duchain/identifiercompiler.cpp
@@ -57,7 +57,7 @@ uint parseConstVolatile(ParseSession* session, const \
KDevPG::ListNode<qint64> *c  const KDevPG::ListNode<qint64> *it = cv->front();
     const KDevPG::ListNode<qint64> *end = it;
     do {
-      int kind = session->tokenStream->token(it->element).kind;
+      int kind = session->tokenStream->at(it->element).kind;
       if (kind == Parser::Token_CONST)
         ret |= AbstractType::ConstModifier;
       else if (kind == Parser::Token_VOLATILE)
diff --git a/duchain/overloadresolver.cpp b/duchain/overloadresolver.cpp
index 26b88fd..49532ef 100644
--- a/duchain/overloadresolver.cpp
+++ b/duchain/overloadresolver.cpp
@@ -44,7 +44,7 @@ Declaration* OverloadResolver::resolveConstructor( const \
ParameterList& params,  QList<Declaration*> goodDeclarations;
     Identifier id = m_context->localScopeIdentifier().last();
     id.clearTemplateIdentifiers();
-    QList<Declaration*> declarations = m_context->findLocalDeclarations(id, \
KDevelop::SimpleCursor(), m_topContext.data(), AbstractType::Ptr(), \
DUContext::OnlyFunctions); +    QList<Declaration*> declarations = \
m_context->findLocalDeclarations(id, KDevelop::CursorInRevision(), \
m_topContext.data(), AbstractType::Ptr(), DUContext::OnlyFunctions);  
     for( QList<Declaration*>::iterator it = declarations.begin(); it != \
declarations.end(); ++it ) {  if( (*it)->indexedType() )
@@ -72,7 +72,7 @@ Declaration* OverloadResolver::resolve( const ParameterList& \
params, const Quali  if( !m_context || !m_topContext )
     return 0;
 
-  QList<Declaration*> declarations = m_context->findDeclarations(functionName, \
KDevelop::SimpleCursor(), AbstractType::Ptr(), m_topContext.data()); +  \
QList<Declaration*> declarations = m_context->findDeclarations(functionName, \
KDevelop::CursorInRevision(), AbstractType::Ptr(), m_topContext.data());  
   return resolveList(params, declarations, noUserDefinedConversion );
 }
diff --git a/duchain/topducontext.cpp b/duchain/topducontext.cpp
index df88aed..38dd9ed 100644
--- a/duchain/topducontext.cpp
+++ b/duchain/topducontext.cpp
@@ -32,7 +32,7 @@ using namespace KDevelop;
 
 namespace java {
 
-TopDUContext::TopDUContext(const KDevelop::IndexedString& url, const \
KDevelop::SimpleRange& range, KDevelop::ParsingEnvironmentFile* file) \
+TopDUContext::TopDUContext(const KDevelop::IndexedString& url, const \
KDevelop::RangeInRevision& range, KDevelop::ParsingEnvironmentFile* file)  : \
KDevelop::TopDUContext(url, range, file)  {
 }
@@ -62,7 +62,7 @@ struct TopDUContext::FindDeclarationsAcceptor
   const DeclarationChecker& check;
 };
 
-bool TopDUContext::findDeclarationsInternal(const SearchItem::PtrList& identifiers, \
const SimpleCursor& position, const AbstractType::Ptr& dataType, DeclarationList& \
ret, const KDevelop::TopDUContext* source, SearchFlags flags, uint depth) const +bool \
TopDUContext::findDeclarationsInternal(const SearchItem::PtrList& identifiers, const \
CursorInRevision& position, const AbstractType::Ptr& dataType, DeclarationList& ret, \
const KDevelop::TopDUContext* source, SearchFlags flags, uint depth) const  {
   Q_UNUSED(source);
   Q_UNUSED(depth);
diff --git a/duchain/topducontext.h b/duchain/topducontext.h
index d093186..e87d075 100644
--- a/duchain/topducontext.h
+++ b/duchain/topducontext.h
@@ -38,7 +38,7 @@ public:
 class TopDUContext : public KDevelop::TopDUContext
 {
   public:
-    explicit TopDUContext(const KDevelop::IndexedString& url, const \
KDevelop::SimpleRange& range, KDevelop::ParsingEnvironmentFile* file = 0); +    \
explicit TopDUContext(const KDevelop::IndexedString& url, const \
KDevelop::RangeInRevision& range, KDevelop::ParsingEnvironmentFile* file = 0);  \
explicit TopDUContext(TopDUContextData& data);  
   enum {
@@ -46,7 +46,7 @@ class TopDUContext : public KDevelop::TopDUContext
   };
 
   protected:
-    virtual bool findDeclarationsInternal(const SearchItem::PtrList& identifiers, \
const KDevelop::SimpleCursor& position, const KDevelop::AbstractType::Ptr& dataType, \
DeclarationList& ret, const KDevelop::TopDUContext* source, SearchFlags flags, uint \
depth) const; +    virtual bool findDeclarationsInternal(const SearchItem::PtrList& \
identifiers, const KDevelop::CursorInRevision& position, const \
KDevelop::AbstractType::Ptr& dataType, DeclarationList& ret, const \
KDevelop::TopDUContext* source, SearchFlags flags, uint depth) const;  
   private:
     template<class Acceptor>
diff --git a/duchain/typebuilder.cpp b/duchain/typebuilder.cpp
index 246cf3b..2509503 100644
--- a/duchain/typebuilder.cpp
+++ b/duchain/typebuilder.cpp
@@ -18,8 +18,6 @@
 
 #include "typebuilder.h"
 
-#include <ktexteditor/smartrange.h>
-
 #include "editorintegrator.h"
 #include "parsesession.h"
 #include "declarationbuilder.h"
@@ -41,7 +39,7 @@ TypeBuilder::TypeBuilder()
 {
 }
 
-bool TypeBuilder::buildCompleteTypes() const
+/*bool TypeBuilder::buildCompleteTypes() const
 {
   return m_buildCompleteTypes;
 }
@@ -50,7 +48,7 @@ bool TypeBuilder::buildCompleteTypes() const
 void TypeBuilder::setBuildCompleteTypes(bool completeTypes)
 {
   m_buildCompleteTypes = completeTypes;
-}
+}*/
   
 StructureType* TypeBuilder::openClass(bool interface, bool parameters)
 {
@@ -257,15 +255,16 @@ void \
TypeBuilder::visitClassOrInterfaceTypeName(ClassOrInterfaceTypeNameAst * no  
     TypeBuilderBase::visitClassOrInterfaceTypeName(node);
 
-  if (buildCompleteTypes() && openTypeFromName(m_currentIdentifier, node, true)) {
+  //FIXME:Rangins
+  //if (/*buildCompleteTypes() &&*/ openTypeFromName(m_currentIdentifier, node, \
true)) {  {
       //DUChainReadLocker lock(DUChain::lock());
       //kDebug() << "Searching for type " << \
m_currentIdentifier.toStringList().join(".") << ", found " << \
currentAbstractType()->toString();  }
-    closeType();
-  } else {
+    //closeType();
+  //} else {
     unresolvedIdentifier(DUContextPointer(currentContext()), m_currentIdentifier);
-  }
+  //}
 }
 
 void TypeBuilder::visitClassOrInterfaceTypeNamePart(ClassOrInterfaceTypeNamePartAst \
                * node)
diff --git a/duchain/typebuilder.h b/duchain/typebuilder.h
index ea3817d..076f278 100644
--- a/duchain/typebuilder.h
+++ b/duchain/typebuilder.h
@@ -19,16 +19,19 @@
 #ifndef TYPEBUILDER_H
 #define TYPEBUILDER_H
 
+
+
 #include "contextbuilder.h"
+
 #include <language/duchain/builders/abstracttypebuilder.h>
 
+#include <language/duchain/types/functiontype.h>
 #include <language/duchain/declaration.h>
 #include <language/duchain/identifier.h>
-#include "types.h"
 
 namespace java {
 
-typedef KDevelop::AbstractTypeBuilder<AstNode, IdentifierAst, java::ContextBuilder> \
TypeBuilderBase; +typedef KDevelop::AbstractTypeBuilder<AstNode, IdentifierAst, \
ContextBuilder> TypeBuilderBase;  
 /**
  * Create types from an AstNode tree.
@@ -42,8 +45,8 @@ class TypeBuilder: public TypeBuilderBase
 public:
   TypeBuilder();
 
-  bool buildCompleteTypes() const;
-  void setBuildCompleteTypes(bool completeTypes);
+  //bool buildCompleteTypes() const;
+  //void setBuildCompleteTypes(bool completeTypes);
 
 protected:
   virtual void visitClassDeclaration(ClassDeclarationAst *node);
diff --git a/duchain/typeutils.cpp b/duchain/typeutils.cpp
index 42c4eb5..abe430d 100644
--- a/duchain/typeutils.cpp
+++ b/duchain/typeutils.cpp
@@ -21,6 +21,7 @@
 #include <language/duchain/forwarddeclaration.h>
 #include <language/duchain/classfunctiondeclaration.h>
 #include <language/duchain/classdeclaration.h>
+#include <language/duchain/types/alltypes.h>
 #include "typeconversion.h"
 #include "declarationbuilder.h"
 
@@ -148,7 +149,7 @@ using namespace KDevelop;
     int functionCount = functions.size();
 
     if( context ) {
-      QList<Declaration*> declarations = \
context->findLocalDeclarations(Identifier(functionName), SimpleCursor::invalid(), \
topContext); +      QList<Declaration*> declarations = \
context->findLocalDeclarations(Identifier(functionName), CursorInRevision::invalid(), \
                topContext);
       for( QList<Declaration*>::iterator it = declarations.begin(); it != \
                declarations.end(); ++it ) {
         KDevelop::FunctionType::Ptr function = \
                (*it)->abstractType().cast<KDevelop::FunctionType>();
         ClassFunctionDeclaration* functionDeclaration = \
dynamic_cast<ClassFunctionDeclaration*>( *it ); @@ -194,7 +195,7 @@ using namespace \
KDevelop;  Identifier id(context->owner()->identifier());
     id.clearTemplateIdentifiers();
 
-    QList<Declaration*> declarations = context->findLocalDeclarations(id, \
SimpleCursor::invalid(), topContext, AbstractType::Ptr(), DUContext::OnlyFunctions); \
+    QList<Declaration*> declarations = context->findLocalDeclarations(id, \
CursorInRevision::invalid(), topContext, AbstractType::Ptr(), \
DUContext::OnlyFunctions);  
     for( QList<Declaration*>::iterator it = declarations.begin(); it != \
                declarations.end(); ++it ) {
       ClassFunctionDeclaration* functionDeclaration = \
dynamic_cast<ClassFunctionDeclaration*>( *it ); @@ -225,7 +226,7 @@ \
KDevelop::AbstractType::Ptr matchingClassPointer(const KDevelop::AbstractType::P  \
DUContext* internal = actualStructure->internalContext(topContext);  if(internal) {
       typedef QPair<Declaration*, int> DeclarationDepthPair;
-      foreach(Declaration* decl, internal->findDeclarations(castIdentifier(), \
SimpleCursor::invalid(), topContext, \
(DUContext::SearchFlags)(DUContext::DontSearchInParent | DUContext::NoFiltering))) { \
+      foreach(Declaration* decl, internal->findDeclarations(castIdentifier(), \
CursorInRevision::invalid(), topContext, \
(DUContext::SearchFlags)(DUContext::DontSearchInParent | DUContext::NoFiltering))) {  \
FunctionType::Ptr funType = decl->type<FunctionType>();  if(funType && \
                funType->returnType()) {
           if(conversion.implicitConversion(funType->returnType()->indexed(), \
matchTo->indexed(), true)) { @@ -263,7 +264,7 @@ AbstractType::Ptr \
decreasePointerDepth(AbstractType::Ptr type, TopDUContext* top  if(useOperator) {
       Declaration* decl = getDeclaration(type, top);
       if(decl && decl->internalContext()) {
-        QList<Declaration*> decls = \
decl->internalContext()->findDeclarations(Identifier("operator*"), \
SimpleCursor::invalid(), top, DUContext::DontSearchInParent); +        \
QList<Declaration*> decls = \
decl->internalContext()->findDeclarations(Identifier("operator*"), \
CursorInRevision::invalid(), top, DUContext::DontSearchInParent);  \
if(!decls.isEmpty()) {  FunctionType::Ptr fun = decls.first()->type<FunctionType>();
           if(fun)
diff --git a/duchain/usebuilder.cpp b/duchain/usebuilder.cpp
index 244eb95..8c352a0 100644
--- a/duchain/usebuilder.cpp
+++ b/duchain/usebuilder.cpp
@@ -26,14 +26,9 @@ using namespace KDevelop;
 
 namespace java {
 
-UseBuilder::UseBuilder (ParseSession* session)
-{
-  setEditor(session);
-}
-
 UseBuilder::UseBuilder (EditorIntegrator* editor)
 {
-  setEditor(editor);
+  m_editor = editor;
 }
 
 
@@ -45,8 +40,8 @@ void UseBuilder::usingDeclaration(AstNode* node, const \
KDevelop::DeclarationPoin  if (end_token == qint64())
     end_token = node->endToken;
 
-  kDebug() << "New use" << editor()->findRange(start_token, end_token).textRange() \
                << " declaration" << decl.data() << decl->toString();
-  newUse(node, editor()->findRange(start_token, end_token), decl.data());
+  kDebug() << "New use" << m_editor->findRange(start_token, end_token) << " \
declaration" << decl.data() << decl->toString(); +  newUse(node, \
m_editor->findRange(start_token, end_token), decl);  }
 
 }
diff --git a/duchain/usebuilder.h b/duchain/usebuilder.h
index 3d141b4..74f41b9 100644
--- a/duchain/usebuilder.h
+++ b/duchain/usebuilder.h
@@ -35,7 +35,6 @@ typedef KDevelop::AbstractUseBuilder<AstNode, IdentifierAst, \
java::ExpressionVis  class UseBuilder: public UseBuilderBase
 {
 public:
-  UseBuilder(ParseSession* session);
   UseBuilder(EditorIntegrator* editor);
 
 protected:
diff --git a/javalanguagesupport.cpp b/javalanguagesupport.cpp
index 49c949b..fcb840a 100644
--- a/javalanguagesupport.cpp
+++ b/javalanguagesupport.cpp
@@ -179,13 +179,13 @@ KDevelop::ReferencedTopDUContext \
JavaLanguageSupport::allJavaContext()  return m_allJavaContext;
 
     KDevelop::DUChainWriteLocker lock(KDevelop::DUChain::lock());
-    m_allJavaContext = new \
KDevelop::TopDUContext(KDevelop::IndexedString(KUrl("java://all")), \
KDevelop::SimpleRange()); +    m_allJavaContext = new \
KDevelop::TopDUContext(KDevelop::IndexedString(KUrl("java://all")), \
KDevelop::RangeInRevision());  m_allJavaContext->setType( KDevelop::DUContext::Global \
);  KDevelop::DUChain::self()->addDocumentChain( m_allJavaContext );
     return m_allJavaContext;
 }
 
-const KDevelop::ICodeHighlighting* JavaLanguageSupport::codeHighlighting() const
+KDevelop::ICodeHighlighting* JavaLanguageSupport::codeHighlighting() const
 {
     return m_highlighting;
 }
diff --git a/javalanguagesupport.h b/javalanguagesupport.h
index b94790e..70b5fea 100644
--- a/javalanguagesupport.h
+++ b/javalanguagesupport.h
@@ -57,7 +57,7 @@ public:
 
     virtual KDevelop::ParseJob *createParseJob(const KUrl &url);
     virtual KDevelop::ILanguage *language();
-    virtual const KDevelop::ICodeHighlighting* codeHighlighting() const;
+    virtual KDevelop::ICodeHighlighting* codeHighlighting() const;
 
     // Hack to make it look like all java files #include each other
     KDevelop::ReferencedTopDUContext allJavaContext();
diff --git a/kdevjavasupport.desktop b/kdevjavasupport.desktop
index b9f226a..363cb0b 100644
--- a/kdevjavasupport.desktop
+++ b/kdevjavasupport.desktop
@@ -81,7 +81,7 @@ ServiceTypes=KDevelop/Plugin
 Icon=source-java
 X-KDE-Library=kdevjavalanguagesupport
 X-KDE-PluginInfo-Name=kdevjavasupport
-X-KDevelop-Version=10
+X-KDevelop-Version=14
 X-KDevelop-Language=Java
 X-KDevelop-Args=JAVA
 X-KDevelop-Interfaces=ILanguageSupport
diff --git a/parsejob.cpp b/parsejob.cpp
index 7c72d61..ac813a4 100644
--- a/parsejob.cpp
+++ b/parsejob.cpp
@@ -38,8 +38,6 @@
 #include <kdebug.h>
 #include <klocale.h>
 
-#include <KTextEditor/SmartInterface>
-
 #include "javalanguagesupport.h"
 
 // from the parser subdirectory
@@ -50,6 +48,7 @@
 #include <interfaces/ilanguage.h>
 #include <language/interfaces/icodehighlighting.h>
 #include <language/interfaces/iproblem.h>
+#include <interfaces/icore.h>
 
 #include "parser/dumptree.h"
 
@@ -100,6 +99,7 @@ bool ParseJob::wasReadFromDisk() const
 
 void ParseJob::run()
 {
+    kDebug() << "Running ParseJob";
     if ( abortRequested() )
         return abortJob();
 
@@ -132,7 +132,11 @@ void ParseJob::run()
 
     QDateTime lastModified;
 
-    m_readFromDisk = !contentsAvailableFromEditor();
+    KDevelop::ProblemPointer p = readContents();
+    if (p) {
+        //TODO: associate problem with topducontext
+        return abortJob();
+    }
 
     if ( m_readFromDisk )
     {
@@ -159,13 +163,13 @@ void ParseJob::run()
                 default:
                     break;
                 }
-                p->setFinalLocation(KDevelop::DocumentRange(document().str(), \
KTextEditor::Cursor(0,0), KTextEditor::Cursor(0,0))); \
+		p->setFinalLocation(KDevelop::DocumentRange(document(), \
KDevelop::RangeInRevision(0,0,0,0).castToSimpleRange()));  // TODO addProblem(p);
                 return;
             }
 
             m_session->setContents( file.readAll() );
-            Q_ASSERT ( m_session->size() > 0 );
+            Q_ASSERT ( m_session->contents().length() > 0 );
             file.close();
 
         } else if (fileUrl.protocol() == "zip") {
@@ -203,7 +207,7 @@ void ParseJob::run()
                 kDebug() << "Zip file" << filePath.left(offset + 4) << "couldn't be \
opened.";  }
 
-            if (m_session->size() == 0)
+            if (m_session->contents().length() == 0)
                 // TODO Register problem
                 return;
 
@@ -225,20 +229,21 @@ void ParseJob::run()
             QByteArray data;
             KIO::NetAccess::synchronousRun(getJob, QApplication::activeWindow(), \
&data);  m_session->setContents( data );
-            Q_ASSERT ( m_session->size() > 0 );
-            kDebug() << "Zipped file retrieved in " << t.elapsed() << " seconds, \
size" << m_session->size(); +            Q_ASSERT ( m_session->contents().length() > \
0 ); +            kDebug() << "Zipped file retrieved in " << t.elapsed() << " \
seconds, size" << m_session->contents().length();  ///TODO: lastModified
         }
 
     } else {
-        m_session->setContents( contentsFromEditor().toUtf8() );
+	m_session->setContents(QString::fromUtf8(contents().contents));
+	m_session->setCurrentDocument(document());
         lastModified = QFileInfo(document().str()).lastModified();
     }
 
     kDebug() << "===-- PARSING --===> "
              << document().str()
              << " <== readFromDisk: " << m_readFromDisk
-             << " size: " << m_session->size();
+             << " size: " << m_session->contents().length();
 
     if ( abortRequested() )
         return abortJob();
@@ -250,7 +255,7 @@ void ParseJob::run()
     javaParser.setMemoryPool( m_session->memoryPool );
 
     // 1) tokenize
-    javaParser.tokenize( (char*) m_session->contents() );
+    javaParser.tokenize( (char*) m_session->contents().constData() );
 
     if ( abortRequested() )
         return abortJob();
@@ -275,7 +280,7 @@ void ParseJob::run()
 
     // 3) Form definition-use chain
     java::EditorIntegrator editor(parseSession());
-    editor.setCurrentUrl(document());
+    //editor.setCurrentUrl(document()); //FIXME:port me !
 
     //kDebug(  ) << (contentContext ? "updating" : "building") << "duchain for" << \
parentJob()->document().str();  
@@ -299,13 +304,13 @@ void ParseJob::run()
 
     DeclarationBuilder declarationBuilder(&editor);
 
-    if (newFeatures == \
KDevelop::TopDUContext::SimplifiedVisibleDeclarationsAndContexts) { +    /*if \
                (newFeatures == \
                KDevelop::TopDUContext::SimplifiedVisibleDeclarationsAndContexts) {
         declarationBuilder.setOnlyComputeVisible(true); //Only visible \
declarations/contexts need to be built.  \
declarationBuilder.setBuildCompleteTypes(false);  
     } else if (newFeatures == \
                KDevelop::TopDUContext::VisibleDeclarationsAndContexts) {
         declarationBuilder.setOnlyComputeVisible(true); //Only visible \
                declarations/contexts need to be built.
-    }
+    }*/
 
     
     KDevelop::TopDUContext* chain = declarationBuilder.build(document(), ast, \
toUpdate); @@ -348,14 +353,9 @@ void ParseJob::run()
         useBuilder.buildUses(ast);
     }
 
-    if (!abortRequested() && editor.smart()) {
-        editor.smart()->clearRevision();
-
-        if ( java()->codeHighlighting() )
-        {
-            QMutexLocker lock(editor.smart()->smartMutex());
-            java()->codeHighlighting()->highlightDUChain( duChain() );
-        }
+    if ( java() && java()->codeHighlighting() && \
KDevelop::ICore::self()->languageController()->backgroundParser()->trackerForUrl(document()))
 +    {
+        java()->codeHighlighting()->highlightDUChain( duChain() );
     }
 
     if (declarationsComplete && (newFeatures & \
KDevelop::TopDUContext::AllDeclarationsContextsAndUses) == \
KDevelop::TopDUContext::AllDeclarationsContextsAndUses) { @@ -370,11 +370,7 @@ void \
                ParseJob::run()
         KDevelop::ParsingEnvironmentFilePointer file = \
chain->parsingEnvironmentFile();  
         KDevelop::DUChainWriteLocker lock;
-        if (m_readFromDisk) {
-            file->setModificationRevision(KDevelop::ModificationRevision(lastModified));
                
-        } else {
-            file->setModificationRevision(KDevelop::ModificationRevision(lastModified, \
                revisionToken()));
-        }
+	file->setModificationRevision(contents().modification);
 
         KDevelop::DUChain::self()->updateContextEnvironment( chain->topContext(), \
file.data() );  }
diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt
index cc35848..2b0e8ee 100644
--- a/parser/CMakeLists.txt
+++ b/parser/CMakeLists.txt
@@ -2,6 +2,7 @@
 include_directories(
     ${KDE4_INCLUDES}
     ${KDE4_INCLUDE_DIR}/kdevelop-pg-qt
+    ${KDE4_INCLUDE_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${KDEVPLATFORM_INCLUDE_DIR}
 #    ${KDEVPLATFORM_INCLUDE_DIR}/interfaces
diff --git a/parser/java.g b/parser/java.g
index f5b1978..32e00bd 100644
--- a/parser/java.g
+++ b/parser/java.g
@@ -87,7 +87,7 @@ class DUContext;
 
 %parser_declaration_header "QtCore/QString"
 %parser_declaration_header "QtCore/QDebug"
-%parser_declaration_header "kdevelop-pg-qt/kdev-pg-list.h"
+%parser_declaration_header "kdev-pg-list.h"
 
 %export_macro "KDEVJAVAPARSER_EXPORT"
 %export_macro_header "javaparserexport.h"
diff --git a/parser/parsesession.cpp b/parser/parsesession.cpp
index aa466b2..6feb2ac 100644
--- a/parser/parsesession.cpp
+++ b/parser/parsesession.cpp
@@ -19,6 +19,13 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#include <QFile>
+#include <QTextCodec>
+
+#include <KLocalizedString>
+
+#include <language/interfaces/iproblem.h>
+
 #include "parsesession.h"
 
 #include "kdev-pg-memory-pool.h"
@@ -41,32 +48,72 @@ ParseSession::~ParseSession()
     delete tokenStream;
 }
 
-KDevelop::SimpleCursor ParseSession::positionAt( qint64 offset ) const
+KDevelop::CursorInRevision ParseSession::positionAt( qint64 offset ) const
 {
     qint64 line, column;
     tokenStream->locationTable()->positionAt( offset, &line, &column );
-    return KDevelop::SimpleCursor(line, column);
+    return KDevelop::CursorInRevision(line, column);
 }
 
-qint64 ParseSession::size() const
+QString ParseSession::contents() const
 {
-    return m_contents.size();
+    return m_contents;
 }
 
-const char *ParseSession::contents() const
+void ParseSession::setContents( const QString & contents )
 {
-    return m_contents.constData();
+    m_contents = contents;
 }
 
-void ParseSession::setContents( const QByteArray & contents )
+void ParseSession::setCurrentDocument(const KDevelop::IndexedString& filename)
 {
-    m_contents = contents;
+    m_currentDocument = filename;
 }
 
+KDevelop::IndexedString ParseSession::currentDocument() const
+{
+    return m_currentDocument;
+}
+
+bool ParseSession::readFile(const QString& filename, const char* codec)
+{
+    m_currentDocument = KDevelop::IndexedString(filename);
+
+    QFile f(filename);
+    if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
+	    KDevelop::ProblemPointer p(new KDevelop::Problem());
+        p->setSource(KDevelop::ProblemData::Disk);
+        p->setDescription(i18n("Could not open file '%1'", filename));
+        switch (f.error()) {
+        case QFile::ReadError:
+            p->setExplanation(i18n("File could not be read from."));
+            break;
+        case QFile::OpenError:
+            p->setExplanation(i18n("File could not be opened."));
+            break;
+        case QFile::PermissionsError:
+            p->setExplanation(i18n("File permissions prevent opening for read."));
+            break;
+        default:
+            break;
+        }
+        p->setFinalLocation(KDevelop::DocumentRange(m_currentDocument, \
KDevelop::SimpleRange(0, 0, 0, 0))); +        m_problems << p;
+        kWarning() << "Could not open file" << filename;
+        return false;
+    }
+    QTextStream s(&f);
+    if (codec)
+        s.setCodec(QTextCodec::codecForName(codec));
+    m_contents = s.readAll();
+    return true;
+}
+
+
 QString ParseSession::symbol( qint64 token ) const
 {
     const KDevPG::TokenStream::Token& tok = tokenStream->at( token );
-    return QString::fromUtf8(m_contents.constData() + tok.begin, tok.end - \
tok.begin); +    return m_contents.mid(tok.begin, tok.end - tok.begin + 1);
 }
 
 QString ParseSession::unify( const QString & str ) const
diff --git a/parser/parsesession.h b/parser/parsesession.h
index cbb7cba..fa44da4 100644
--- a/parser/parsesession.h
+++ b/parser/parsesession.h
@@ -22,18 +22,19 @@
 #ifndef JAVA_PARSESESSION_H
 #define JAVA_PARSESESSION_H
 
-#include <QtCore/QByteArray>
+#include <QtCore/QString>
 
 #include "javaparser.h"
 #include "javaparserexport.h"
 
-#include <language/editor/simplecursor.h>
 #include <language/duchain/ducontext.h>
+#include <language/editor/simplecursor.h>
+#include <language/interfaces/iproblem.h>
 
 namespace java
 {
 
-typedef QPair<KDevelop::DUContextPointer, KDevelop::SimpleRange> SimpleUse;
+typedef QPair<KDevelop::DUContextPointer, KDevelop::RangeInRevision> SimpleUse;
 
 /// Contains everything needed to keep an AST useful once the rest of the parser
 /// has gone away.
@@ -48,12 +49,15 @@ public:
    *
    * \note the line starts from 0.
    */
-  KDevelop::SimpleCursor positionAt( qint64 offset ) const;
+  KDevelop::CursorInRevision positionAt( qint64 offset ) const;
+
+  void setContents( const QString& contents );
 
-  void setContents( const QByteArray& contents );
+  void setCurrentDocument(const KDevelop::IndexedString& filename);
+  KDevelop::IndexedString currentDocument() const;
+  bool readFile(const QString& filename, const char* charset = 0);
 
-  const char *contents() const;
-  qint64 size() const;
+  QString contents() const;
   Parser::memoryPoolType *memoryPool;
   KDevPG::TokenStream *tokenStream;
   Parser::JavaCompatibilityMode compatibilityMode;
@@ -72,7 +76,9 @@ public:
   }
 
 private:
-  QByteArray m_contents;
+  QString m_contents;
+  KDevelop::IndexedString m_currentDocument;
+  QList<KDevelop::ProblemPointer> m_problems;
 };
 
 } // end of namespace java
-- 
1.7.3.4



-- 
KDevelop-devel mailing list
KDevelop-devel@kdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic