<commit_before>package pipe.actions.animate;

import pipe.controllers.PetriNetController;
import pipe.gui.Animator;
import pipe.gui.ApplicationSettings;
import pipe.gui.Constants;
import pipe.gui.PetriNetTab;
import pipe.models.PetriNet;
import pipe.models.PipeApplicationModel;
import pipe.views.PetriNetViewComponent;
import pipe.views.PipeApplicationView;

import javax.swing.*;
import java.awt.event.ActionEvent;

public class ToggleAnimateAction extends AnimateAction {
    public ToggleAnimateAction(final String name, final String tooltip, final String keystroke) {
        super(name, tooltip, keystroke);
    }

    @Override
    public void actionPerformed(ActionEvent event) {

        PipeApplicationView pipeApplicationView = ApplicationSettings.getApplicationView();
        PetriNetTab currentTab = pipeApplicationView.getCurrentTab();
        PipeApplicationModel applicationModel = ApplicationSettings.getApplicationModel();
        try
        {
            boolean isTabAnimated = currentTab.isInAnimationMode();
            pipeApplicationView.setAnimationMode(!isTabAnimated);
            PetriNetController controller = currentTab.getPetriNetController();
            if(!isTabAnimated)
            {
                applicationModel.restoreMode();
                PetriNetViewComponent.ignoreSelection(false);
            }
            else
            {
                PetriNetViewComponent.ignoreSelection(true);
                Animator animator = controller.getAnimator();
                animator.clear();
                // Do we keep the selection??
                currentTab.getSelectionObject().clearSelection();
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
            JOptionPane.showMessageDialog(pipeApplicationView, e.toString(),
                    "Animation Mode Error", JOptionPane.ERROR_MESSAGE);
            applicationModel.startAction.setSelected(false);
            currentTab.changeAnimationMode(false);
        }
        applicationModel.stepforwardAction.setEnabled(false);
        applicationModel.stepbackwardAction.setEnabled(false);
    }<commit_msg>Mark enabled transitions<commit_after>package pipe.actions.animate;

import pipe.controllers.PetriNetController;
import pipe.gui.Animator;
import pipe.gui.ApplicationSettings;
import pipe.gui.Constants;
import pipe.gui.PetriNetTab;
import pipe.models.PetriNet;
import pipe.models.PipeApplicationModel;
import pipe.views.PetriNetViewComponent;
import pipe.views.PipeApplicationView;

import javax.swing.*;
import java.awt.event.ActionEvent;

public class ToggleAnimateAction extends AnimateAction {
    public ToggleAnimateAction(final String name, final String tooltip, final String keystroke) {
        super(name, tooltip, keystroke);
    }

    @Override
    public void actionPerformed(ActionEvent event) {

        PipeApplicationView pipeApplicationView = ApplicationSettings.getApplicationView();
        PetriNetTab currentTab = pipeApplicationView.getCurrentTab();
        PipeApplicationModel applicationModel = ApplicationSettings.getApplicationModel();
        try
        {
            boolean isTabAnimated = currentTab.isInAnimationMode();
            pipeApplicationView.setAnimationMode(!isTabAnimated);
            PetriNetController controller = currentTab.getPetriNetController();
            if(!isTabAnimated)
            {
                applicationModel.restoreMode();
                PetriNetViewComponent.ignoreSelection(false);
                PetriNet petriNet = controller.getPetriNet();
                petriNet.markEnabledTransitions();
            }
            else
            {
                PetriNetViewComponent.ignoreSelection(true);
                Animator animator = controller.getAnimator();
                animator.clear();
                // Do we keep the selection??
                currentTab.getSelectionObject().clearSelection();
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
            JOptionPane.showMessageDialog(pipeApplicationView, e.toString(),
                    "Animation Mode Error", JOptionPane.ERROR_MESSAGE);
            applicationModel.startAction.setSelected(false);
            currentTab.changeAnimationMode(false);
        }
        applicationModel.stepforwardAction.setEnabled(false);
        applicationModel.stepbackwardAction.setEnabled(false);
    }
{'fraction_non_alphanumeric': 0.0782942238267148, 'fraction_numerical': 0.0, 'mean_word_length': 2.7440878378378377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4439477', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1050, 'n_words': 190}