<commit_before>"use strict";

define(['js/Utils/GMEConcepts',
    'js/DragDrop/DragHelper',
    'js/NodePropertyNames',
    'js/RegistryKeys',
    './../Crosscut/CrosscutConstants',
    'js/Panels/ControllerBase/DiagramDesignerWidgetMultiTabMemberListControllerBase'], function (
                                               GMEConcepts,
                                               DragHelper,
                                               nodePropertyNames,
                                               REGISTRY_KEYS,
                                               ManualAspectConstants,
                                               DiagramDesignerWidgetMultiTabMemberListControllerBase) {

    var SetEditorController;

    SetEditorController = function (options) {
        options = options || {};
        options.loggerName = "SetEditorController";

        DiagramDesignerWidgetMultiTabMemberListControllerBase.call(this, options);

        this.logger.debug("SetEditorController ctor finished");
    };

    _.extend(SetEditorController.prototype, DiagramDesignerWidgetMultiTabMemberListControllerBase.prototype);

    SetEditorController.prototype.getOrderedMemberListInfo = function (memberListContainerObject) {
        var result = [],
            setNames = memberListContainerObject.getSetNames() || [],
            manualAspectsRegistry = memberListContainerObject.getRegistry(REGISTRY_KEYS.CROSSCUTS) || [],
            manualAspectSetNames = [],
            len;

        //filter out ManualAspects from the list
        _.each(manualAspectsRegistry, function (element/*, index, list*/) {
            manualAspectSetNames.push(element.SetID);
        });

        setNames = _.difference(setNames, manualAspectSetNames);

        len = setNames.length;
        while (len--) {
            result.push({'memberListID': setNames[len],
                'title': setNames[len],
                'enableDeleteTab': false,
                'enableRenameTab': false});
        }

        result.sort(function (a,b) {
            if (a.title.toLowerCase() < b.title.toLowerCase()) {
                return -1;
            } else {
                return 1;
            }
        });

        return result;
    };


    /**********************************************************/
    /*         HANDLE OBJECT DRAG & DROP ACCEPTANCE           */
    /**********************************************************/
    SetEditorController.prototype._onBackgroundDroppableAccept = function(event, dragInfo) {
        var gmeIDList = DragHelper.getDragItems(dragInfo),
            accept = DiagramDesignerWidgetMultiTabMemberListControllerBase.prototype._onBackgroundDroppableAccept.call(this, event, dragInfo);

        if (accept === true) {
            //if based on the DiagramDesignerWidgetMultiTabMemberListControllerBase check it could be accepted, ie items are not members of the set so far
            //we need to see if we can accept them based on the META rules
            accept = GMEConcepts.canAddToSet(this._memberListContainerID, this._selectedMemberListID, gmeIDList);
        }

        return accept;
    };
    /**********************************************************/
    /*  END OF --- HANDLE OBJECT DRAG & DROP ACCEPTANCE       */
    /**********************************************************/

    /*
     * Overwrite 'no tab' warning message to the user
     */
    SetEditorController.prototype.displayNoTabMessage = function () {
        var msg = 'The currently selected object does not contain any sets.';

        this._widget.setBackgroundText(msg);
    };

    return SetEditorController;
});
<commit_msg>bugfix: filter out aspect names from getSetNames<commit_after>"use strict";

define(['js/Utils/GMEConcepts',
    'js/DragDrop/DragHelper',
    'js/NodePropertyNames',
    'js/RegistryKeys',
    './../Crosscut/CrosscutConstants',
    'js/Panels/ControllerBase/DiagramDesignerWidgetMultiTabMemberListControllerBase'], function (
                                               GMEConcepts,
                                               DragHelper,
                                               nodePropertyNames,
                                               REGISTRY_KEYS,
                                               ManualAspectConstants,
                                               DiagramDesignerWidgetMultiTabMemberListControllerBase) {

    var SetEditorController;

    SetEditorController = function (options) {
        options = options || {};
        options.loggerName = "SetEditorController";

        DiagramDesignerWidgetMultiTabMemberListControllerBase.call(this, options);

        this.logger.debug("SetEditorController ctor finished");
    };

    _.extend(SetEditorController.prototype, DiagramDesignerWidgetMultiTabMemberListControllerBase.prototype);

    SetEditorController.prototype.getOrderedMemberListInfo = function (memberListContainerObject) {
        var result = [],
            aspects = this._client.getMetaAspectNames(this._memberListContainerID) || [],
            setNames = memberListContainerObject.getSetNames() || [],
            manualAspectsRegistry = memberListContainerObject.getRegistry(REGISTRY_KEYS.CROSSCUTS) || [],
            manualAspectSetNames = [],
            len;

        //filter out ManualAspects from the list
        _.each(manualAspectsRegistry, function (element/*, index, list*/) {
            manualAspectSetNames.push(element.SetID);
        });

        setNames = _.difference(setNames, manualAspectSetNames, aspects);

        len = setNames.length;
        while (len--) {
            result.push({'memberListID': setNames[len],
                'title': setNames[len],
                'enableDeleteTab': false,
                'enableRenameTab': false});
        }

        result.sort(function (a,b) {
            if (a.title.toLowerCase() < b.title.toLowerCase()) {
                return -1;
            } else {
                return 1;
            }
        });

        return result;
    };


    /**********************************************************/
    /*         HANDLE OBJECT DRAG & DROP ACCEPTANCE           */
    /**********************************************************/
    SetEditorController.prototype._onBackgroundDroppableAccept = function(event, dragInfo) {
        var gmeIDList = DragHelper.getDragItems(dragInfo),
            accept = DiagramDesignerWidgetMultiTabMemberListControllerBase.prototype._onBackgroundDroppableAccept.call(this, event, dragInfo);

        if (accept === true) {
            //if based on the DiagramDesignerWidgetMultiTabMemberListControllerBase check it could be accepted, ie items are not members of the set so far
            //we need to see if we can accept them based on the META rules
            accept = GMEConcepts.canAddToSet(this._memberListContainerID, this._selectedMemberListID, gmeIDList);
        }

        return accept;
    };
    /**********************************************************/
    /*  END OF --- HANDLE OBJECT DRAG & DROP ACCEPTANCE       */
    /**********************************************************/

    /*
     * Overwrite 'no tab' warning message to the user
     */
    SetEditorController.prototype.displayNoTabMessage = function () {
        var msg = 'The currently selected object does not contain any sets.';

        this._widget.setBackgroundText(msg);
    };

    return SetEditorController;
});

{'fraction_non_alphanumeric': 0.14690860215053764, 'fraction_numerical': 0.0005376344086021505, 'mean_word_length': 2.2073275862068966, 'pattern_counts': {'":': 0, '<': 5, '<?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': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5556674', 'n_tokens_mistral': 1800, 'n_tokens_neox': 1739, 'n_words': 349}