/*!
 * SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
 * (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
 */
sap.ui.define(['jquery.sap.global','sap/ui/core/Popup','sap/ui/core/support/Plugin'],function(q,P,a){"use strict";var S=a.extend("sap.ui.core.support.plugins.Selector",{constructor:function(s){a.apply(this,["sapUiSupportSelector","",s]);if(this.isToolPlugin()){throw Error();}this._aEventIds=[this.getId()+"Highlight"];this._oPopup=new P();}});S.prototype.onsapUiSupportSelectorHighlight=function(e){h(e.getParameter("id"),this,e.getParameter("sendInfo"));};S.prototype.init=function(s){a.prototype.init.apply(this,arguments);var p;if(!this._sPopupId){this._sPopupId=this.getId()+"-"+q.sap.uid();var r=sap.ui.getCore().createRenderManager();r.write("<div id='"+this._sPopupId+"' style='border: 2px solid rgb(0, 128, 0); background-color: rgba(0, 128, 0, .55);'></div>");r.flush(sap.ui.getCore().getStaticAreaRef(),false,true);r.destroy();p=q.sap.byId(this._sPopupId);this._oPopup.setContent(p[0]);}else{p=q.sap.byId(this._sPopupId);}var t=this;this._fSelectHandler=function(e){if(!e.shiftKey||!e.altKey||!e.ctrlKey){return;}var i=q(e.target).closest("[data-sap-ui]").attr("id");if(h(i,t,true)){e.stopPropagation();e.preventDefault();}};this._fCloseHandler=function(e){t._oPopup.close(0);};p.bind("click",this._fCloseHandler);q(document).bind("mousedown",this._fSelectHandler);};S.prototype.exit=function(s){this._oPopup.close(0);if(this._fCloseHandler){q.sap.byId(this._sPopupId).unbind("click",this._fCloseHandler);this._fCloseHandler=null;}if(this._fSelectHandler){q(document).unbind("mousedown",this._fSelectHandler);this._fSelectHandler=null;}a.prototype.exit.apply(this,arguments);};function h(i,p,s){if(i){var e=sap.ui.getCore().byId(i);if(e){var j=q.sap.byId(p._sPopupId);var r=e.$();if(r.is(":visible")){j.width(r.outerWidth());j.height(r.outerHeight());p._oPopup.open(0,"BeginTop","BeginTop",r[0],"0 0","none");if(s){sap.ui.core.support.Support.getStub().sendEvent(p.getId()+"Select",g(e,p));}setTimeout(function(){p._oPopup.close(0);},1000);return true;}}}return false;}function g(e,p){return{"id":e.getId()};}return S;},true);
