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

List:       kde-commits
Subject:    kdevelop/parts/classview
From:       Jonas Jacobi <jonas.jacobi () web ! de>
Date:       2004-12-04 0:12:49
Message-ID: 20041204001249.D6B581BA09 () office ! kde ! org
[Download RAW message or body]

CVS commit by jacobi: 

Added support for get/set method creation from the classview, 
if languagesupport supports it.
Rightclick on a classmember and select create get/set methods.


  M +23 -0     classviewwidget.cpp   1.52
  M +2 -1      classviewwidget.h   1.16


--- kdevelop/parts/classview/classviewwidget.cpp  #1.51:1.52
@@ -72,4 +72,8 @@ ClassViewWidget::ClassViewWidget( ClassV
                                     m_part->actionCollection(), \
                "classview_new_class" );
     m_actionNewClass->setWhatsThis(i18n("<b>New class</b><p>Calls the <b>New \
Class</b> wizard.")); +        
+        m_actionCreateAccessMethods = new KAction( i18n("Create get/set methods"), \
KShortcut(), this, SLOT(slotCreateAccessMethods()), m_part->actionCollection(), \
"classview_create_access_methods" ); +        
+        
     m_actionAddMethod = new KAction( i18n("Add Method..."), KShortcut(), this, \
                SLOT(slotAddMethod()),
                                     m_part->actionCollection(), \
"classview_add_method" ); @@ -271,4 +275,9 @@ void \
ClassViewWidget::contentsContextMen  }
 
+        if (item && item->isVariable()){
+                if( m_part->langHasFeature(KDevLanguageSupport::CreateAccessMethods) \
)  +                                m_actionCreateAccessMethods->plug( &menu );
+        }
+
     if( item && item->model() ){
         CodeModelItemContext context( item->model() );
@@ -1041,4 +1050,18 @@ void ClassViewWidget::maybeTip( QPoint c
 }
 
+void ClassViewWidget::slotCreateAccessMethods( )
+{
+        if ( !selectedItem() ) return;
+
+    if( m_part->languageSupport()->features() & \
KDevLanguageSupport::CreateAccessMethods ) +        {
+        VariableDomBrowserItem* item = dynamic_cast<VariableDomBrowserItem*>( \
selectedItem() ); +                if (item == 0)
+                        return;
+                
+                m_part->languageSupport()->createAccessMethods(static_cast<ClassModel \
*>(static_cast<ClassDomBrowserItem*>(item->parent())->dom()),static_cast<VariableModel*>(item->dom()));
 +        }
+}
+
 
 #include "classviewwidget.moc"

--- kdevelop/parts/classview/classviewwidget.h  #1.15:1.16
@@ -70,4 +70,5 @@ private slots:
     void slotOpenDeclaration();
     void slotOpenImplementation();
+        void slotCreateAccessMethods();
 
 protected:
@@ -95,5 +96,5 @@ private:
     KAction* m_actionOpenDeclaration;
     KAction* m_actionOpenImplementation;
-
+        KAction* m_actionCreateAccessMethods;
     friend class ClassViewItem;
     friend class FolderBrowserItem;


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

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