diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/csharp | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/csharp')
-rw-r--r-- | languages/csharp/Makefile.am | 25 | ||||
-rw-r--r-- | languages/csharp/README.dox | 46 | ||||
-rw-r--r-- | languages/csharp/app_templates/Makefile.am | 3 | ||||
-rw-r--r-- | languages/csharp/app_templates/csharp.appwizard | 2 | ||||
-rw-r--r-- | languages/csharp/csharpconfigwidget.cpp | 38 | ||||
-rw-r--r-- | languages/csharp/csharpconfigwidget.h | 34 | ||||
-rw-r--r-- | languages/csharp/csharpconfigwidgetbase.ui | 101 | ||||
-rw-r--r-- | languages/csharp/csharpdoc.cpp | 133 | ||||
-rw-r--r-- | languages/csharp/csharpdoc.h | 25 | ||||
-rw-r--r-- | languages/csharp/csharpdoc.protocol | 9 | ||||
-rw-r--r-- | languages/csharp/csharpsupportpart.cpp | 331 | ||||
-rw-r--r-- | languages/csharp/csharpsupportpart.h | 59 | ||||
-rw-r--r-- | languages/csharp/doc/Makefile.am | 6 | ||||
-rw-r--r-- | languages/csharp/file_templates/Makefile.am | 4 | ||||
-rw-r--r-- | languages/csharp/kdevcsharpsupport.desktop | 57 | ||||
-rw-r--r-- | languages/csharp/kdevcsharpsupport.rc | 14 |
16 files changed, 887 insertions, 0 deletions
diff --git a/languages/csharp/Makefile.am b/languages/csharp/Makefile.am new file mode 100644 index 00000000..51d0c110 --- /dev/null +++ b/languages/csharp/Makefile.am @@ -0,0 +1,25 @@ +# Here resides the CSharp support part. + +INCLUDES = -I$(top_srcdir)/lib/interfaces \ + -I$(top_srcdir)/lib/interfaces/extensions -I$(top_srcdir)/lib/interfaces/external -I$(top_srcdir)/lib/util \ + $(all_includes) +SUBDIRS = app_templates file_templates doc + + +kde_module_LTLIBRARIES = libkdevcsharpsupport.la kio_csharpdoc.la +libkdevcsharpsupport_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) +libkdevcsharpsupport_la_LIBADD = $(top_builddir)/lib/libkdevelop.la + +libkdevcsharpsupport_la_SOURCES = csharpsupportpart.cpp csharpconfigwidget.cpp csharpconfigwidgetbase.ui + +kio_csharpdoc_la_SOURCES = csharpdoc.cpp +kio_csharpdoc_la_LIBADD = $(LIB_KIO) +kio_csharpdoc_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = kdevcsharpsupport.desktop csharpdoc.protocol + +rcdir = $(kde_datadir)/kdevcsharpsupport +rc_DATA = kdevcsharpsupport.rc diff --git a/languages/csharp/README.dox b/languages/csharp/README.dox new file mode 100644 index 00000000..6d256b08 --- /dev/null +++ b/languages/csharp/README.dox @@ -0,0 +1,46 @@ +/** \class CSharpSupportPart +This is csharp language support plugin. + +Put a more detailed description of your part in these lines. It can span +over several lines. You can even use some html commands in these lines like: +<code>This is code</code>, html links <a href="http://somelocation">link text</a>, +and images. + +\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a> +\authors <a href="mailto:willems.luc AT pandora.be">Luc Willems</a> + +\maintainer <a href="mailto:willems.luc AT pandora.be">Luc Willems</a> + +\feature csharp programming language support +\feature Consult \ref LangSupportStatus for a up to date features/status of this programming language support part. + +\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet. +.. +\bug Describe a the nth bug that you know of, but probably hasn't been reported yet. + +\requirement Describe a the 1st requirement of your part. +\requirement Describe a the 2nd requirement of your part. +... +\requirement Describe a the nth requirement of your part. + +\todo Describe a the 1st TODO of your part. +\todo Describe a the 2nd TODO of your part. +... +\todo Describe a the nth TODO of your part. + +\faq <b>First frequenly asked question about your part ?</b> Answer. +\faq <b>Second frequenly asked question about your part ?</b> Answer. +... +\faq <b>Last frequenly asked question about your part ?</b> Answer. + +\note First note text. +\note Second note text. +... +\note Last note text. + +\warning First warning text. +\warning Second warning text. +... +\warning Last warning text. + +*/ diff --git a/languages/csharp/app_templates/Makefile.am b/languages/csharp/app_templates/Makefile.am new file mode 100644 index 00000000..14608ada --- /dev/null +++ b/languages/csharp/app_templates/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = +profilesdir = $(kde_datadir)/kdevelop/profiles/IDE/ScriptingLanguageIDE/CSharpIDE +profiles_DATA = csharp.appwizard diff --git a/languages/csharp/app_templates/csharp.appwizard b/languages/csharp/app_templates/csharp.appwizard new file mode 100644 index 00000000..44c9faf9 --- /dev/null +++ b/languages/csharp/app_templates/csharp.appwizard @@ -0,0 +1,2 @@ +[General] +List=perlhello diff --git a/languages/csharp/csharpconfigwidget.cpp b/languages/csharp/csharpconfigwidget.cpp new file mode 100644 index 00000000..b18d3e69 --- /dev/null +++ b/languages/csharp/csharpconfigwidget.cpp @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "csharpconfigwidget.h" + +#include <qcheckbox.h> +#include <klineedit.h> +#include "domutil.h" + + +CSharpConfigWidget::CSharpConfigWidget(QDomDocument &projectDom, + QWidget *parent, const char *name) + : CSharpConfigWidgetBase(parent, name), dom(projectDom) +{ + interpreter_edit->setText(DomUtil::readEntry(dom, "/kdevcsharpsupport/run/interpreter")); + terminal_box->setChecked(DomUtil::readBoolEntry(dom, "/kdevcsharpsupport/run/terminal")); +} + + +CSharpConfigWidget::~CSharpConfigWidget() +{} + + +void CSharpConfigWidget::accept() +{ + DomUtil::writeEntry(dom, "/kdevcsharpsupport/run/interpreter", interpreter_edit->text()); + DomUtil::writeBoolEntry(dom, "/kdevcsharpsupport/run/terminal", terminal_box->isChecked()); +} + +#include "csharpconfigwidget.moc" diff --git a/languages/csharp/csharpconfigwidget.h b/languages/csharp/csharpconfigwidget.h new file mode 100644 index 00000000..bf1b063e --- /dev/null +++ b/languages/csharp/csharpconfigwidget.h @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (C) 2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _CSHARPCONFIGWIDGET_H_ +#define _CSHARPCONFIGWIDGET_H_ + +#include "csharpconfigwidgetbase.h" +#include <qdom.h> + + +class CSharpConfigWidget : public CSharpConfigWidgetBase +{ + Q_OBJECT + +public: + CSharpConfigWidget( QDomDocument &projectDom, QWidget *parent=0, const char *name=0 ); + ~CSharpConfigWidget(); + +public slots: + void accept(); + +private: + QDomDocument &dom; +}; + +#endif diff --git a/languages/csharp/csharpconfigwidgetbase.ui b/languages/csharp/csharpconfigwidgetbase.ui new file mode 100644 index 00000000..dbf4d3ae --- /dev/null +++ b/languages/csharp/csharpconfigwidgetbase.ui @@ -0,0 +1,101 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>CSharpConfigWidgetBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>csharp_config_widget</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <property name="caption"> + <string>CSharp</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + + <widget class="QLabel"> + <property name="name"> + <cstring>interpreter_label</cstring> + </property> + <property name="text"> + <string>CSharp &interpreter:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>interpreter_edit</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + + <widget class="KLineEdit"> + <property name="name"> + <cstring>interpreter_edit</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Minimum</enum> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>terminal_box</cstring> + </property> + <property name="text"> + <string>&Execute programs in a terminal</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + </vbox> +</widget> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/languages/csharp/csharpdoc.cpp b/languages/csharp/csharpdoc.cpp new file mode 100644 index 00000000..8755be2b --- /dev/null +++ b/languages/csharp/csharpdoc.cpp @@ -0,0 +1,133 @@ +#include "csharpdoc.h" + +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> +#include <unistd.h> + +#include <qtextstream.h> +#include <kdebug.h> +#include <klocale.h> +#include <kstandarddirs.h> +#include <kinstance.h> +#include <kprocess.h> +#include <kdeversion.h> +#include <kglobal.h> + +using namespace KIO; + + +CSharpdocProtocol::CSharpdocProtocol(const QCString &pool, const QCString &app) + : SlaveBase("csharpdoc", pool, app) +{} + + +CSharpdocProtocol::~CSharpdocProtocol() +{} + + +void CSharpdocProtocol::get(const KURL& url) +{ + QStringList l = QStringList::split('/', url.path()); + + mimeType("text/html"); + + bool plain = false; + QString cmd = "csharpdoc "; + if (l[0] == "functions") { + plain = true; + cmd += "-t -f "; + cmd += KProcess::quote(l[1]); + } else if (l[0] == "faq") { + cmd += "-u -q "; + cmd += KProcess::quote(l[1]); + cmd += " | pod2html"; + } else { + QCString errstr(i18n("The only existing directories are functions and faq.").local8Bit()); + data(errstr); + finished(); + return; + } + + kdDebug() << "Command: " << cmd << endl; + + if (plain) + data(QCString("<blockquote>")); + + FILE *fd = popen(cmd.local8Bit().data(), "r"); + char buffer[4090]; + QByteArray array; + + while (!feof(fd)) { + int n = fread(buffer, 1, 2048, fd); + if (n == -1) { + pclose(fd); + return; + } + array.setRawData(buffer, n); + data(array); + array.resetRawData(buffer, n); + } + + pclose(fd); + + if (plain) + data(QCString("</blockquote>")); + + finished(); +} + + +void CSharpdocProtocol::mimetype(const KURL &url) +{ + QStringList l = QStringList::split('/', url.path()); + mimeType((l[0] == "faq")? "text/html" : "text/plain"); + finished(); +} + + +QCString CSharpdocProtocol::errorMessage() +{ + return QCString( "<html><body bgcolor=\"#FFFFFF\">" + i18n("Error in csharpdoc").local8Bit() + "</body></html>" ); +} + + +void CSharpdocProtocol::stat(const KURL &/*url*/) +{ + UDSAtom uds_atom; + uds_atom.m_uds = KIO::UDS_FILE_TYPE; + uds_atom.m_long = S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO; + + UDSEntry uds_entry; + uds_entry.append(uds_atom); + + statEntry(uds_entry); + finished(); +} + + +void CSharpdocProtocol::listDir(const KURL &url) +{ + error( KIO::ERR_CANNOT_ENTER_DIRECTORY, url.path() ); +} + + +extern "C" { + + int kdemain(int argc, char **argv) + { + KInstance instance( "kio_csharpdoc" ); + KGlobal::locale()->setMainCatalogue("kdevelop"); + + if (argc != 4) { + fprintf(stderr, "Usage: kio_csharpdoc protocol domain-socket1 domain-socket2\n"); + exit(-1); + } + + CSharpdocProtocol slave(argv[2], argv[3]); + slave.dispatchLoop(); + + return 0; + } + +} diff --git a/languages/csharp/csharpdoc.h b/languages/csharp/csharpdoc.h new file mode 100644 index 00000000..85fa8cf5 --- /dev/null +++ b/languages/csharp/csharpdoc.h @@ -0,0 +1,25 @@ +#ifndef _CSHARPDOC_H_ +#define _CSHARPDOC_H_ + +#include <qobject.h> +#include <kio/slavebase.h> + + +class CSharpdocProtocol : public KIO::SlaveBase +{ +public: + CSharpdocProtocol(const QCString &pool, const QCString &app); + virtual ~CSharpdocProtocol(); + + virtual void get(const KURL& url); + virtual void stat(const KURL& url); + virtual void mimetype(const KURL& url); + virtual void listDir(const KURL& url); + +protected: + void decodeURL(const KURL &url); + void decodePath(QString path); + QCString errorMessage(); +}; + +#endif diff --git a/languages/csharp/csharpdoc.protocol b/languages/csharp/csharpdoc.protocol new file mode 100644 index 00000000..9b813b02 --- /dev/null +++ b/languages/csharp/csharpdoc.protocol @@ -0,0 +1,9 @@ +[Protocol] +exec=kio_csharpdoc +protocol=csharpdoc +input=none +output=filesystem +reading=true +listing=Name +determineMimetypeFromExtension=false +Icon=help diff --git a/languages/csharp/csharpsupportpart.cpp b/languages/csharp/csharpsupportpart.cpp new file mode 100644 index 00000000..01a21ffb --- /dev/null +++ b/languages/csharp/csharpsupportpart.cpp @@ -0,0 +1,331 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "csharpsupportpart.h" + +#include <qfileinfo.h> +#include <qpopupmenu.h> +#include <qstringlist.h> +#include <qtextstream.h> +#include <qtimer.h> +#include <kaction.h> +#include <kapplication.h> +#include <kdebug.h> +#include <kdevgenericfactory.h> +#include <kinputdialog.h> +#include <klocale.h> +#include <qregexp.h> +#include <codemodel.h> +#include <qprogressbar.h> +#include <kstatusbar.h> +#include "kdevmainwindow.h" + +#include <kprocess.h> +#include <stdlib.h> +#include <unistd.h> + +#include "kdevcore.h" +#include "kdevproject.h" +#include "kdevpartcontroller.h" +#include "kdevplugininfo.h" +#include "kdevappfrontend.h" +//#include "classstore.h" +//#include "parsedclass.h" +//#include "parsedmethod.h" +//#include "parsedscript.h" +#include "domutil.h" +//#include "programmingbycontract.h" + +typedef KDevGenericFactory<CSharpSupportPart> CSharpSupportFactory; +static const KDevPluginInfo data("kdevcsharpsupport"); +K_EXPORT_COMPONENT_FACTORY( libkdevcsharpsupport, CSharpSupportFactory( data ) ) + +CSharpSupportPart::CSharpSupportPart(QObject *parent, const char *name, const QStringList &) + : KDevLanguageSupport(&data, parent, name ? name : "CSharpSupportPart") +{ + setInstance(CSharpSupportFactory::instance()); + + setXMLFile("kdevcsharpsupport.rc"); + + connect( core(), SIGNAL(projectOpened()), this, SLOT(projectOpened()) ); + connect( core(), SIGNAL(projectClosed()), this, SLOT(projectClosed()) ); + connect( partController(), SIGNAL(savedFile(const KURL&)), + this, SLOT(savedFile(const KURL&)) ); + + KAction *action; + + action = new KAction( i18n("Execute Main Program"), "exec", 0, + this, SLOT(slotExecute()), + actionCollection(), "build_exec" ); + action->setToolTip( i18n("Runs the CSharp program") ); + + action = new KAction( i18n("Execute String..."), "exec", 0, + this, SLOT(slotExecuteString()), + actionCollection(), "build_execstring" ); + action->setToolTip( i18n("Executes a string as CSharp code") ); + + action = new KAction( i18n("Start CSharp Interpreter"), "exec", 0, + this, SLOT(slotStartInterpreter()), + actionCollection(), "build_runinterpreter" ); + action->setToolTip( i18n("Starts the CSharp interpreter without a program") ); + + action = new KAction( i18n("Find CSharp Function Documentation..."), 0, + this, SLOT(slotCSharpdocFunction()), + actionCollection(), "help_csharpdocfunction" ); + action->setToolTip( i18n("Show the documentation page of a CSharp function") ); + + action = new KAction( i18n("Find CSharp FAQ Entry..."), 0, + this, SLOT(slotCSharpdocFAQ()), + actionCollection(), "help_csharpdocfaq" ); + action->setToolTip( i18n("Show the FAQ entry for a keyword") ); + + //csharp parser for codemodel + // m_parser = new csharpparser(core(),codeModel(),interpreter()); +} + + +CSharpSupportPart::~CSharpSupportPart() +{ + if (project()) + projectClosed(); + + // delete m_parser; + // m_parser=0; +} + + +void CSharpSupportPart::projectOpened() +{ + kdDebug(9007) << "projectOpened()" << endl; + + connect( project(), SIGNAL(addedFilesToProject(const QStringList &)), + this, SLOT(addedFilesToProject(const QStringList &)) ); + connect( project(), SIGNAL(removedFilesFromProject(const QStringList &)), + this, SLOT(removedFilesFromProject(const QStringList &)) ); + + // We want to parse only after all components have been + // procsharpy initialized + QTimer::singleShot(0, this, SLOT(initialParse())); +} + + +void CSharpSupportPart::projectClosed() +{ +} + +void CSharpSupportPart::maybeParse(const QString fileName) +{ + QFileInfo fi(fileName); + QString path = fi.filePath(); + QString extension = fi.extension(); + if (extension == "cs") { + kdDebug(9016) << "maybe " << fileName << endl; + removeWithReference(fileName); + // m_parser->parse(fileName); + emit addedSourceInfo( fileName); + } +} + +void CSharpSupportPart::addedFilesToProject(const QStringList &fileList) +{ + kdDebug(9016) << "addedFilesToProject()" << endl; + + QStringList::ConstIterator it; + + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + maybeParse(project()->projectDirectory() + "/" + ( *it )); + } +} + + +void CSharpSupportPart::removedFilesFromProject(const QStringList &fileList) +{ + kdDebug(9016) << "removedFilesFromProject()" << endl; + QStringList::ConstIterator it; + for ( it = fileList.begin(); it != fileList.end(); ++it ) + { + QString fileName = project()->projectDirectory() + "/" + ( *it ); + removeWithReference(fileName); + } + emit updatedSourceInfo(); +} + + +void CSharpSupportPart::savedFile(const KURL &fileName) +{ + Q_UNUSED( fileName.path() ); +#if 0 // not needed anymore + kdDebug(9016) << "savedFile()" << endl; + + if (project()->allFiles().contains(fileName.mid ( project()->projectDirectory().length() + 1 ))) { + maybeParse(fileName); + emit updatedSourceInfo(); + } +#endif +} + + +KDevLanguageSupport::Features CSharpSupportPart::features() +{ + return KDevLanguageSupport::Features(Classes | Functions | Variables | Namespaces | /*Scripts | */NewClass | AddMethod | AddAttribute /*| NewScript*/); +// return Functions; +} + +QString CSharpSupportPart::interpreter() +{ + QString prog = DomUtil::readEntry(*projectDom(), "/kdevcsharpsupport/run/interpreter"); + if (prog.isEmpty()) + prog = "csharp"; + + return prog; +} + + +void CSharpSupportPart::startApplication(const QString &program) +{ + bool inTerminal = DomUtil::readBoolEntry(*projectDom(), "/kdevcsharpsupport/run/terminal"); + if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend")) + appFrontend->startAppCommand(QString::QString(), program, inTerminal); +} + + +void CSharpSupportPart::slotExecute() +{ + QString program = project()->mainProgram(); + QString cmd = interpreter() + " " + program; + startApplication(cmd); +} + + +void CSharpSupportPart::slotStartInterpreter() +{ + startApplication(interpreter()); +} + + +void CSharpSupportPart::slotExecuteString() +{ + bool ok; + QString cmd = KInputDialog::getText(i18n("String to Execute"), i18n("String to execute:"), QString::null, &ok, 0); + if (ok) { + cmd.prepend("'"); + cmd.append("'"); + startApplication(cmd); + } +} + + +void CSharpSupportPart::slotCSharpdocFunction() +{ + bool ok; + QString key = KInputDialog::getText(i18n("Show CSharp Documentation"), i18n("Show CSharp documentation for function:"), "", &ok, 0); + if (ok && !key.isEmpty()) { + QString url = "csharpdoc:functions/"; + url += key; + partController()->showDocument(KURL(url)); + } +} + + +void CSharpSupportPart::slotCSharpdocFAQ() +{ + bool ok; + QString key = KInputDialog::getText(i18n("Show FAQ Entry"), i18n("Show FAQ entry for keyword:"), "", &ok, 0); + if (ok && !key.isEmpty()) { + QString url = "csharpdoc:faq/"; + url += key; + partController()->showDocument(KURL(url)); + } +} +KMimeType::List CSharpSupportPart::mimeTypes( ) +{ + KMimeType::List list; + KMimeType::Ptr mime = KMimeType::mimeType( "application/x-csharp" ); + if( mime ) + list << mime; + return list; +} + +void CSharpSupportPart::initialParse() +{ + kdDebug(9016) << "initialParse()" << endl; + + if (project()) { + //copy from cpp support : give user some feedback + mainWindow()->statusBar()->message( i18n("Updating...") ); + kapp->processEvents( ); + + kapp->setOverrideCursor(waitCursor); + QStringList files = project()->allFiles(); + // m_parser->initialParse(); + + //progress bar + QProgressBar* bar = new QProgressBar( files.count( ), mainWindow( )->statusBar( ) ); + bar->setMinimumWidth( 120 ); + bar->setCenterIndicator( true ); + mainWindow( )->statusBar( )->addWidget( bar ); + bar->show( ); + int n = 0; + for (QStringList::Iterator it = files.begin(); it != files.end() ;++it) { +// kdDebug(9016) << "maybe parse " << project()->projectDirectory() + "/" + (*it) << endl; + maybeParse(project()->projectDirectory() + "/" + *it); + //update progress bar + bar->setProgress( n++ ); + if( (n%5) == 0 ) + kapp->processEvents(); + } + parseUseFiles(); + emit updatedSourceInfo(); + + //remove progressbar + mainWindow( )->statusBar( )->removeWidget( bar ); + delete bar; + kapp->restoreOverrideCursor(); + mainWindow()->statusBar()->message( i18n("Done") ); + + } else { + kdDebug(9016) << "No project" << endl; + } +} + +void CSharpSupportPart::removeWithReference( const QString & fileName ) +{ + kdDebug(9016) << "remove with references: " << fileName << endl; + //m_timestamp.remove( fileName ); + if( !codeModel()->hasFile(fileName) ) + return; + + emit aboutToRemoveSourceInfo( fileName ); + codeModel()->removeFile( codeModel()->fileByName(fileName) ); +} + +void CSharpSupportPart::parseUseFiles() +{ + kdDebug(9016) << "parse addional libs" << endl; + return; + QString filename; + QStringList m_usefiles; + // QStringList m_usefiles = m_parser->UseFiles(); + + //parse addional use files + for (QStringList::Iterator it = m_usefiles.begin(); it != m_usefiles.end() ;++it) + { + // filename = m_parser->findLib(*it); + //if something found , parse it + if (!filename.isEmpty()) { + //kdDebug(9016) << "found " << filename << endl; + maybeParse(filename); + } + } +} + +#include "csharpsupportpart.moc" diff --git a/languages/csharp/csharpsupportpart.h b/languages/csharp/csharpsupportpart.h new file mode 100644 index 00000000..166285a6 --- /dev/null +++ b/languages/csharp/csharpsupportpart.h @@ -0,0 +1,59 @@ +/*************************************************************************** + * Copyright (C) 2001-2002 by Bernd Gehrmann * + * bernd@kdevelop.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _CSHARPSUPPORTPART_H_ +#define _CSHARPSUPPORTPART_H_ + +#include "kdevlanguagesupport.h" +#include <codemodel.h> +// #include "csharpparser.h" + +class CSharpSupportPart : public KDevLanguageSupport +{ + Q_OBJECT + +public: + CSharpSupportPart( QObject *parent, const char *name, const QStringList & ); + ~CSharpSupportPart(); + +protected: + virtual Features features(); + virtual KMimeType::List mimeTypes(); + +private slots: + void projectOpened(); + void projectClosed(); + void savedFile(const KURL &fileName); + void addedFilesToProject(const QStringList &fileList); + void removedFilesFromProject(const QStringList &fileList); + void slotExecute(); + void slotExecuteString(); + void slotStartInterpreter(); + + // Internal + void initialParse(); + void slotCSharpdocFunction(); + void slotCSharpdocFAQ(); + +private: + QString interpreter(); + void startApplication(const QString &program); + void maybeParse(const QString fileName); + void parse(const QString &fileName); + void parseLines(QStringList* lines,const QString& fileName); + void removeWithReference( const QString & fileName ); + void parseUseFiles(); + //CSharp Parser +// csharpparser* m_parser; + +}; + +#endif diff --git a/languages/csharp/doc/Makefile.am b/languages/csharp/doc/Makefile.am new file mode 100644 index 00000000..e0dfb9eb --- /dev/null +++ b/languages/csharp/doc/Makefile.am @@ -0,0 +1,6 @@ +tocdir = ${kde_datadir}/kdevdocumentation/tocs +toc_DATA = + +#indexdir = ${kde_datadir}/devdoctreeview/indices +#index_DATA = + diff --git a/languages/csharp/file_templates/Makefile.am b/languages/csharp/file_templates/Makefile.am new file mode 100644 index 00000000..b4f0a30c --- /dev/null +++ b/languages/csharp/file_templates/Makefile.am @@ -0,0 +1,4 @@ +templatedir = $(kde_datadir)/kdevfilecreate/file-templates +template_DATA = + + diff --git a/languages/csharp/kdevcsharpsupport.desktop b/languages/csharp/kdevcsharpsupport.desktop new file mode 100644 index 00000000..dbd9492b --- /dev/null +++ b/languages/csharp/kdevcsharpsupport.desktop @@ -0,0 +1,57 @@ +[Desktop Entry] +Type=Service +Exec=blubb +Comment=CSharp Support +Comment[ca]=Suport per a CSharp +Comment[da]=Csharp understøttelse +Comment[de]=CSharp-Unterstützung für KDevelop +Comment[el]=Υποστήριξη CSharp +Comment[es]=Soporte para CSharp +Comment[et]=CSharp'i toetus +Comment[fr]=Prise en charge du langage CSharp +Comment[hu]=CSharp-támogatás +Comment[it]=Supporto per CSharp +Comment[ja]=CSharp サポート +Comment[nds]=Ünnerstütten för CSharp +Comment[nl]=Ondersteuning voor CSharp +Comment[pl]=Obsługa CSharp +Comment[pt]=Suporte a C# +Comment[pt_BR]=Suporte a C# +Comment[ru]=Поддержка CSharp +Comment[sk]=CSharp podpora +Comment[sr]=Подршка за CSharp +Comment[sr@Latn]=Podrška za CSharp +Comment[sv]=C#-stöd +Comment[zh_TW]=C# 支援 +Name=KDevCSharpSupport +Name[de]=Unterstützung für CSharp (KDevelop) +Name[nds]=CSharp-Ünnerstütten för KDevelop +Name[sv]=KDevelop C#-stöd +Name[zh_TW]=KDevelop C# 支援 +GenericName=CSharp Support +GenericName[ca]=Suport per a CSharp +GenericName[da]=CSharp understøttelse +GenericName[de]=Unterstützung für CSharp +GenericName[el]=Υποστήριξη CSharp +GenericName[es]=Soporte para CSharp +GenericName[et]=CSharp'i toetus +GenericName[fr]=Prise en charge du langage CSharp +GenericName[hu]=CSharp-támogatás +GenericName[it]=Supporto CSharp +GenericName[ja]=CSharp サポート +GenericName[nds]=Ünnerstütten för CSharp +GenericName[nl]=Ondersteuning voor CSharp +GenericName[pl]=Obsługa CSharp +GenericName[pt]=Suporte a C# +GenericName[pt_BR]=Suporte a C# +GenericName[ru]=Поддержка CSharp +GenericName[sk]=CSharp podpora +GenericName[sr]=Подршка за CSharp +GenericName[sr@Latn]=Podrška za CSharp +GenericName[sv]=C#-stöd +GenericName[zh_TW]=C# 支援 +ServiceTypes=KDevelop/LanguageSupport +X-KDE-Library=libkdevcsharpsupport +X-KDevelop-Version=5 +X-KDevelop-Language=CSharp + diff --git a/languages/csharp/kdevcsharpsupport.rc b/languages/csharp/kdevcsharpsupport.rc new file mode 100644 index 00000000..b5f735e2 --- /dev/null +++ b/languages/csharp/kdevcsharpsupport.rc @@ -0,0 +1,14 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="KDevCSharpSupport" version="1"> +<MenuBar> + <Menu name="build" > + <Action name="build_exec" /> + <Action name="build_runinterpreter" /> + <Action name="build_execstring" /> + </Menu> + <Menu name="help"> + <Action name="help_csharpdocfunction"/> + <Action name="help_csharpdocfaq"/> + </Menu> +</MenuBar> +</kpartgui> |