/*******************************************************************************
 * @license
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 * 
 * Contributors: IBM Corporation - initial API and implementation
 ******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2011, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*******************************************************************************
 * @license
 * Copyright (c) 2013 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials are made 
 * available under the terms of the Eclipse Public License v1.0 
 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

/*

 Copyright (c) 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors: IBM Corporation - initial API and implementation

 Copyright (c) 2011, 2012 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation

 Copyright (c) 2013 IBM Corporation and others.
 All rights reserved. This program and the accompanying materials are made 
 available under the terms of the Eclipse Public License v1.0 
 (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 
 License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 

 Contributors:
 IBM Corporation - initial API and implementation
*/
(function(c,d){typeof define==="function"&&define.amd?define("orion/Deferred",d):typeof exports==="object"?module.exports=d():(c.orion=c.orion||{},c.orion.Deferred=d())})(this,function(){function c(){for(var e;e=j.shift();)e();r=!1}function d(e){j.push(e);r||(r=!0,setTimeout(c,0))}function s(e){return function(){e.apply(void 0,arguments)}}function m(){function e(){for(var a;a=g.shift();){var b=a.deferred,c=h==="fulfilled"?"resolve":"reject";if(typeof a[c]==="function")try{var e=(0,a[c])(i),k=e&&(typeof e===
"object"||typeof e==="function")&&e.then;if(typeof k==="function")if(e===b.promise)b.reject(new TypeError);else{var d=e.cancel;typeof d==="function"?b._protected(j).parentCancel=d.bind(e):delete b._protected(j).parentCancel;k.call(e,s(b.resolve),s(b.reject),s(b.progress))}else b.resolve(e)}catch(m){b.reject(m)}else b[c](i)}}function c(a){delete k.parentCancel;h="rejected";i=a;g.length&&d(e)}function q(a){function t(f){return function(a){p||(p=!0,f(a))}}var p=!1;delete k.parentCancel;try{var l=a&&
(typeof a==="object"||typeof a==="function")&&a.then;if(typeof l==="function")if(a===b)c(new TypeError);else{h="assumed";var j=a&&a.cancel;if(typeof j!=="function"){var n=new m,a=n.promise;try{l(n.resolve,n.reject,n.progress)}catch(o){n.reject(o)}j=a.cancel;l=a.then}i=a;l.call(a,t(q),t(c));k.parentCancel=j.bind(a)}else h="fulfilled",i=a,g.length&&d(e)}catch(f){t(c)(f)}}function l(){var a=k.parentCancel;if(a)delete k.parentCancel,a();else if(!h)a=Error("Cancel"),a.name="Cancel",c(a)}var i,h,g=[],b=
this,k={};Object.defineProperty(this,"_protected",{value:function(a){if(a!==j)throw Error("protected");return k}});this.resolve=function(a){h||q(a);return b};this.reject=function(a){h||c(a);return b};this.progress=function(a){h||g.forEach(function(b){if(b.progress)try{b.progress(a)}catch(e){}});return b.promise};this.cancel=function(){k.parentCancel?setTimeout(l,0):l();return b};this.then=function(a,c,k){a={resolve:a,reject:c,progress:k,deferred:new m};g.push(a);a.deferred._protected(j).parentCancel=
b.promise.cancel.bind(b);(h==="fulfilled"||h==="rejected")&&d(e);return a.deferred.promise};this.promise={then:b.then,cancel:b.cancel}}var j=[],r=!1;m.all=function(e,c){function d(c,a){g||(h[c]=a,--i===0&&b.resolve(h))}function l(e,a){if(!g){if(c)try{d(e,c(a));return}catch(h){a=h}b.reject(a)}}var i=e.length,h=[],g=!1,b=new m;b.then(void 0,function(){g=!0;e.forEach(function(b){b.cancel&&b.cancel()})});i===0?b.resolve(h):e.forEach(function(b,a){b.then(d.bind(void 0,a),l.bind(void 0,a))});return b.promise};
m.when=function(c,d,j,l){var i;if(!(c&&typeof c.then==="function"))i=new m,i.resolve(c),c=i.promise;return c.then(d,j,l)};return m});
(function(c,d){typeof define==="function"&&define.amd?define("orion/plugin",["orion/Deferred"],d):typeof exports==="object"?module.exports=d(require("orion/Deferred")):(c.orion=c.orion||{},c.orion.PluginProvider=d(c.orion.Deferred))})(this,function(c){function d(c,d){this.__objectId=c;this.__methods=d}return function(s){function m(f){b&&(typeof ArrayBuffer==="undefined"&&(f=JSON.stringify(f)),b===self?b.postMessage(f):b.postMessage(f,"*"))}function j(){var f=[];Object.keys(n).forEach(function(a){var b=
n[a];f.push({serviceId:a,names:b.names,methods:b.methods,properties:b.properties})});return{headers:h||{},services:f}}function r(f,a){if(a&&a instanceof XMLHttpRequest){var b,c;try{b=a.status,c=a.statusText}catch(e){b=0,c=""}return{status:b||0,statusText:c}}return a}function e(f){var a=f?JSON.parse(JSON.stringify(f,r)):f;if(f instanceof Error)a.__isError=!0,a.message=a.message||f.message,a.name=a.name||f.name;return a}function x(f){if(!b)return(new c).reject(Error("plugin not connected"));f.id=String(k++);
var e=new c;u[f.id]=e;e.then(null,function(a){g&&a instanceof Error&&a.name==="Cancel"&&o({requestId:f.id,method:"cancel",params:a.message?[a.message]:[]})});var h=Object.prototype.toString;f.params.forEach(function(b,c){if(h.call(b)==="[object Object]"&&!(b instanceof d)){var g,i;for(g in b)h.call(b[g])==="[object Function]"&&(i=i||[],i.push(g));if(i){var w=a++;v[w]=b;g=function(){delete v[w]};e.then(g,g);f.params[c]=new d(w,i)}}});o(f);return e.promise}function q(f,a){f||f===0?o({id:f,result:null,
error:a}):console.log(a)}function l(f,a,b,c){c.forEach(function(a,f){if(a&&typeof a.__objectId!=="undefined"){var b={};a.__methods.forEach(function(f){b[f]=function(){return x({objectId:a.__objectId,method:f,params:Array.prototype.slice.call(arguments)})}});c[f]=b}});var d=typeof f===void 0?null:{id:f,result:null,error:null};try{var g=b.apply(a,c);if(d)g&&typeof g.then==="function"?(p[f]=g,g.then(function(a){delete p[f];d.result=a;o(d)},function(a){if(p[f])delete p[f],d.error=e(a),o(d)},function(){o({responseId:f,
method:"progress",params:Array.prototype.slice.call(arguments)})})):(d.result=g,o(d))}catch(h){if(d)d.error=e(h),o(d)}}function i(a){if(a.source===b){a=typeof a.data!=="string"?a.data:JSON.parse(a.data);try{if(a.method){var c=a.method,e=a.params||[];if("serviceId"in a){var d=n[a.serviceId];d||q(a.id,"service not found");d=d.implementation;c in d?l(a.id,d,d[c],e):q(a.id,"method not found")}else if("objectId"in a){var g=v[a.objectId];g||q(a.id,"object not found");!c in g?l(a.id,g,g[c],e):q(a.id,"method not found")}else if("requestId"in
a){var h=p[a.requestId];h&&c==="cancel"&&h.cancel&&h.cancel.apply(h,e)}else if("responseId"in a){var i=u[a.responseId];i&&c==="progress"&&i.progress&&i.progress.apply(i,e)}else throw Error("Bad method: "+a.method);}else{var j=u[String(a.id)];delete u[String(a.id)];a.error?j.reject(a.error):j.resolve(a.result)}}catch(k){console.log("Plugin._messageHandler "+k)}}}var h=s,g=!1,b=null,k=0,a=0,t=0,p={},u={},v={},n={},o=m;this.updateHeaders=function(a){if(g)throw Error("Cannot update headers. Plugin Provider is connected");
h=a};this.registerServiceProvider=this.registerService=function(a,b,c){if(g)throw Error("Cannot register service. Plugin Provider is connected");typeof a==="string"?a=[a]:Array.isArray(a)||(a=[]);var d=null,e=[];for(d in b)typeof b[d]==="function"&&e.push(d);n[t++]={names:a,methods:e,implementation:b,properties:c||{},listeners:{}}};this.connect=function(a,c){if(!g){if(typeof window==="undefined")b=self;else if(window!==window.parent)b=window.parent;else if(window.opener!==null)b=window.opener;else{c&&
c("No valid plugin target");return}addEventListener("message",i,!1);var d={method:"plugin",params:[j()]};m(d);g=!0}a&&a()};this.disconnect=function(){g&&(removeEventListener("message",i),b=null,g=!1)}}});
define('built-shellPagePlugin.js',["orion/plugin"],function(c){c=new c({name:"Orion Shell Page Service",version:"1.0",description:"This plugin integrates access to Orion's Shell page into other Orion pages."});c.registerService("orion.navigate.command",{},{nameKey:"Shell",id:"eclipse.shell.open",tooltipKey:"Open Shell page",nls:"orion/shell/nls/messages",validationProperties:[{source:"ChildrenLocation|ContentLocation",variableName:"ShellLocation",replacements:[{pattern:"\\?depth=1$",replacement:""}]}],
uriTemplate:"{+OrionHome}/shell/shellPage.html#{,ShellLocation}",forceSingleItem:!0});c.registerService("orion.page.link.related",null,{id:"eclipse.shell.open",category:"shell",order:10});c.connect()});