<commit_before>(function () {
    "use strict";

    var ContextMenu = function (schema) {
        var contextMenu = this;
        contextMenu.schema = schema;
        contextMenu.allowUseContextMenu = contextMenu.allowUseContextMenu.bind(contextMenu);
        contextMenu.buildContextMenu = contextMenu.buildContextMenu.bind(contextMenu);

    };

    ContextMenu.prototype = {

        disabled: true,

        disable: function() {
          this.disabled = true;
        },

        enable: function() {
            this.disabled = false;
        },

        allowUseContextMenu: function () {
            var contextMenu = this;
            var schema = contextMenu.schema;
            return !contextMenu.disabled && schema.useContextMenu;
        }

    };


    Mapbender.Digitizer.MapContextMenu = function () {
        ContextMenu.apply(this, arguments);
    };

    Mapbender.Digitizer.MapContextMenu.prototype = Object.create(ContextMenu.prototype);

    Mapbender.Digitizer.MapContextMenu.prototype.buildContextMenu = function (element, e) {


        var contextMenu = this;
        var schema = contextMenu.schema;
        var items = {};
        var feature = schema.layer.getFeatureFromEvent(e);

        if (!feature) {
            items['no-items'] = {name: "Nothing selected!"}
        } else {
            if (feature.isNew) {
                return items;
            }
            schema.processFeature(feature, function (feature) {
                items[feature.fid] = contextMenu.createMapContextMenuSubMenu(feature);
            });

        }

        return {
            items: items,

            callback: function (key, options) {
                var $selectedElement = options.$selected;
                var feature =  $selectedElement.data().contextMenu.feature;

                if (!$selectedElement || !feature) {
                    return;
                }
                var id = feature.fid;
                var parameters = options.items[id];
                if (!parameters) {
                    return;
                }

                if (parameters.items[key].action) {
                    parameters.items[key].action(key, options, parameters);
                }
            }
        }
    };

    Mapbender.Digitizer.MapContextMenu.prototype.createMapContextMenuSubMenu = function (feature) {
        var contextMenu = this;
        var schema = contextMenu.schema;
        var subItems = {
            zoomTo: {
                name: Mapbender.DigitizerTranslator.translate('feature.zoomTo'),
                action: function (key, options, parameters) {
                    schema.zoomToJsonFeature(feature);
                }
            }
        };

        if (schema.allowChangeVisibility) {
            subItems['style'] = {
                name: Mapbender.DigitizerTranslator.translate('feature.style.change'),<commit_msg>Correct Style setting in Context menu<commit_after>(function () {
    "use strict";

    var ContextMenu = function (schema) {
        var contextMenu = this;
        contextMenu.schema = schema;
        contextMenu.allowUseContextMenu = contextMenu.allowUseContextMenu.bind(contextMenu);
        contextMenu.buildContextMenu = contextMenu.buildContextMenu.bind(contextMenu);

    };

    ContextMenu.prototype = {

        disabled: true,

        disable: function() {
          this.disabled = true;
        },

        enable: function() {
            this.disabled = false;
        },

        allowUseContextMenu: function () {
            var contextMenu = this;
            var schema = contextMenu.schema;
            return !contextMenu.disabled && schema.useContextMenu;
        }

    };


    Mapbender.Digitizer.MapContextMenu = function () {
        ContextMenu.apply(this, arguments);
    };

    Mapbender.Digitizer.MapContextMenu.prototype = Object.create(ContextMenu.prototype);

    Mapbender.Digitizer.MapContextMenu.prototype.buildContextMenu = function (element, e) {


        var contextMenu = this;
        var schema = contextMenu.schema;
        var items = {};
        var feature = schema.layer.getFeatureFromEvent(e);

        if (!feature) {
            items['no-items'] = {name: "Nothing selected!"}
        } else {
            if (feature.isNew) {
                return items;
            }
            schema.processFeature(feature, function (feature) {
                items[feature.fid] = contextMenu.createMapContextMenuSubMenu(feature);
            });

        }

        return {
            items: items,

            callback: function (key, options) {
                var $selectedElement = options.$selected;
                var feature =  $selectedElement.data().contextMenu.feature;

                if (!$selectedElement || !feature) {
                    return;
                }
                var id = feature.fid;
                var parameters = options.items[id];
                if (!parameters) {
                    return;
                }

                if (parameters.items[key].action) {
                    parameters.items[key].action(key, options, parameters);
                }
            }
        }
    };

    Mapbender.Digitizer.MapContextMenu.prototype.createMapContextMenuSubMenu = function (feature) {
        var contextMenu = this;
        var schema = contextMenu.schema;
        var subItems = {
            zoomTo: {
                name: Mapbender.DigitizerTranslator.translate('feature.zoomTo'),
                action: function (key, options, parameters) {
                    schema.zoomToJsonFeature(feature);
                }
            }
        };

        if (schema.allowCustomStyle) {
            subItems['style'] = {
                name: Mapbender.DigitizerTranslator.translate('feature.style.change'),
{'fraction_non_alphanumeric': 0.10019001554672655, 'fraction_numerical': 0.0, 'mean_word_length': 1.7132146204311154, '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': '1858320', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1413, 'n_words': 266}