コード例 #1
0
		internal static string BindToClass (Project project, Stetic.ActionGroupInfo group)
		{
			GuiBuilderProject gproject = GtkDesignInfo.FromProject (project).GuiBuilderProject;
			string file = gproject.GetSourceCodeFile (group);
			if (file != null)
				return file;
				
			// Find the classes that could be bound to this design
			
			ArrayList list = new ArrayList ();
			var ctx = gproject.GetParserContext ();
			foreach (var cls in ctx.MainAssembly.GetAllTypeDefinitions ())
				if (IsValidClass (cls))
					list.Add (cls.FullName);
		
			// Ask what to do
			
			using (BindDesignDialog dialog = new BindDesignDialog (group.Name, list, project.BaseDirectory)) {
				if (!dialog.Run ())
					return null;
				
				if (dialog.CreateNew)
					CreateClass (project, (Stetic.ActionGroupComponent) group.Component, dialog.ClassName, dialog.Namespace, dialog.Folder);

				string fullName = dialog.Namespace.Length > 0 ? dialog.Namespace + "." + dialog.ClassName : dialog.ClassName;
				group.Name = fullName;
			}
			return gproject.GetSourceCodeFile (group);
		}
コード例 #2
0
		public bool BindToClass ()
		{
			if (SourceCodeFile != FilePath.Null)
				return true;
			
			// Find the classes that could be bound to this design
			var ctx = fproject.GetParserContext ();
			ArrayList list = new ArrayList ();
			foreach (var cls in ctx.MainAssembly.GetAllTypeDefinitions ()) {
				if (IsValidClass (cls))
					list.Add (cls.FullName);
			}
		
			// Ask what to do

			try {
				using (BindDesignDialog dialog = new BindDesignDialog (Name, list, Project.Project.BaseDirectory)) {
					if (!dialog.Run ())
						return false;
					
					if (dialog.CreateNew)
						CreateClass (dialog.ClassName, dialog.Namespace, dialog.Folder);

					string fullName = dialog.Namespace.Length > 0 ? dialog.Namespace + "." + dialog.ClassName : dialog.ClassName;
					rootWidget.Name = fullName;
					fproject.SaveWindow (true, fullName);
				}
				return true;
			} catch (Exception ex) {
				LoggingService.LogInternalError (ex);
				return false;
			}
		}
コード例 #3
0
		public bool BindToClass ()
		{
			if (SourceCodeFile != FilePath.Null)
				return true;
			
			// Find the classes that could be bound to this design
			ProjectDom ctx = fproject.GetParserContext ();
			ArrayList list = new ArrayList ();
			foreach (IType cls in ctx.Types) {
				if (IsValidClass (ctx, cls))
					list.Add (cls.FullName);
			}
		
			// Ask what to do

			try {
				using (BindDesignDialog dialog = new BindDesignDialog (Name, list, Project.Project.BaseDirectory)) {
					if (!dialog.Run ())
						return false;
					
					if (dialog.CreateNew)
						CreateClass (dialog.ClassName, dialog.Namespace, dialog.Folder);

					string fullName = dialog.Namespace.Length > 0 ? dialog.Namespace + "." + dialog.ClassName : dialog.ClassName;
					rootWidget.Name = fullName;
					fproject.Save (true);
				}
				return true;
			} catch (Exception ex) {
				MessageService.ShowException (ex);
				return false;
			}
		}