CKEDITOR.plugins.add( 'shortcodes', {
    icons: 'shortcodes',
    init: function( editor ) {
        editor.addCommand( 'shortcodes', new CKEDITOR.dialogCommand( 'shortcodesDialog' ) );
        editor.ui.addButton( 'Shortcodes', {
            label: 'Insert Shortcodes',
            command: 'shortcodes',
            toolbar: 'insert'
        });
		
		if ( editor.contextMenu ) {
            editor.addMenuGroup( 'shortcodesGroup' );
            editor.addMenuItem( 'shortcodesItem', {
                label: 'Edit Abbreviation',
                icon: this.path + 'icons/shortcodes.png',
                command: 'shortcodes',
                group: 'shortcodesGroup'
            });

            editor.contextMenu.addListener( function( element ) {
                if ( element.getAscendant( 'shortcodes', true ) ) {
                    return { shortcodesItem: CKEDITOR.TRISTATE_OFF };
                }
            });
        }

        CKEDITOR.dialog.add( 'shortcodesDialog', this.path + 'dialogs/shortcodes.js' );
    }
});