<commit_before>// $Header$
/*
 * Copyright 2001-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
*/

package org.apache.jmeter.gui.action;

import java.awt.event.ActionEvent;
import java.util.HashSet;
import java.util.Set;

import org.apache.jmeter.gui.GuiPackage;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

/**
 * @version $Revision$
 */
public class EnableComponent implements Command
{
    private static Logger log = LoggingManager.getLoggerForClass();

    public static final String ENABLE = "enable";
    public static final String DISABLE = "disable";

    private static Set commands = new HashSet();
    static
    {
        commands.add(ENABLE);
        commands.add(DISABLE);
    }

    /**
     * @see org.apache.jmeter.gui.action.Command#doAction(ActionEvent)
     */
    public void doAction(ActionEvent e)
    {
        if (e.getActionCommand().equals(ENABLE))
        {
            log.debug("enabling current gui object");
            GuiPackage.getInstance().getCurrentNode().setEnabled(true);
            GuiPackage.getInstance().getCurrentGui().setEnabled(true);
        }
        else if (e.getActionCommand().equals(DISABLE))
        {
            log.debug("disabling current gui object");
            GuiPackage.getInstance().getCurrentNode().setEnabled(false);
            GuiPackage.getInstance().getCurrentGui().setEnabled(false);
        }
    }

    /**
     * @see org.apache.jmeter.gui.action.Command#getActionNames()
     */
    public Set getActionNames()
    {
        return commands;
    }
}<commit_msg>29754 	Disabling/Activating multiple Samplers at once<commit_after>// $Header$
/*
 * Copyright 2001-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
*/

package org.apache.jmeter.gui.action;

import java.awt.event.ActionEvent;
import java.util.HashSet;
import java.util.Set;

import org.apache.jmeter.gui.GuiPackage;
import org.apache.jmeter.gui.tree.JMeterTreeNode;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

/**
 * @version $Revision$
 */
public class EnableComponent implements Command
{
    private static Logger log = LoggingManager.getLoggerForClass();

    public static final String ENABLE = "enable";
    public static final String DISABLE = "disable";

    private static Set commands = new HashSet();
    static
    {
        commands.add(ENABLE);
        commands.add(DISABLE);
    }

    /**
     * @see org.apache.jmeter.gui.action.Command#doAction(ActionEvent)
     */
    public void doAction(ActionEvent e)
    {
    	JMeterTreeNode[] nodes =
    		GuiPackage.getInstance().getTreeListener().getSelectedNodes();
    	
        if (e.getActionCommand().equals(ENABLE))
        {
            log.debug("enabling currently selected gui objects");
            enableComponents(nodes,true);
        }
        else if (e.getActionCommand().equals(DISABLE))
        {
            log.debug("disabling currently selected gui objects");
            enableComponents(nodes,false);
        }
    }

    private void enableComponents(JMeterTreeNode[] nodes, boolean enable)
    {
    	GuiPackage pack = GuiPackage.getInstance();
    	for(int i=0;i<nodes.length;i++)
    	{
    		nodes[i].setEnabled(enable);
    		pack.getGui(nodes[i].getTestElement()).setEnabled(enable);
    	}
    }

    /**
     * @see org.apache.jmeter.gui.action.Command#getActionNames()
     */
    public Set getActionNames()
    {
        return commands;
    }
}
{'fraction_non_alphanumeric': 0.10691547749725576, 'fraction_numerical': 0.006586169045005488, 'mean_word_length': 3.017636684303351, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '934531', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1258, 'n_words': 349}