Inheritance: LanguageElement
Example #1
0
		/// <exception cref="BadSyntaxException">
		/// The <paramref name="declaration"/> does not fit to the syntax.
		/// </exception>
		/// <exception cref="ReservedNameException">
		/// The parameter name is already exists.
		/// </exception>
		public override Parameter ModifyParameter(Parameter parameter, string declaration)
		{
			Match match = singleParamterRegex.Match(declaration);
			int index = InnerList.IndexOf(parameter);

			if (index < 0)
				return parameter;

			if (match.Success)
			{
				Group nameGroup = match.Groups["name"];
				Group typeGroup = match.Groups["type"];

				if (IsReservedName(nameGroup.Value, index))
					throw new ReservedNameException(nameGroup.Value);

				Parameter newParameter = new JavaParameter(nameGroup.Value, typeGroup.Value);
				InnerList[index] = newParameter;
				return newParameter;
			}
			else
			{
				throw new BadSyntaxException(
					Strings.ErrorInvalidParameterDeclaration);
			}
		}
Example #2
0
		private void DrawItem(IGraphics g, Parameter parameter, Rectangle record, Style style)
		{
			Font font = GetFont(style);
			string memberString = parameter.ToString();
			parameterBrush.Color = style.EnumItemColor;

			if (style.UseIcons)
			{
				Image icon = Properties.Resources.Parameter;
				g.DrawImage(icon, record.X, record.Y);

				Rectangle textBounds = new Rectangle(
					record.X + IconSpacing, record.Y,
					record.Width - IconSpacing, record.Height);

				g.DrawString(memberString, font, parameterBrush, textBounds, memberFormat);
			}
			else
			{
				g.DrawString(memberString, font, parameterBrush, record, memberFormat);
			}
		}
Example #3
0
		public void RemoveParameter(Parameter parameter)
		{
			argumentList.Remove(parameter);
			Changed();
		}
Example #4
0
		/// <exception cref="BadSyntaxException">
		/// The name does not fit to the syntax.
		/// </exception>
		/// <exception cref="ReservedNameException">
		/// The parameter name is already exists.
		/// </exception>
		public Parameter ModifyParameter(Parameter parameter, string declaration)
		{
			Parameter modified = argumentList.ModifyParameter(parameter, declaration);

			Changed();
			return modified;
		}