languages/java/javasupportpart.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 1999 by Jonas Nordin * 00003 * jonas.nordin@syncom.se * 00004 * Copyright (C) 2000-2001 by Bernd Gehrmann * 00005 * bernd@kdevelop.org * 00006 * Copyright (C) 2002-2003 by Roberto Raggi * 00007 * roberto@kdevelop.org * 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 00016 #ifndef _JAVASUPPORTPART_H_ 00017 #define _JAVASUPPORTPART_H_ 00018 00019 #include <kdevcore.h> 00020 #include <kdevlanguagesupport.h> 00021 00022 #include <kdialogbase.h> 00023 #include <qguardedptr.h> 00024 #include <qstring.h> 00025 #include <qwaitcondition.h> 00026 #include <qdatetime.h> 00027 00028 class Context; 00029 class ProblemReporter; 00030 class BackgroundParser; 00031 class Catalog; 00032 class QLabel; 00033 class QProgressBar; 00034 class QStringList; 00035 class QListViewItem; 00036 class KListView; 00037 class Driver; 00038 00039 namespace KParts { class Part; } 00040 namespace KTextEditor 00041 { 00042 class Document; 00043 class View; 00044 class EditInterface; 00045 class SelectionInterface; 00046 class ViewCursorInterface; 00047 } 00048 00049 class JavaSupportPart : public KDevLanguageSupport 00050 { 00051 Q_OBJECT 00052 00053 public: 00054 JavaSupportPart( QObject *parent, const char *name, const QStringList &args ); 00055 virtual ~JavaSupportPart(); 00056 00057 bool isValid() const { return m_valid; } 00058 00059 ProblemReporter* problemReporter() { return m_problemReporter; } 00060 BackgroundParser* backgroundParser() { return m_backgroundParser; } 00061 00062 const QPtrList<Catalog>& catalogList() { return m_catalogList; } 00063 00064 bool isValidSource( const QString& fileName ) const; 00065 QStringList fileExtensions( ) const; 00066 00067 virtual void customEvent( QCustomEvent* ev ); 00068 00069 virtual QStringList subclassWidget(const QString& formName); 00070 virtual QStringList updateWidget(const QString& formName, const QString& fileName); 00071 00072 KTextEditor::Document* findDocument( const KURL& url ); 00073 00074 static KConfig *config(); 00075 00076 virtual QString formatTag( const Tag& tag ); 00077 virtual QString formatModelItem( const CodeModelItem *item, bool shortDescription=false ); 00078 virtual void addClass(); 00079 00080 signals: 00081 void fileParsed( const QString& fileName ); 00082 00083 protected: 00084 virtual KDevLanguageSupport::Features features(); 00085 virtual KMimeType::List mimeTypes(); 00086 virtual QString formatClassName(const QString &name); 00087 virtual QString unformatClassName(const QString &name); 00088 virtual void addMethod( ClassDom klass ); 00089 virtual void addAttribute( ClassDom klass ); 00090 00091 private slots: 00092 void activePartChanged(KParts::Part *part); 00093 void partRemoved( KParts::Part* part ); 00094 void projectOpened(); 00095 void projectClosed(); 00096 void savedFile(const QString &fileName); 00097 void configWidget(KDialogBase *dlg); 00098 void projectConfigWidget(KDialogBase *dlg); 00099 void contextMenu(QPopupMenu *popup, const Context *context); 00100 void addedFilesToProject(const QStringList &fileList); 00101 void removedFilesFromProject(const QStringList &fileList); 00102 void changedFilesInProject( const QStringList & fileList ); 00103 void slotProjectCompiled(); 00104 void setupCatalog(); 00105 00106 void slotNewClass(); 00107 00108 void slotNeedTextHint( int, int, QString& ); 00109 00113 void initialParse( ); 00114 00118 bool parseProject( ); 00119 00120 private: 00121 00125 void maybeParse( const QString& fileName ); 00126 void removeWithReferences( const QString& fileName ); 00127 00128 QStringList modifiedFileList(); 00129 QString findSourceFile(); 00130 int pcsVersion(); 00131 void setPcsVersion( int version ); 00132 00133 void saveProjectSourceInfo(); 00134 00135 QString m_contextFileName; 00136 00137 QGuardedPtr< ProblemReporter > m_problemReporter; 00138 BackgroundParser* m_backgroundParser; 00139 00140 KTextEditor::Document* m_activeDocument; 00141 KTextEditor::View* m_activeView; 00142 KTextEditor::SelectionInterface* m_activeSelection; 00143 KTextEditor::EditInterface* m_activeEditor; 00144 KTextEditor::ViewCursorInterface* m_activeViewCursor; 00145 QString m_activeFileName; 00146 00147 QWaitCondition m_eventConsumed; 00148 bool m_projectClosed; 00149 00150 QMap<QString, QDateTime> m_timestamp; 00151 bool m_valid; 00152 00153 QPtrList<Catalog> m_catalogList; 00154 Driver* m_driver; 00155 QString m_projectDirectory; 00156 00157 ClassDom m_activeClass; 00158 FunctionDom m_activeFunction; 00159 VariableDom m_activeVariable; 00160 00161 friend class KDevJavaSupportIface; 00162 friend class JavaDriver; 00163 }; 00164 00165 #endif