// Path: src/main/java/bv/offa/netbeans/cnd/unittest/api/CndTestSuite.java
// public class CndTestSuite extends TestSuite
// {
//     private final TestFramework framework;
//     
//     public CndTestSuite(String name, TestFramework framework)
//     {
//         super(name);
//         this.framework = framework;
//     }
// 
//     
//     /**
//      * Returns the framework.
//      * 
//      * @return  Framework
//      */
//     public TestFramework getFramework()
//     {
//         return framework;
//     }
//     
// }


import bv.offa.netbeans.cnd.unittest.api.CndTestSuite;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Action;
import org.netbeans.modules.gsf.testrunner.ui.api.Locator;
import org.netbeans.modules.gsf.testrunner.ui.api.TestsuiteNode;
import org.openide.nodes.Node;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
/*
 * NBCndUnit - C/C++ unit tests for NetBeans.
 * Copyright (C) 2015-2021  offa
 *
 * This file is part of NBCndUnit.
 *
 * NBCndUnit is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * NBCndUnit 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with NBCndUnit.  If not, see <http://www.gnu.org/licenses/>.
 */

package bv.offa.netbeans.cnd.unittest.ui;


/**
 * The class {@code TestRunnerTestSuiteNode} implements a frame node for
 * a testsuite.
 *
 * @author offa
 */
public class TestRunnerTestSuiteNode extends TestsuiteNode
{
    private final String actionName = NbBundle.getMessage(TestRunnerTestSuiteNode.class, "LBL_Action_GoToSource");

    public TestRunnerTestSuiteNode(String suiteName, boolean filtered)
    {
        super(null, suiteName, filtered, Lookups.singleton((Locator) (Node node) ->
        {
            Action jumpTo = node.getPreferredAction();

            if( jumpTo != null )
            {
                jumpTo.actionPerformed(null);
            }
        }));
    }



    /**
     * Returns the preferred action.
     *
     * @return      Action
     */
    @Override
    public Action getPreferredAction()
    {
// Path: src/main/java/bv/offa/netbeans/cnd/unittest/api/CndTestSuite.java
// public class CndTestSuite extends TestSuite
// {
//     private final TestFramework framework;
//     
//     public CndTestSuite(String name, TestFramework framework)
//     {
//         super(name);
//         this.framework = framework;
//     }
// 
//     
//     /**
//      * Returns the framework.
//      * 
//      * @return  Framework
//      */
//     public TestFramework getFramework()
//     {
//         return framework;
//     }
//     
// }


// Path: src/main/java/bv/offa/netbeans/cnd/unittest/ui/TestRunnerTestSuiteNode.java
import bv.offa.netbeans.cnd.unittest.api.CndTestSuite;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Action;
import org.netbeans.modules.gsf.testrunner.ui.api.Locator;
import org.netbeans.modules.gsf.testrunner.ui.api.TestsuiteNode;
import org.openide.nodes.Node;
import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;

/*
 * NBCndUnit - C/C++ unit tests for NetBeans.
 * Copyright (C) 2015-2021  offa
 *
 * This file is part of NBCndUnit.
 *
 * NBCndUnit is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * NBCndUnit 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with NBCndUnit.  If not, see <http://www.gnu.org/licenses/>.
 */

package bv.offa.netbeans.cnd.unittest.ui;


/**
 * The class {@code TestRunnerTestSuiteNode} implements a frame node for
 * a testsuite.
 *
 * @author offa
 */
public class TestRunnerTestSuiteNode extends TestsuiteNode
{
    private final String actionName = NbBundle.getMessage(TestRunnerTestSuiteNode.class, "LBL_Action_GoToSource");

    public TestRunnerTestSuiteNode(String suiteName, boolean filtered)
    {
        super(null, suiteName, filtered, Lookups.singleton((Locator) (Node node) ->
        {
            Action jumpTo = node.getPreferredAction();

            if( jumpTo != null )
            {
                jumpTo.actionPerformed(null);
            }
        }));
    }



    /**
     * Returns the preferred action.
     *
     * @return      Action
     */
    @Override
    public Action getPreferredAction()
    {
        return new GoToSourceSuiteTestNodeAction(actionName, (CndTestSuite) suite, report.getProject());