### Eclipse Workspace Patch 1.0
#P xwiki-core-rendering
Index: xwiki-rendering-macros/xwiki-rendering-macro-message/src/main/java/org/xwiki/rendering/macro/message/MessageMacroParameters.java
===================================================================
--- xwiki-rendering-macros/xwiki-rendering-macro-message/src/main/java/org/xwiki/rendering/macro/message/MessageMacroParameters.java	(revision 0)
+++ xwiki-rendering-macros/xwiki-rendering-macro-message/src/main/java/org/xwiki/rendering/macro/message/MessageMacroParameters.java	(revision 0)
@@ -0,0 +1,57 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.rendering.macro.message;
+
+import org.xwiki.rendering.macro.descriptor.ParameterMandatory;
+import org.apache.commons.lang.StringUtils;
+import org.xwiki.rendering.macro.descriptor.ParameterDescription;
+
+/**
+ * Parameters for macro message.
+ * 
+ * @version $Id: $
+ * @since 1.8
+ */
+public class MessageMacroParameters
+{
+    /**
+     * Refer to {@link #getText()}.
+     */
+    private String text = StringUtils.EMPTY;
+    
+    /**
+     * @return the text to be displayed in the error message.
+     */
+    public String getText()
+    {
+        return text;
+    }
+
+    /**
+     * @param text - refer to {@link #getText()}
+     */
+    @ParameterDescription("the title which is to be displayed in the the message")
+    @ParameterMandatory
+    public void setText(String text)
+    {
+        this.text = text;
+    }
+
+}
Index: xwiki-rendering-macros/xwiki-rendering-macro-message/src/main/resources/META-INF/plexus/components.xml
===================================================================
--- xwiki-rendering-macros/xwiki-rendering-macro-message/src/main/resources/META-INF/plexus/components.xml	(revision 0)
+++ xwiki-rendering-macros/xwiki-rendering-macro-message/src/main/resources/META-INF/plexus/components.xml	(revision 0)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+-->
+
+<component-set>
+  <components>
+    <component>
+      <role>org.xwiki.rendering.macro.Macro</role>
+      <role-hint>error</role-hint>
+      <implementation>org.xwiki.rendering.internal.macro.message.MessageMacro</implementation>
+      <instantiation-strategy>singleton</instantiation-strategy>
+      <configuration>
+        <priority>1000</priority>
+      </configuration>
+      <requirements>
+        <requirement>
+          <role>org.xwiki.rendering.macro.Macro</role>
+          <role-hint>box</role-hint>
+          <field-name>boxMacro</field-name>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.xwiki.rendering.macro.Macro</role>
+      <role-hint>warning</role-hint>
+      <implementation>org.xwiki.rendering.internal.macro.message.MessageMacro</implementation>
+      <instantiation-strategy>singleton</instantiation-strategy>
+      <configuration>
+        <priority>1000</priority>
+      </configuration>
+      <requirements>
+        <requirement>
+          <role>org.xwiki.rendering.macro.Macro</role>
+          <role-hint>box</role-hint>
+          <field-name>boxMacro</field-name>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.xwiki.rendering.macro.Macro</role>
+      <role-hint>info</role-hint>
+      <implementation>org.xwiki.rendering.internal.macro.message.MessageMacro</implementation>
+      <instantiation-strategy>singleton</instantiation-strategy>
+      <configuration>
+        <priority>1000</priority>
+      </configuration>
+      <requirements>
+        <requirement>
+          <role>org.xwiki.rendering.macro.Macro</role>
+          <role-hint>box</role-hint>
+          <field-name>boxMacro</field-name>
+        </requirement>
+      </requirements>
+    </component>
+
+  </components>
+</component-set>
Index: xwiki-rendering-macros/xwiki-rendering-macro-message/src/test/resources/macromessage1.test
===================================================================
--- xwiki-rendering-macros/xwiki-rendering-macro-message/src/test/resources/macromessage1.test	(revision 0)
+++ xwiki-rendering-macros/xwiki-rendering-macro-message/src/test/resources/macromessage1.test	(revision 0)
@@ -0,0 +1,32 @@
+.#-----------------------------------------------------
+.input|xwiki/2.0
+.#-----------------------------------------------------
+{{error text="That's a bloody error message"/}}
+.#-----------------------------------------------------
+.expect|xhtml/1.0
+.#-----------------------------------------------------
+<!--startmacro:error|-|text="That's a bloody error message"|-|--><span class="box errormessage">That's a bloody error message</span><!--stopmacro-->
+.#-----------------------------------------------------
+.expect|xwiki/2.0
+.#-----------------------------------------------------
+{{error text="That's a bloody error message"/}}
+.#-----------------------------------------------------
+.expect|event/1.0
+.#-----------------------------------------------------
+beginDocument
+beginMacroMarkerStandalone [error] [text=That's a bloody error message] []
+beginFormat: [NONE] [[class]=[box errormessage]]
+onWord [That]
+onSpecialSymbol [']
+onWord [s]
+onSpace
+onWord [a]
+onSpace
+onWord [bloody]
+onSpace
+onWord [error]
+onSpace
+onWord [message]
+endFormat: [NONE] [[class]=[box errormessage]]
+endMacroMarkerStandalone [error] [text=That's a bloody error message] []
+endDocument
\ No newline at end of file
Index: xwiki-rendering-macros/xwiki-rendering-macro-message/src/test/java/org/xwiki/rendering/RenderingTests.java
===================================================================
--- xwiki-rendering-macros/xwiki-rendering-macro-message/src/test/java/org/xwiki/rendering/RenderingTests.java	(revision 0)
+++ xwiki-rendering-macros/xwiki-rendering-macro-message/src/test/java/org/xwiki/rendering/RenderingTests.java	(revision 0)
@@ -0,0 +1,44 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.rendering;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+
+import org.xwiki.rendering.scaffolding.RenderingPlexusTestSetup;
+import org.xwiki.rendering.scaffolding.RenderingTestSuite;
+
+/**
+ * All Rendering integration tests defined in text files using a special format.
+ * 
+ * @version $Id: $
+ * @since 1.8
+ */
+public class RenderingTests extends TestCase
+{
+    public static Test suite() throws Exception
+    {
+        RenderingTestSuite suite = new RenderingTestSuite("Test Message Macro");
+
+        suite.addTestsFromResource("macromessage1", true);
+
+        return new RenderingPlexusTestSetup(suite);
+    }
+}
Index: xwiki-rendering-macros/xwiki-rendering-macro-message/src/main/java/org/xwiki/rendering/internal/macro/message/MessageMacro.java
===================================================================
--- xwiki-rendering-macros/xwiki-rendering-macro-message/src/main/java/org/xwiki/rendering/internal/macro/message/MessageMacro.java	(revision 0)
+++ xwiki-rendering-macros/xwiki-rendering-macro-message/src/main/java/org/xwiki/rendering/internal/macro/message/MessageMacro.java	(revision 0)
@@ -0,0 +1,103 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.xwiki.rendering.internal.macro.message;
+
+import java.util.List;
+
+import org.xwiki.rendering.block.Block;
+import org.xwiki.rendering.macro.AbstractMacro;
+import org.xwiki.rendering.macro.Macro;
+import org.xwiki.rendering.macro.MacroExecutionException;
+import org.xwiki.rendering.macro.box.BoxMacroParameters;
+import org.xwiki.rendering.macro.descriptor.DefaultMacroDescriptor;
+import org.xwiki.rendering.macro.message.MessageMacroParameters;
+import org.xwiki.rendering.transformation.MacroTransformationContext;
+
+/**
+ * Displays a message, which can be an error, a warning or an info note.
+ * 
+ * @param <P> the type of macro parameters bean.
+ * @version $Id: $
+ * @since 1.8
+ */
+public class MessageMacro<P extends MessageMacroParameters> extends AbstractMacro<P>
+{
+    /**
+     * The description of the macro.
+     */
+    private static final String DESCRIPTION = "Displays a message, which can be an error, a warning or an info note.";
+
+    /**
+     * Injected by the component manager.
+     */
+    private Macro<BoxMacroParameters> boxMacro;
+    
+    /**
+     * Create and initialize the descriptor of the macro.
+     */
+    public MessageMacro()
+    {
+        super(new DefaultMacroDescriptor(DESCRIPTION, MessageMacroParameters.class));
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.xwiki.rendering.macro.Macro#execute(Object, String, MacroTransformationContext)
+     */
+    public List<Block> execute(MessageMacroParameters parameters, String content, MacroTransformationContext context) 
+        throws MacroExecutionException
+    {
+        String macroName = context.getCurrentMacroBlock().getName();
+        BoxMacroParameters boxParameters = new BoxMacroParameters();
+
+        if (macroName.equals("warning")) {
+            boxParameters.setCssClass("warningmessage");
+            boxParameters.setTitle("(%class=\"messagetype\"%)Warning:");            
+        } 
+        
+        if (macroName.equals("info")) {
+            boxParameters.setCssClass("infomessage");
+            boxParameters.setTitle("(%class=\"messagetype\"%)Info:");
+        } 
+
+        if (macroName.equals("error")) {
+            boxParameters.setCssClass("errormessage");
+            boxParameters.setTitle("(%class=\"messagetype\"%)Error:");
+        } 
+        
+        //for esthetic reasons, we need to display the box in an inline manner regardless the macro context
+        boolean inlineMode = context.isInline();
+        context.setInline(true);
+        List<Block> result = boxMacro.execute(boxParameters, parameters.getText(), context);
+        context.setInline(inlineMode);
+        return result; 
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.xwiki.rendering.macro.Macro#supportsInlineMode()
+     */
+    public boolean supportsInlineMode()
+    {
+        return true;
+    }
+}
Index: xwiki-rendering-macros/xwiki-rendering-macro-message/pom.xml
===================================================================
--- xwiki-rendering-macros/xwiki-rendering-macro-message/pom.xml	(revision 0)
+++ xwiki-rendering-macros/xwiki-rendering-macro-message/pom.xml	(revision 0)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ *
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <!--
+  <parent>
+    <groupId>org.xwiki.platform</groupId>
+    <artifactId>xwiki-core-rendering-macros-parent</artifactId>
+    <version>1.8-SNAPSHOT</version>
+  </parent>
+  -->
+  <parent>
+    <artifactId>xwiki-core-rendering-macros-parent</artifactId>
+    <groupId>org.xwiki.platform</groupId>
+    <version>1.9-SNAPSHOT</version>
+  </parent>
+  <artifactId>xwiki-core-rendering-macro-message</artifactId>
+  <name>XWiki Platform - Core - Rendering - Macro - Message</name>
+  <version>1.9-SNAPSHOT</version>
+  <description>XWiki Platform - Core - Rendering - Macro - Message</description>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/RenderingTests.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <!-- Apply the Checkstyle configurations defined in the top level pom.xml file -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>org.xwiki.platform</groupId>
+      <artifactId>xwiki-core-rendering-macro-box</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+  </dependencies>
+</project>
