/**
 * Daniel Ricci <thedanny09@gmail.com>
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without restriction,
 * including without limitation the rights to use, copy, modify, merge,
 * publish, distribute, sublicense, and/or sell copies of the Software,
 * and to permit persons to whom the Software is furnished to do so, subject
 * to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

package menu;

import java.awt.event.ActionEvent;

import javax.swing.JComponent;
import javax.swing.JMenuItem;

import application.MainApplication;
import engine.core.navigation.AbstractMenuItem;
import engine.core.navigation.MenuBuilder;
import engine.utils.globalisation.Localization;
import resources.LocalizedStrings;

/**
 * The menu item for a new game in the debugger
 * 
 * @author Daniel Ricci {@literal <thedanny09@gmail.com>}
 *
 */
public class DebugGameMenuItem extends AbstractMenuItem {

    /**
     * Constructs a new instance of this class type
     * 
     * @param parent The parent of this menu item
     */
    public DebugGameMenuItem(JComponent parent) {
        super(new JMenuItem(Localization.instance().getLocalizedString(LocalizedStrings.DebugNew)), parent);
    }

    @Override public void onExecute(ActionEvent actionEvent) {
        MenuBuilder.search(MainApplication.instance().getJMenuBar(), NewGameMenuItem.class).onExecute(null);
    }
}
@@ -1294,35 +1294,39 @@
 ore.
-navigation.AbstractMenuItem
+factories.AbstractSignalFactory
 ;%0Aim
@@ -1353,27 +1353,32 @@
 igation.
-MenuBuilder
+AbstractMenuItem
 ;%0Aimport
@@ -1415,24 +1415,54 @@
 calization;%0A
+import game.core.ViewFactory;%0A
 import resou
@@ -1483,16 +1483,48 @@
 Strings;
+%0Aimport views.DebuggerBoardView;
 %0A%0A/**%0A *
@@ -2064,106 +2064,434 @@
     
-MenuBuilder.search(MainApplication.instance().getJMenuBar(), NewGameMenuItem.class).onExecute(null
+// Flush the application before continuing%0A        if(!MainApplication.instance().clear()) %7B%0A            return;%0A        %7D%0A%0A        // Create the board view%0A        DebuggerBoardView view = AbstractSignalFactory.getFactory(ViewFactory.class).add(new DebuggerBoardView(), true);%0A%0A        // Add the view to the application%0A        MainApplication.instance().add(view);%0A%0A        // Render the specified view%0A        view.render(
 );%0A 

Debug new game now calls the right view