Exemplo n.º 1
0
		public override void Visit( AbstractComponent component )
		{
			if( component is MethodComponent )
			{
				this.Methods.Add( component );
			}
			else if( component is FieldComponent )
			{
				this.Fields.Add( component );
			}
			else if( component is PropertyComponent )
			{
				this.Properties.Add( component );
			}
			else if( component is ClassComponent )
			{
				this.InnerClasses.Add( component );
			}
			else
			{
				throw new ApplicationException("Unexpected type" + component );
			}
		}
		public override void Visit(AbstractComponent component)
		{
		}
Exemplo n.º 3
0
		public override void Visit( AbstractComponent component )
		{
			this.Files.Add( component );
		}
Exemplo n.º 4
0
		protected void WalkElements( CodeElement cein, AbstractComponent parent )
		{
			CodeElements ces;
			switch( cein.Kind )
			{
				// Handle namespaces
				case EnvDTE.vsCMElement.vsCMElementNamespace:
				{
					CodeNamespace cn = (CodeNamespace) cein;
										
					ces = cn.Members;
					foreach (CodeElement ce in ces)
						WalkElements(ce, parent );
					break;
				}
				// Handle classes
				case EnvDTE.vsCMElement.vsCMElementClass:
				{
					CodeClass cc = (CodeClass) cein;
					
					ClassComponent cls = new ClassComponent( cc.FullName, cc.Name );
					cls.CodeClass = cc;
					parent.Visit( cls );

					ces = cc.Members;
					foreach (CodeElement ce in ces)
						WalkElements(ce, cls );
					break;	
				}
				// Handle interfaces
				case EnvDTE.vsCMElement.vsCMElementInterface:
				{
					CodeInterface ci = (CodeInterface) cein;

					// nothing for now.
					
					break;
				}
				// Handle methods (functions)
				case  EnvDTE.vsCMElement.vsCMElementFunction:
				{
					CodeFunction cf = (CodeFunction) cein;

					MethodComponent mc = new MethodComponent( cf.FullName, cf.Name );
					parent.Visit( mc );
					mc.CreateRepresentation( GetFunctionText( cf ) );
					mc.CodeFunction = cf;

					break;
				}
				// Handle properties
				case EnvDTE.vsCMElement.vsCMElementProperty:
				{
					CodeProperty cp = (CodeProperty) cein;

					PropertyComponent pc = new PropertyComponent( cp.FullName, cp.Name );
					parent.Visit( pc );

					break;
				}
				// Handle fields (variables)
				case EnvDTE.vsCMElement.vsCMElementVariable:
				{
					CodeVariable cv = (CodeVariable) cein;

					FieldComponent fc = new FieldComponent( cv.FullName, cv.Name );
					parent.Visit( fc );
					
					break;
				}
			}
		}
Exemplo n.º 5
0
		public abstract void Visit( AbstractComponent component );
Exemplo n.º 6
0
		public override void Visit( AbstractComponent component )
		{
			this.Projects.Add( component );
		}