anjuta r3988 - in trunk: . libanjuta/interfaces plugins/class-inheritance plugins/language-support-cpp-java plugins/profiler plugins/symbol-browser plugins/symbol-db



Author: jhs
Date: Fri Jun  6 22:48:29 2008
New Revision: 3988
URL: http://svn.gnome.org/viewvc/anjuta?rev=3988&view=rev

Log:
2008-06-07  Johannes Schmid <jhs gnome org>

	* plugins/symbol-db/Makefile.am:
	Put tables.sql into distribution

2008-06-07  Massimo Cora\'  <maxcvs email it>

  Reviewed by: Johannes Schmid <jhs gnome org>

	* libanjuta/interfaces/libanjuta.idl:
	* plugins/class-inheritance/class-inherit.c
	(class_inheritance_show_dynamic_class_popup_menu),
	(cls_inherit_add_node), (cls_inherit_draw_expanded_node),
	(class_inheritance_update_graph):
	* plugins/language-support-cpp-java/cpp-java-assist.c
	(create_completion),
	(cpp_java_assist_create_word_completion_cache),
	(cpp_java_assist_show_calltip):
	* plugins/profiler/gprof-view.c (gprof_view_show_symbol_in_editor):
	* plugins/symbol-browser/plugin.c (isymbol_manager_search):
	* plugins/symbol-db/plugin.c (isymbol_manager_search):
	* plugins/symbol-db/plugin.h:
	* plugins/symbol-db/symbol-db-engine.c
	(symbol_db_engine_find_symbol_by_name_pattern_filtered):
	* plugins/symbol-db/symbol-db-engine.h:
	* plugins/symbol-db/symbol-db-view.c (prepare_for_adding):
	now search for symbols can be done also in global tags. Added a new parameter
	to search function and adjusted dependencies on different plugins.

Modified:
   trunk/ChangeLog
   trunk/libanjuta/interfaces/libanjuta.idl
   trunk/plugins/class-inheritance/class-inherit.c
   trunk/plugins/language-support-cpp-java/cpp-java-assist.c
   trunk/plugins/profiler/gprof-view.c
   trunk/plugins/symbol-browser/plugin.c
   trunk/plugins/symbol-db/Makefile.am
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/symbol-db/plugin.h
   trunk/plugins/symbol-db/symbol-db-engine.c
   trunk/plugins/symbol-db/symbol-db-engine.h
   trunk/plugins/symbol-db/symbol-db-view.c

Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl	(original)
+++ trunk/libanjuta/interfaces/libanjuta.idl	Fri Jun  6 22:48:29 2008
@@ -4571,9 +4571,13 @@
 	*				  FALSE to exclude. For example use may want all symbols but classes.
 	* @match_name: fixme
 	* @partial_name_match: if TRUE it will search for %match_name%, it FALSE for the exact
-	* string match_name.
-	* @global_search: if TRUE it will search only for public/extern functions. 
-	* If FALSE it will search also for static/private functions.
+	* 					string match_name.
+	* @global_symbols_search: if TRUE it will search only for public/extern functions. 
+	* 						If FALSE it will search also for static/private functions.
+	* @global_tags_search: If TRUE it'll search only for system tags, using pkg-config to retrieve installed packages
+	* infos. If FALSE only current project's symbols will be searched.
+	* @results_limit: Limit results to an upper bound. -1 If you don't want to use this par.
+	* @results_offset: Skip results_offset results. -1 If you don't want to use this par.	 
  	* @results_limit Limit results to an upper bound. -1 If you don't want to use this par.
  	* @results_offset Skip results_offset results. -1 If you don't want to use this par.	 
 	* @err: Error propagation and reporting.
@@ -4582,7 +4586,7 @@
 	* 
 	* Returns: fixme
 	*/
-	IAnjutaIterable* search (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *match_name, gboolean partial_name_match, gboolean global_search, gint results_limit, gint results_offset);
+	IAnjutaIterable* search (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *match_name, gboolean partial_name_match, gboolean global_symbols_search, gboolean global_tags_search, gint results_limit, gint results_offset);
 	
 	/**
 	* ianjuta_symbol_manager_get_members:

Modified: trunk/plugins/class-inheritance/class-inherit.c
==============================================================================
--- trunk/plugins/class-inheritance/class-inherit.c	(original)
+++ trunk/plugins/class-inheritance/class-inherit.c	Fri Jun  6 22:48:29 2008
@@ -102,6 +102,7 @@
 													   nodedata->name,
 													   FALSE,
 													   TRUE,
+													   FALSE,
 													   -1,
 													   -1,
 													   NULL);
@@ -322,6 +323,7 @@
 													   node_name,
 													   FALSE,
 													   TRUE,
+													   FALSE,
 													   -1,
 													   -1,
 													   NULL);
@@ -469,6 +471,7 @@
 												   node->name,
 												   FALSE,
 												   TRUE,
+												   FALSE,
 												   -1,
 												   -1,
 												   NULL);
@@ -905,7 +908,7 @@
 	iter = ianjuta_symbol_manager_search (sm, IANJUTA_SYMBOL_TYPE_CLASS, 
 										  TRUE,
 										  IANJUTA_SYMBOL_FIELD_SIMPLE,
-										  NULL, FALSE, TRUE, -1, -1, NULL);
+										  NULL, FALSE, TRUE, FALSE, -1, -1, NULL);
 	if (!iter)
 	{
 		DEBUG_PRINT ("class_inheritance_update_graph (): search returned no items.");

Modified: trunk/plugins/language-support-cpp-java/cpp-java-assist.c
==============================================================================
--- trunk/plugins/language-support-cpp-java/cpp-java-assist.c	(original)
+++ trunk/plugins/language-support-cpp-java/cpp-java-assist.c	Fri Jun  6 22:48:29 2008
@@ -135,10 +135,21 @@
 	return FALSE;
 }	
 
+/**
+ * If mergeable is NULL than no merge will be made with iter elements, elsewhere
+ * mergeable will be returned with iter elements.
+ */
 static GCompletion*
-create_completion (IAnjutaEditorAssist* iassist, IAnjutaIterable* iter)
-{
-	GCompletion *completion = g_completion_new (completion_function);
+create_completion (IAnjutaEditorAssist* iassist, IAnjutaIterable* iter,
+				   GCompletion* mergeable)
+{	
+	GCompletion *completion;
+	
+	if (mergeable == NULL)
+		completion = g_completion_new (completion_function);
+	else
+		completion = mergeable;
+	
 	GList* suggestions = NULL;
 	do
 	{
@@ -336,25 +347,43 @@
 											  const gchar *pre_word)
 {
 	gint max_completions;
+	GCompletion *completion = NULL;
 	max_completions =
 		anjuta_preferences_get_int_with_default (assist->priv->preferences,
 												 PREF_AUTOCOMPLETE_CHOICES,
 												 MAX_COMPLETIONS);
 	
 	cpp_java_assist_destroy_completion_cache (assist);
-	IAnjutaIterable* iter = 
+	IAnjutaIterable* iter_project = 
 		ianjuta_symbol_manager_search (assist->priv->isymbol_manager,
 										IANJUTA_SYMBOL_TYPE_MAX,
 									    TRUE,
 										IANJUTA_SYMBOL_FIELD_SIMPLE|IANJUTA_SYMBOL_FIELD_TYPE,
-										pre_word, TRUE, TRUE, max_completions, -1, NULL);
-	if (iter)
+										pre_word, TRUE, FALSE, FALSE, max_completions, -1, NULL);
+
+	IAnjutaIterable* iter_globals = 
+		ianjuta_symbol_manager_search (assist->priv->isymbol_manager,
+										IANJUTA_SYMBOL_TYPE_MAX,
+									    TRUE,
+										IANJUTA_SYMBOL_FIELD_SIMPLE|IANJUTA_SYMBOL_FIELD_TYPE,
+										pre_word, TRUE, TRUE, TRUE, max_completions, -1, NULL);
+	DEBUG_PRINT ("cpp_java_assist_create_word_completion_cache ()");
+	if (iter_project) 
 	{
-		assist->priv->completion_cache =
-			create_completion (assist->priv->iassist, iter);
-		assist->priv->search_cache = g_strdup (pre_word);
-		g_object_unref (iter);
+		DEBUG_PRINT ("cpp_java_assist_create_word_completion_cache () 1");
+		completion = create_completion (assist->priv->iassist, iter_project, NULL);
+		g_object_unref (iter_project);
 	}
+	
+	if (iter_globals)
+	{
+		DEBUG_PRINT ("cpp_java_assist_create_word_completion_cache () 2");
+		completion = create_completion (assist->priv->iassist, iter_project, completion);
+		g_object_unref (iter_globals);		
+	}
+	
+	assist->priv->completion_cache = completion;
+	assist->priv->search_cache = g_strdup (pre_word);
 }
 
 static gboolean
@@ -495,10 +524,9 @@
 									   IANJUTA_SYMBOL_TYPE_FUNCTION|
 									   IANJUTA_SYMBOL_TYPE_METHOD|
 									   IANJUTA_SYMBOL_TYPE_MACRO_WITH_ARG,
-									   TRUE,
-									   IANJUTA_SYMBOL_FIELD_SIMPLE,
-									   call_context, FALSE, TRUE, max_completions,
-									   -1, NULL);
+									   TRUE, IANJUTA_SYMBOL_FIELD_SIMPLE,
+									   call_context, FALSE, TRUE, TRUE,
+									   max_completions, -1, NULL);
 	if (iter)
 	{
 		do

Modified: trunk/plugins/profiler/gprof-view.c
==============================================================================
--- trunk/plugins/profiler/gprof-view.c	(original)
+++ trunk/plugins/profiler/gprof-view.c	Fri Jun  6 22:48:29 2008
@@ -130,6 +130,7 @@
 													 symbol_name,
 													 FALSE,
 													 TRUE,
+													 FALSE,
 													 -1,
 													 -1,
 													 NULL);

Modified: trunk/plugins/symbol-browser/plugin.c
==============================================================================
--- trunk/plugins/symbol-browser/plugin.c	(original)
+++ trunk/plugins/symbol-browser/plugin.c	Fri Jun  6 22:48:29 2008
@@ -1115,7 +1115,8 @@
 						IAnjutaSymbolField info_fields,
 						const gchar *match_name,
 						gboolean partial_name_match,
-						gboolean global_search,
+						gboolean global_symbols_search,
+						gboolean global_tags_search, /* unused */
 						gint results_limit, /* unused */
 						gint results_offset, /* unused */
 						GError **err)
@@ -1130,7 +1131,7 @@
 		name = NULL;
 	
 	tags_array = tm_workspace_find (name, match_types, NULL,
-									partial_name_match, global_search);
+									partial_name_match, global_symbols_search);
 	if (tags_array && tags_array->len)
 	{
 		iter = anjuta_symbol_iter_new (tags_array);

Modified: trunk/plugins/symbol-db/Makefile.am
==============================================================================
--- trunk/plugins/symbol-db/Makefile.am	(original)
+++ trunk/plugins/symbol-db/Makefile.am	Fri Jun  6 22:48:29 2008
@@ -74,7 +74,8 @@
 	$(plugin_in_files) \
 	$(symbol_db_plugin_DATA) \
 	$(symbol_db_glade_DATA) \
-	$(symbol_db_pixmaps_DATA)
+	$(symbol_db_pixmaps_DATA) \
+	$(symbol_db_data_DATA)
 
 endif
 

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Fri Jun  6 22:48:29 2008
@@ -1421,27 +1421,24 @@
 						IAnjutaSymbolField info_fields,
 						const gchar *match_name,
 						gboolean partial_name_match,
-						gboolean global_search,
+						gboolean global_symbols_search,
+						gboolean global_tags_search,
 						gint results_limit,
 						gint results_offset,
 						GError **err)
 {
 	SymbolDBEngineIterator *iterator = NULL;
 	SymbolDBPlugin *sdb_plugin;
-	SymbolDBEngine *dbe;
+	SymbolDBEngine *dbe_project;
+	SymbolDBEngine *dbe_globals;
 	GPtrArray *filter_array;
 	gchar *pattern;
 	gboolean exact_match = !partial_name_match;
 
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (sm);
-	dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);
+	dbe_project = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);
+	dbe_globals = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_globals);
 	
-	if (global_search == FALSE)
-	{
-		g_message ("isymbol_manager_search (): TODO: search provide only global searches for now");
-		return NULL;
-	}
-
 	if (match_types & IANJUTA_SYMBOL_TYPE_UNDEF)
 		filter_array = NULL;
 	else
@@ -1452,16 +1449,46 @@
 	else
 		pattern = g_strdup_printf ("%s", match_name);
 	
-	iterator = symbol_db_engine_find_symbol_by_name_pattern_filtered (dbe,
+	/* should we lookup for project of system tags? */
+	if (global_tags_search == FALSE)
+	{
+		DEBUG_PRINT ("project_tags scan ");
+		/* get symbols from current opened project */
+		iterator = symbol_db_engine_find_symbol_by_name_pattern_filtered (dbe_project,
 																	  pattern,
 																	  exact_match,
 																	  filter_array,
 																	  include_types,
-																	  global_search,
+																	  global_symbols_search,
 																	  results_limit,
 																	  results_offset,
 																	  info_fields);
-
+	}
+	else	
+	{
+		/* global_tags scan */
+		/* the only parameters to change is the engine, dbe_globals */
+		DEBUG_PRINT ("global_tags scan ");
+		gint i;
+		
+		/* FIXME REMOVE ME */
+		for (i = 0; i < filter_array->len; i++)
+		{
+			DEBUG_PRINT ("filter%d = %s", i, g_ptr_array_index (filter_array, i));
+		}
+		
+		iterator = 
+			symbol_db_engine_find_symbol_by_name_pattern_filtered (dbe_globals,
+															  pattern,
+															  exact_match,
+															  filter_array,
+															  include_types,
+															  global_symbols_search,
+															  results_limit,
+															  results_offset,
+															  info_fields);		
+	}
+	
 	g_free (pattern);
 	
 	if (filter_array)

Modified: trunk/plugins/symbol-db/plugin.h
==============================================================================
--- trunk/plugins/symbol-db/plugin.h	(original)
+++ trunk/plugins/symbol-db/plugin.h	Fri Jun  6 22:48:29 2008
@@ -50,7 +50,6 @@
 	AnjutaPreferences *prefs;
 	GtkListStore *prefs_list_store;
 	AnjutaLauncher *pkg_config_launcher;
-//	AnjutaLauncher *cflags_launcher;
 	
 	gint prefs_notify_id;
 	

Modified: trunk/plugins/symbol-db/symbol-db-engine.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine.c	Fri Jun  6 22:48:29 2008
@@ -7531,7 +7531,7 @@
  * @param exact_match Should the pattern be searched for an exact match?
  * @param filter_kinds Can be NULL. In that case these filters will be taken into consideration.
  * @param include_kinds Should the filter_kinds (if not null) be applied as inluded or excluded?
- * @param global_search If TRUE only global public function will be searched. If false
+ * @param global_symbols_search If TRUE only global public function will be searched. If false
  *		  even private or static (for C language) will be searched.
  * @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
  * @param results_offset Skip results_offset results. -1 If you don't want to use this par.	 
@@ -7552,7 +7552,7 @@
 									gboolean exact_match,
 									const GPtrArray *filter_kinds,
 									gboolean include_kinds,
-									gboolean global_search,
+									gboolean global_symbols_search,
 									gint results_limit, 
 									gint results_offset,
 									SymExtraInfo sym_info)
@@ -7612,7 +7612,7 @@
 		match_str = " LIKE ## /* name:'pattern' type:gchararray */";
 	}
 	
-	if (global_search == TRUE)
+	if (global_symbols_search == TRUE)
 	{
 		other_parameters |= 
 			DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_YES;
@@ -7830,7 +7830,7 @@
 	}
 
 	value = gda_value_new (G_TYPE_INT);
-	g_value_set_int (value, !global_search);	
+	g_value_set_int (value, !global_symbols_search);	
 	gda_holder_set_value (param, value);
 	gda_value_free (value);
 
@@ -7844,6 +7844,10 @@
 	
 	gda_holder_set_value_str (param, NULL, pattern);
 	
+
+	DEBUG_PRINT ("symbol_db_engine_find_symbol_by_name_pattern_filtered query: %s",
+				 dyn_node->query_str);
+		
 	/* execute the query with parametes just set */
 	data = gda_connection_statement_execute_select (priv->db_connection, 
 												  (GdaStatement*)dyn_node->stmt, 

Modified: trunk/plugins/symbol-db/symbol-db-engine.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine.h	Fri Jun  6 22:48:29 2008
@@ -262,7 +262,7 @@
  * @param exact_match Should the pattern be searched for an exact match?
  * @param filter_kinds Can be NULL. In that case these filters will be taken into consideration.
  * @param include_kinds Should the filter_kinds (if not null) be applied as inluded or excluded?
- * @param global_search If TRUE only global public function will be searched. If false
+ * @param global_symbols_search If TRUE only global public function will be searched. If false
  *		  even private or static (for C language) will be searched.
  * @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
  * @param results_offset Skip results_offset results. -1 If you don't want to use this par.
@@ -274,7 +274,7 @@
 									gboolean exact_match,
 									const GPtrArray *filter_kinds,
 									gboolean include_kinds,
-									gboolean global_search,
+									gboolean global_symbols_search,
 									gint results_limit, 
 									gint results_offset,
 									SymExtraInfo sym_info);

Modified: trunk/plugins/symbol-db/symbol-db-view.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-view.c	Fri Jun  6 22:48:29 2008
@@ -466,6 +466,7 @@
 	SymbolDBViewPriv *priv;
 	
 	g_return_if_fail (dbv != NULL);	
+	g_return_if_fail (kind != NULL);
 	priv = dbv->priv;
 	
 	/* add to root if parent_symbol_id is <= 0 */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]