Adding "orion" as a javascript namespace
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Bundle.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Bundle.js
index 4d960d4..a677312 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Bundle.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Bundle.js
@@ -1,4 +1,5 @@
-function Bundle(framework, bundleData) {
+var orion = orion || {};
+orion.Bundle = function(framework, bundleData) {
this._framework = framework;
this._bundleData = bundleData;
this._name = null;
@@ -9,28 +10,28 @@
this._resources = {};
this._singleton = false;
this._markedStarted = false;
- this._state = Bundle.INSTALLED;
+ this._state = orion.Bundle.INSTALLED;
this._scope = {};
this._bundleContext = null;
this._activator = null;
var headers = bundleData.getHeaders();
- this._parseName(headers[Constants.BUNDLE_NAME]);
- this._parseVersion(headers[Constants.BUNDLE_VERSION]);
- this._parseImports(headers[Constants.BUNDLE_IMPORTS]);
- this._parseExports(headers[Constants.BUNDLE_EXPORTS]);
- this._parseRequires(headers[Constants.BUNDLE_REQUIRES]);
- this._parseResources(headers[Constants.BUNDLE_RESOURCES]);
-}
+ this._parseName(headers[orion.Constants.BUNDLE_NAME]);
+ this._parseVersion(headers[orion.Constants.BUNDLE_VERSION]);
+ this._parseImports(headers[orion.Constants.BUNDLE_IMPORTS]);
+ this._parseExports(headers[orion.Constants.BUNDLE_EXPORTS]);
+ this._parseRequires(headers[orion.Constants.BUNDLE_REQUIRES]);
+ this._parseResources(headers[orion.Constants.BUNDLE_RESOURCES]);
+};
-Bundle.UNINSTALLED = 1;
-Bundle.INSTALLED = 2;
-Bundle.RESOLVED = 4;
-Bundle.STARTING = 8;
-Bundle.STOPPING = 16;
-Bundle.ACTIVE = 32;
+orion.Bundle.UNINSTALLED = 1;
+orion.Bundle.INSTALLED = 2;
+orion.Bundle.RESOLVED = 4;
+orion.Bundle.STARTING = 8;
+orion.Bundle.STOPPING = 16;
+orion.Bundle.ACTIVE = 32;
-Bundle.prototype = {
+orion.Bundle.prototype = {
getName : function() {
return this._name;
},
@@ -102,7 +103,7 @@
if (this === other)
return true;
- if (!other instanceof Bundle)
+ if (!other instanceof orion.Bundle)
return false;
if (this._name !== other._name)
@@ -115,31 +116,31 @@
return true;
},
uninstall : function() {
- this._state = Bundle.UNINSTALLED;
+ this._state = orion.Bundle.UNINSTALLED;
},
start : function() {
this._markedStarted = true;
- if (this._state !== Bundle.RESOLVED)
+ if (this._state !== orion.Bundle.RESOLVED)
return;
- this._state = Bundle.STARTING;
+ this._state = orion.Bundle.STARTING;
this._bundleContext = this._framework._getBundleContext(this);
this._activator = this._createActivatorInstance();
if (this._activator) {
this._activator.start(this._bundleContext);
}
- this._state = Bundle.ACTIVE;
+ this._state = orion.Bundle.ACTIVE;
},
stop : function() {
markedStarted = false;
- if (this._state !== Bundle.ACTIVE)
+ if (this._state !== orion.Bundle.ACTIVE)
return;
- this._state = Bundle.STOPPING;
+ this._state = orion.Bundle.STOPPING;
if (this._activator) {
this._activator.stop(this._bundleContext);
}
- this._state = Bundle.RESOLVED;
+ this._state = orion.Bundle.RESOLVED;
},
load : function(name) {
var value = this._scope;
@@ -171,7 +172,7 @@
return this._requires;
},
_createActivatorInstance : function() {
- var activatorName = this.getHeaders()[Constants.BUNDLE_ACTIVATOR];
+ var activatorName = this.getHeaders()[orion.Constants.BUNDLE_ACTIVATOR];
if (activatorName === null || activatorName === undefined)
return null;
@@ -181,7 +182,7 @@
return new activatorFunction();
},
_resolve : function() {
- if (this._state != Bundle.INSTALLED)
+ if (this._state != orion.Bundle.INSTALLED)
return;
var namedExports = {};
@@ -237,7 +238,7 @@
}
this._evalScript(importScope);
- this._state = Bundle.RESOLVED;
+ this._state = orion.Bundle.RESOLVED;
},
_evalScript : function(importScope) {
var parameterNames = [];
@@ -267,7 +268,7 @@
}
var parameterStatement = parameterNames.join(",");
- var script = this._bundleData.getHeaders()[Constants.BUNDLE_SCRIPT] || "";
+ var script = this._bundleData.getHeaders()[orion.Constants.BUNDLE_SCRIPT] || "";
var returnStatement = "\n\nreturn {" + exportNames.join(",") + "};";
var that = this;
@@ -282,29 +283,29 @@
this._scope = load.apply(loader, parameterValues);
},
_unresolve : function() {
- if (this._state == Bundle.ACTIVE) {
+ if (this._state == orion.Bundle.ACTIVE) {
this.stop();
markedStarted = true;
}
this._scope = null;
- if (this._state == Bundle.RESOLVED)
- this._state = Bundle.INSTALLED;
+ if (this._state == orion.Bundle.RESOLVED)
+ this._state = orion.Bundle.INSTALLED;
},
_parseName : function(header) {
- var tokens = header.split(Constants.PARAMETER_DELIMITER);
+ var tokens = header.split(orion.Constants.PARAMETER_DELIMITER);
this._name = tokens[0].replace(/^\s+|\s+$/g, '');
for ( var i = 1; i < tokens.length; i++) {
var token = tokens[i];
- if (token.indexOf(Constants.DIRECTIVE_EQUALS) != -1) {
- var index = token.indexOf(Constants.DIRECTIVE_EQUALS);
+ if (token.indexOf(orion.Constants.DIRECTIVE_EQUALS) != -1) {
+ var index = token.indexOf(orion.Constants.DIRECTIVE_EQUALS);
var directiveName = token.substring(0, index).replace(/^\s+|\s+$/g, '');
if (directiveName.length === 0)
throw "bad syntax: " + token + " in " + header;
- if (directiveName !== Constants.SINGLETON_DIRECTIVE)
+ if (directiveName !== orion.Constants.SINGLETON_DIRECTIVE)
continue;
- var value = token.substring(index + Constants.DIRECTIVE_EQUALS.length).replace(/^\s+|\s+$/g, '');
+ var value = token.substring(index + orion.Constants.DIRECTIVE_EQUALS.length).replace(/^\s+|\s+$/g, '');
if (value.toLowerCase() === "true")
this._singleton = true;
} else
@@ -312,13 +313,13 @@
}
},
_parseVersion : function(header) {
- this._version = Version.parseVersion(header);
+ this._version = orion.Version.parseVersion(header);
},
_parseResources : function(header) {
if (!header)
return;
- var tokens = header.split(Constants.CLAUSE_DELIMITER);
+ var tokens = header.split(orion.Constants.CLAUSE_DELIMITER);
for ( var i = 0; i < tokens.length; i++) {
if (tokens[i]) {
var path = tokens[i].replace(/^\s+|\s+$/g, '');
@@ -330,10 +331,10 @@
if (!header)
return;
- var tokens = header.split(Constants.CLAUSE_DELIMITER);
+ var tokens = header.split(orion.Constants.CLAUSE_DELIMITER);
for ( var i = 0; i < tokens.length; i++) {
var token = tokens[i];
- var jsRequire = new _Require(token);
+ var jsRequire = new orion._Require(token);
if (jsRequire !== null)
this._requires.push(jsRequire);
}
@@ -341,10 +342,10 @@
_parseExports : function(header) {
if (!header)
return;
- var tokens = header.split(Constants.CLAUSE_DELIMITER);
+ var tokens = header.split(orion.Constants.CLAUSE_DELIMITER);
for ( var i = 0; i < tokens.length; i++) {
var token = tokens[i];
- var jsExport = new _Export(token, this);
+ var jsExport = new orion._Export(token, this);
if (jsExport !== null)
this._exports.push(jsExport);
}
@@ -353,10 +354,10 @@
if (!header)
return;
- var tokens = header.split(Constants.CLAUSE_DELIMITER);
+ var tokens = header.split(orion.Constants.CLAUSE_DELIMITER);
for ( var i = 0; i < tokens.length; i++) {
var token = tokens[i];
- var jsImport = new _Import(token);
+ var jsImport = new orion._Import(token);
if (jsImport !== null)
this._imports.push(jsImport);
}
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/BundleContext.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/BundleContext.js
index 2685312..1b93f53 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/BundleContext.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/BundleContext.js
@@ -1,9 +1,10 @@
-function BundleContext(bundle, framework) {
+var orion = orion || {};
+orion.BundleContext = function(bundle, framework) {
this._bundle = bundle;
this._framework = framework;
-}
+};
-BundleContext.prototype = {
+orion.BundleContext.prototype = {
getBundle : function() {
return this._bundle;
},
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/BundleData.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/BundleData.js
index 21f57ce..1694efe 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/BundleData.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/BundleData.js
@@ -1,10 +1,11 @@
-function BundleData(bundleId, location, headers) {
+var orion = orion || {};
+orion.BundleData = function(bundleId, location, headers) {
this._bundleId = bundleId;
this._location = location;
this._headers = headers;
-}
+};
-BundleData.prototype = {
+orion.BundleData.prototype = {
getBundleId : function() {
return this._bundleId;
},
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Constants.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Constants.js
index 89f5f08..da558cd 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Constants.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Constants.js
@@ -1,4 +1,5 @@
-var Constants = {
+var orion = orion || {};
+orion.Constants = {
ATTRIBUTE_EQUALS : "=",
DIRECTIVE_EQUALS : ":=",
PARAMETER_DELIMITER : ";",
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Framework.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Framework.js
index d56f4fc..1f9229d 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Framework.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Framework.js
@@ -1,13 +1,14 @@
-function Framework() {
+var orion = orion || {};
+orion.Framework = function () {
this._installOrderBundles = [];
this._resolveOrderBundles = [];
this._exports = {};
this._requiredBundles = {};
this._properties = {};
this._currentBundleId = 0;
-}
+};
-Framework.prototype = {
+orion.Framework.prototype = {
getBundles : function() {
return this._installOrderBundles.slice();
},
@@ -24,8 +25,8 @@
if (location === null)
throw "location cannot be null";
- var bundleData = new BundleData(this._currentBundleId, location, headers);
- var bundle = new Bundle(this, bundleData);
+ var bundleData = new orion.BundleData(this._currentBundleId, location, headers);
+ var bundle = new orion.Bundle(this, bundleData);
for ( var i = 0; i < this._installOrderBundles.length; i++) {
if (bundle.equals(this._installOrderBundles[i]))
@@ -45,7 +46,7 @@
var newInstallOrderBundles = [];
for (i = 0; i < this._installOrderBundles.length; i++) {
bundle = this._installOrderBundles[i];
- if (bundle.getState() !== Bundle.UNINSTALLED) {
+ if (bundle.getState() !== orion.Bundle.UNINSTALLED) {
newInstallOrderBundles.push(bundle);
}
}
@@ -53,7 +54,7 @@
for (i = 0; i < resolvedBundles.length; i++) {
bundle = resolvedBundles[i];
- if (bundle.getState() === Bundle.UNINSTALLED) {
+ if (bundle.getState() === orion.Bundle.UNINSTALLED) {
uninstalledBundleFound = true;
}
@@ -65,7 +66,7 @@
var newResolveOrderBundles = [];
for (i = 0; i < this._resolveOrderBundles.length; i++) {
bundle = this._resolveOrderBundles[i];
- if (bundle.getState() === Bundle.RESOLVED || bundle.getState() === Bundle.ACTIVE) {
+ if (bundle.getState() === orion.Bundle.RESOLVED || bundle.getState() === orion.Bundle.ACTIVE) {
newResolveOrderBundles.push(bundle);
}
}
@@ -79,7 +80,7 @@
var i = 0;
for (i = 0; i < this._installOrderBundles.length; i++) {
var bundle = this._installOrderBundles[i];
- if (bundle.getState() === Bundle.INSTALLED)
+ if (bundle.getState() === orion.Bundle.INSTALLED)
unresolvedBundles.push(bundle);
}
@@ -108,7 +109,7 @@
this.refresh();
},
_getBundleContext : function(bundle) {
- return new BundleContext(bundle, this);
+ return new orion.BundleContext(bundle, this);
},
_stepResolver : function(unresolvedBundles) {
for (var i = 0; i < unresolvedBundles.length; i++) {
@@ -188,7 +189,7 @@
this._exports[name] = namedExports;
}
namedExports.push(jsExport);
- namedExports.sort(Framework._exportsComparator);
+ namedExports.sort(orion.Framework._exportsComparator);
}
},
_addRequiredBundle : function(bundle) {
@@ -199,7 +200,7 @@
this._requiredBundles[name]= namedBundles;
}
namedBundles.push(bundle);
- namedBundles.sort(Framework._requireBundlesComparator);
+ namedBundles.sort(orion.Framework._requireBundlesComparator);
},
_unresolveBundle : function(bundle) {
this._removeExports(bundle);
@@ -261,7 +262,7 @@
}
};
-Framework._exportsComparator = function(export0, export1) {
+orion.Framework._exportsComparator = function(export0, export1) {
// order switched for descending order
var result = export1.getVersion().compareTo(export0.getVersion());
if (result == 0)
@@ -270,7 +271,7 @@
return result;
};
-Framework._requireBundlesComparator = function(bundle0, bundle1) {
+orion.Framework._requireBundlesComparator = function(bundle0, bundle1) {
// order switched for descending order
var result = bundle1.getVersion().compareTo(bundle0.getVersion());
if (result == 0)
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Version.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Version.js
index 9909e66..07f461e 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Version.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Version.js
@@ -1,11 +1,12 @@
-function Version(major, minor, micro, qualifier) {
- if (!Version._isInteger(major) || major < 0)
+var orion = orion || {};
+orion.Version = function (major, minor, micro, qualifier) {
+ if (!orion.Version._isInteger(major) || major < 0)
throw "invalid major:" + major;
- if (!Version._isInteger(minor) || minor < 0)
+ if (!orion.Version._isInteger(minor) || minor < 0)
throw "invalid minor:" + minor;
- if (!Version._isInteger(micro) || micro < 0)
+ if (!orion.Version._isInteger(micro) || micro < 0)
throw "invalid micro:" + micro;
if (qualifier === null || qualifier === undefined)
@@ -13,17 +14,17 @@
else if (typeof qualifier !== "string" || !qualifier.match(/[\w\-]*/))
throw "invalid qualifier: " + qualifier;
- this._major = (major > Version.MAX_VALUE) ? Version.MAX_VALUE : major;
- this._minor = (minor > Version.MAX_VALUE) ? Version.MAX_VALUE : minor;
- this._micro = (micro > Version.MAX_VALUE) ? Version.MAX_VALUE : micro;
+ this._major = (major > orion.Version.MAX_VALUE) ? orion.Version.MAX_VALUE : major;
+ this._minor = (minor > orion.Version.MAX_VALUE) ? orion.Version.MAX_VALUE : minor;
+ this._micro = (micro > orion.Version.MAX_VALUE) ? orion.Version.MAX_VALUE : micro;
- if (this._major == Version.MAX_VALUE && this._minor == Version.MAX_VALUE && this._micro == Version.MAX_VALUE)
+ if (this._major == orion.Version.MAX_VALUE && this._minor == orion.Version.MAX_VALUE && this._micro == orion.Version.MAX_VALUE)
this._qualifier = "";
else
this._qualifier = qualifier;
};
-Version.prototype = {
+orion.Version.prototype = {
getMajor : function() {
return this._major;
},
@@ -43,7 +44,7 @@
return result;
},
equals : function(other) {
- return other instanceof Version && this._major === other._major && this._minor === other._minor && this._micro === other._micro && this._qualifier === other._qualifier;
+ return other instanceof orion.Version && this._major === other._major && this._minor === other._minor && this._micro === other._micro && this._qualifier === other._qualifier;
},
compareTo : function(other) {
if (this === other)
@@ -67,22 +68,22 @@
return this._qualifier > other._qualifier ? 1 : -1;
}
};
-Version._isInteger = function(number) {
+orion.Version._isInteger = function(number) {
return (typeof number == "number" && !isNaN(number) && isFinite(number) && Math.floor(number) == number);
};
-Version.MAX_VALUE = Math.pow(2, 32);
-Version.EMPTY_VERSION = new Version(0, 0, 0);
-Version.MAX_VERSION = new Version(Version.MAX_VALUE, Version.MAX_VALUE, Version.MAX_VALUE);
-Version.parseVersion = function(text) {
+orion.Version.MAX_VALUE = Math.pow(2, 32);
+orion.Version.EMPTY_VERSION = new orion.Version(0, 0, 0);
+orion.Version.MAX_VERSION = new orion.Version(orion.Version.MAX_VALUE, orion.Version.MAX_VALUE, orion.Version.MAX_VALUE);
+orion.Version.parseVersion = function(text) {
if (text === null || text === undefined)
- return Version.EMPTY_VERSION;
+ return orion.Version.EMPTY_VERSION;
if (typeof text !== "string")
throw "invalid text:" + text;
text = text.replace(/^\s+|\s+$/g, '');
if (text.length === 0 || text === "0.0.0")
- return Version.EMPTY_VERSION;
+ return orion.Version.EMPTY_VERSION;
var tokens = text.split(".");
if (tokens.length > 4)
@@ -110,5 +111,5 @@
qualifier = tokens[3];
}
}
- return new Version(major, minor, micro, qualifier);
+ return new orion.Version(major, minor, micro, qualifier);
};
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/VersionRange.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/VersionRange.js
index b67c0d6..202e437 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/VersionRange.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/VersionRange.js
@@ -1,23 +1,24 @@
-function VersionRange(minVersion, includeMin, maxVersion, includeMax) {
- if (minVersion != null && !(minVersion instanceof Version))
+var orion = orion || {};
+orion.VersionRange = function(minVersion, includeMin, maxVersion, includeMax) {
+ if (minVersion != null && !(minVersion instanceof orion.Version))
throw "invalid minVersion:" + minVersion;
if (typeof includeMin !== "boolean")
throw "invalid includeMin:" + includeMin;
- if (maxVersion != null && !(maxVersion instanceof Version))
+ if (maxVersion != null && !(maxVersion instanceof orion.Version))
throw "invalid maxVersion:" + minVersion;
if (typeof includeMax !== "boolean")
throw "invalid includeMax:" + includeMax;
- this._minVersion = minVersion || Version.EMPTY_VERSION;
+ this._minVersion = minVersion || orion.Version.EMPTY_VERSION;
this._includeMin = includeMin;
- this._maxVersion = maxVersion || Version.MAX_VERSION;
+ this._maxVersion = maxVersion || orion.Version.MAX_VERSION;
this._includeMax = includeMax;
-}
+};
-VersionRange.prototype = {
+orion.VersionRange.prototype = {
getMinimum : function() {
return this._minVersion;
},
@@ -34,7 +35,7 @@
if (this === other)
return true;
- if (!other instanceof VersionRange)
+ if (!other instanceof orion.VersionRange)
return false;
if (this._includeMin !== other._includeMin || this._includeMax !== other._includeMax)
@@ -50,9 +51,9 @@
},
isIncluded : function(version) {
if (version == null)
- version = Version.MIN_VERSION;
+ version = orion.Version.MIN_VERSION;
- if (!version instanceof Version)
+ if (!version instanceof orion.Version)
return false;
var minCheck = this._includeMin ? 0 : 1;
@@ -60,25 +61,25 @@
return version.compareTo(this._minVersion) >= minCheck && version.compareTo(this._maxVersion) <= maxCheck;
},
toString : function() {
- if (this._includeMin && this._includeMax && Version.MAX_VERSION.equals(this._maxVersion))
+ if (this._includeMin && this._includeMax && orion.Version.MAX_VERSION.equals(this._maxVersion))
return this._minVersion.toString();
return (this._includeMin ? '[' : '(') + this._minVersion + ',' + this._maxVersion + (this._includeMax ? ']' : ')');
}
};
-VersionRange.EMPTY_RANGE = new VersionRange(Version.EMPTY_VERSION, true, Version.MAX_VERSION, true);
+orion.VersionRange.EMPTY_RANGE = new orion.VersionRange(orion.Version.EMPTY_VERSION, true, orion.Version.MAX_VERSION, true);
-VersionRange.parseVersionRange = function(text) {
+orion.VersionRange.parseVersionRange = function(text) {
if (text === null)
- return VersionRange.EMPTY_RANGE;
+ return orion.VersionRange.EMPTY_RANGE;
if (typeof text !== "string")
throw "invalid text:" + text;
text = text.replace(/^\s+|\s+$/g, '');
if (text.length === 0)
- return VersionRange.EMPTY_RANGE;
+ return orion.VersionRange.EMPTY_RANGE;
var minVersion = null;
var includeMin = false;
@@ -93,15 +94,15 @@
if (last !== ']' && last !== ')')
throw "invalid text:" + text;
- minVersion = Version.parseVersion(text.substring(1, comma).replace(/^\s+|\s+$/g, ''));
+ minVersion = orion.Version.parseVersion(text.substring(1, comma).replace(/^\s+|\s+$/g, ''));
includeMin = text.charAt(0) == '[';
- maxVersion = Version.parseVersion(text.substring(comma + 1, text.length() - 1).replace(/^\s+|\s+$/g, ''));
+ maxVersion = orion.Version.parseVersion(text.substring(comma + 1, text.length() - 1).replace(/^\s+|\s+$/g, ''));
includeMax = last == ']';
} else {
- minVersion = Version.parseVersion(text);
+ minVersion = orion.Version.parseVersion(text);
includeMin = true;
- maxVersion = Version.MAX_VERSION;
+ maxVersion = orion.Version.MAX_VERSION;
includeMax = true;
}
- return new VersionRange(minVersion, includeMin, maxVersion, includeMax);
+ return new orion.VersionRange(minVersion, includeMin, maxVersion, includeMax);
};
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Export.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Export.js
index 0cb404b..b303c72 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Export.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Export.js
@@ -1,4 +1,5 @@
-function _Export(header, exportingBundle) {
+var orion = orion || {};
+orion._Export = function(header, exportingBundle) {
if (header === null)
throw "header cannot be null";
@@ -6,56 +7,56 @@
throw "exportingBundle cannot be null";
this._name = null;
- this._version = Version.EMPTY_VERSION;
+ this._version = orion.Version.EMPTY_VERSION;
this._attributes = {};
this._directives = {};
this._mandatory = [];
this._exportingBundle = exportingBundle;
this._parseExport(header);
-}
+};
-_Export.prototype = {
+orion._Export.prototype = {
_parseExport : function(header) {
- var tokens = header.split(Constants.PARAMETER_DELIMITER);
+ var tokens = header.split(orion.Constants.PARAMETER_DELIMITER);
this._name = tokens[0].replace(/^\s+|\s+$/g, '');
for ( var i = 1; i < tokens.length; i++) {
var token = tokens[i];
- if (token.indexOf(Constants.DIRECTIVE_EQUALS) !== -1)
+ if (token.indexOf(orion.Constants.DIRECTIVE_EQUALS) !== -1)
this._parseDirective(token);
- else if (token.indexOf(Constants.ATTRIBUTE_EQUALS) !== -1)
+ else if (token.indexOf(orion.Constants.ATTRIBUTE_EQUALS) !== -1)
this._parseAttribute(token);
else
throw "bad export syntax: " + token + " in " + header;
}
},
_parseAttribute : function(token) {
- var index = token.indexOf(Constants.ATTRIBUTE_EQUALS);
+ var index = token.indexOf(orion.Constants.ATTRIBUTE_EQUALS);
var attributeName = token.substring(0, index).replace(/^\s+|\s+$/g, '');
if (attributeName.length === 0)
return;
- var value = token.substring(index + Constants.ATTRIBUTE_EQUALS.length).replace(/^\s+|\s+$/g, '');
+ var value = token.substring(index + orion.Constants.ATTRIBUTE_EQUALS.length).replace(/^\s+|\s+$/g, '');
- if (attributeName === Constants.VERSION_ATTRIBUTE)
- this._version = Version.parseVersion(value);
+ if (attributeName === orion.Constants.VERSION_ATTRIBUTE)
+ this._version = orion.Version.parseVersion(value);
this._attributes[attributeName] = value;
},
_parseDirective : function(token) {
- var index = token.indexOf(Constants.DIRECTIVE_EQUALS);
+ var index = token.indexOf(orion.Constants.DIRECTIVE_EQUALS);
var directiveName = token.substring(0, index).replace(/^\s+|\s+$/g, '');
if (directiveName.length === 0)
return;
- var value = token.substring(index + Constants.DIRECTIVE_EQUALS.length).replace(/^\s+|\s+$/g, '');
- if (directiveName === Constants.MANDATORY_DIRECTIVE)
+ var value = token.substring(index + orion.Constants.DIRECTIVE_EQUALS.length).replace(/^\s+|\s+$/g, '');
+ if (directiveName === orion.Constants.MANDATORY_DIRECTIVE)
this._parseMandatory(value);
this._directives[directiveName] = value;
},
_parseMandatory : function(value) {
- var tokens = value.split(Constants.MANDATORY_DELIMITER);
+ var tokens = value.split(orion.Constants.MANDATORY_DELIMITER);
for ( var i = 0; i < tokens.length; i++) {
var token = tokens[i].replace(/^\s+|\s+$/g, '');
if (token.length > 0)
@@ -92,7 +93,7 @@
addToScope : function (scope) {
var value = this._exportingBundle.load(this._name);
var tokens = this._name.split(".");
- var Wrapper = function() {};
+ var _Wrapper = function() {};
var i = 0;
while (true) {
var token = tokens[i++];
@@ -103,8 +104,8 @@
if (i === tokens.length) {
if (current === null || current === undefined) {
if (typeof value === "object") {
- Wrapper.prototype = value;
- value = new Wrapper();
+ _Wrapper.prototype = value;
+ value = new _Wrapper();
}
scope[token]= value;
return;
@@ -116,8 +117,8 @@
if (current === null || current === undefined) {
current = {};
} else if (typeof current === "object") {
- Wrapper.prototype = current;
- current = new Wrapper();
+ _Wrapper.prototype = current;
+ current = new _Wrapper();
} else
throw "Resolve error: " + this._name + "-" + token + " already exists for " + this.toString(); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
scope[token] = current;
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Import.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Import.js
index 78dbc25..dc435f1 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Import.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Import.js
@@ -1,57 +1,58 @@
-function _Import(header) {
+var orion = orion || {};
+orion._Import = function(header) {
if (header === null)
throw "header cannot be null";
this._name = null;
- this._versionRange = VersionRange.EMPTY_RANGE;
+ this._versionRange = orion.VersionRange.EMPTY_RANGE;
this._bundleSymbolicName = null;
- this._bundleVersionRange = VersionRange.EMPTY_RANGE;
+ this._bundleVersionRange = orion.VersionRange.EMPTY_RANGE;
this._optional = false;
this._attributes = {};
this._directives = {};
this._wiredExport = null;
this._parseImport(header);
-}
+};
-_Import.prototype = {
+orion._Import.prototype = {
_parseImport : function(header) {
- var tokens = header.split(Constants.PARAMETER_DELIMITER);
+ var tokens = header.split(orion.Constants.PARAMETER_DELIMITER);
this._name = tokens[0].replace(/^\s+|\s+$/g, '');
for ( var i = 1; i < tokens.length; i++) {
var token = tokens[i];
- if (token.indexOf(Constants.DIRECTIVE_EQUALS) !== -1)
+ if (token.indexOf(orion.Constants.DIRECTIVE_EQUALS) !== -1)
this._parseDirective(token);
- else if (token.indexOf(Constants.ATTRIBUTE_EQUALS) !== -1)
+ else if (token.indexOf(orion.Constants.ATTRIBUTE_EQUALS) !== -1)
this._parseAttribute(token);
else
throw "bad import syntax: " + token + " in " + header;
}
},
_parseAttribute : function(token) {
- var index = token.indexOf(Constants.ATTRIBUTE_EQUALS);
+ var index = token.indexOf(orion.Constants.ATTRIBUTE_EQUALS);
var attributeName = token.substring(0, index).replace(/^\s+|\s+$/g, '');
if (attributeName.length === 0)
return;
- var value = token.substring(index + Constants.ATTRIBUTE_EQUALS.length).replace(/^\s+|\s+$/g, '');
+ var value = token.substring(index + orion.Constants.ATTRIBUTE_EQUALS.length).replace(/^\s+|\s+$/g, '');
- if (attributeName === Constants.VERSION_ATTRIBUTE)
- this._versionRange = VersionRange.parseVersionRange(value);
- else if (attributeName === Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE)
+ if (attributeName === orion.Constants.VERSION_ATTRIBUTE)
+ this._versionRange = orion.VersionRange.parseVersionRange(value);
+ else if (attributeName === orion.Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE)
this._bundleSymbolicName = value;
- else if (attributeName === Constants.BUNDLE_VERSION_ATTRIBUTE)
- this._bundleVersionRange = VersionRange.parseVersionRange(value);
+ else if (attributeName === orion.Constants.BUNDLE_VERSION_ATTRIBUTE)
+ this._bundleVersionRange = orion.VersionRange.parseVersionRange(value);
this._attributes[attributeName] = value;
},
_parseDirective : function(token) {
- var index = token.indexOf(Constants.DIRECTIVE_EQUALS);
+ var index = token.indexOf(orion.Constants.DIRECTIVE_EQUALS);
var directiveName = token.substring(0, index).replace(/^\s+|\s+$/g, '');
if (directiveName.length === 0)
return;
- var value = token.substring(index + Constants.DIRECTIVE_EQUALS.length).replace(/^\s+|\s+$/g, '');
- if (directiveName === Constants.RESOLUTION_DIRECTIVE && value === Constants.RESOLUTION_OPTIONAL)
+ var value = token.substring(index + orion.Constants.DIRECTIVE_EQUALS.length).replace(/^\s+|\s+$/g, '');
+ if (directiveName === orion.Constants.RESOLUTION_DIRECTIVE && value === orion.Constants.RESOLUTION_OPTIONAL)
this._optional = true;
this._directives[directiveName] = value;
},
@@ -91,13 +92,13 @@
},
_checkAttributes : function(candidate) {
for ( var key in this._attributes) {
- if (key === Constants.VERSION_ATTRIBUTE) {
+ if (key === orion.Constants.VERSION_ATTRIBUTE) {
if (!this._versionRange.isIncluded(candidate.getVersion()))
return false;
- } else if (key === Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE) {
+ } else if (key === orion.Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE) {
if (!this._bundleSymbolicName === candidate.getBundleSymbolicName())
return false;
- } else if (key === Constants.BUNDLE_VERSION_ATTRIBUTE) {
+ } else if (key === orion.Constants.BUNDLE_VERSION_ATTRIBUTE) {
if (!this._bundleVersionRange.isIncluded(candidate.getBundleVersion()))
return false;
} else {
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Require.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Require.js
index 3663ee3..10d856c 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Require.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/_Require.js
@@ -1,4 +1,5 @@
-function _Require(header) {
+var orion = orion || {};
+orion._Require = function(header) {
if (header === null)
throw "header cannot be null";
@@ -6,47 +7,47 @@
this._attributes = {};
this._directives = {};
this._optional = false;
- this._bundleVersionRange = VersionRange.emptyRange;
+ this._bundleVersionRange = orion.VersionRange.emptyRange;
this._wiredBundle = null;
this._parseRequire(header);
-}
+};
-_Require.prototype = {
+orion._Require.prototype = {
_parseRequire : function(header) {
- var tokens = header.split(Constants.PARAMETER_DELIMITER);
+ var tokens = header.split(orion.Constants.PARAMETER_DELIMITER);
this._name = tokens[0].replace(/^\s+|\s+$/g, '');
for ( var i = 1; i < tokens.length; i++) {
var token = tokens[i];
- if (token.indexOf(Constants.DIRECTIVE_EQUALS) !== -1)
+ if (token.indexOf(orion.Constants.DIRECTIVE_EQUALS) !== -1)
this._parseDirective(token);
- else if (token.indexOf(Constants.ATTRIBUTE_EQUALS) !== -1)
+ else if (token.indexOf(orion.Constants.ATTRIBUTE_EQUALS) !== -1)
this._parseAttribute(token);
else
throw "bad import syntax: " + token + " in " + header;
}
},
_parseAttribute : function(token) {
- var index = token.indexOf(Constants.ATTRIBUTE_EQUALS);
+ var index = token.indexOf(orion.Constants.ATTRIBUTE_EQUALS);
var attributeName = token.substring(0, index).replace(/^\s+|\s+$/g, '');
if (attributeName.length === 0)
return;
- var value = token.substring(index + Constants.ATTRIBUTE_EQUALS.length).replace(/^\s+|\s+$/g, '');
+ var value = token.substring(index + orion.Constants.ATTRIBUTE_EQUALS.length).replace(/^\s+|\s+$/g, '');
- if (attributeName === Constants.BUNDLE_VERSION_ATTRIBUTE)
- this._bundleVersionRange = VersionRange.parseVersionRange(value);
+ if (attributeName === orion.Constants.BUNDLE_VERSION_ATTRIBUTE)
+ this._bundleVersionRange = orion.VersionRange.parseVersionRange(value);
this._attributes[attributeName] = value;
},
_parseDirective : function(token) {
- var index = token.indexOf(Constants.DIRECTIVE_EQUALS);
+ var index = token.indexOf(orion.Constants.DIRECTIVE_EQUALS);
var directiveName = token.substring(0, index).replace(/^\s+|\s+$/g, '');
if (directiveName.length === 0)
return;
- var value = token.substring(index + Constants.DIRECTIVE_EQUALS.length).replace(/^\s+|\s+$/g, '');
- if (directiveName === Constants.RESOLUTION_DIRECTIVE && value === Constants.RESOLUTION_OPTIONAL)
+ var value = token.substring(index + orion.Constants.DIRECTIVE_EQUALS.length).replace(/^\s+|\s+$/g, '');
+ if (directiveName === orion.Constants.RESOLUTION_DIRECTIVE && value === orion.Constants.RESOLUTION_OPTIONAL)
this._optional = true;
this._directives[directiveName] = value;
},
@@ -77,7 +78,7 @@
},
_checkAttributes : function(candidate) {
for ( var key in this._attributes) {
- if (key === Constants.BUNDLE_VERSION_ATTRIBUTE) {
+ if (key === orion.Constants.BUNDLE_VERSION_ATTRIBUTE) {
if (!this._bundleVersionRange.isIncluded(candidate.getVersion()))
return false;
}
diff --git a/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/BundleTest.js b/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/BundleTest.js
index 2053663..e8c2a78 100644
--- a/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/BundleTest.js
+++ b/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/BundleTest.js
@@ -1,31 +1,31 @@
var BundleTest = TestCase.create("BundleTest");
BundleTest.prototype.testGetName = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz_1", {name:"xyz"});
assertEquals("xyz", b.getName());
};
BundleTest.prototype.testEmptyVersion = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz_1", {name:"xyz"});
- assertEquals(Version.EMPTY_VERSION, b.getVersion());
+ assertEquals(orion.Version.EMPTY_VERSION, b.getVersion());
};
BundleTest.prototype.testBasicVersion = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz_1", {name:"xyz", version:"1.2.3.test"});
- assertEquals(Version.parseVersion("1.2.3.test"), b.getVersion());
+ assertEquals(orion.Version.parseVersion("1.2.3.test"), b.getVersion());
};
BundleTest.prototype.testBasicVersion = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz_1", {name:"xyz", version:"1.2.3.test"});
- assertEquals(Version.parseVersion("1.2.3.test"), b.getVersion());
+ assertEquals(orion.Version.parseVersion("1.2.3.test"), b.getVersion());
};
BundleTest.prototype.testGetBundleId = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b1 = framework.installBundle("xyz_1", {name:"xyz", version:"1.2.3.test"});
assertEquals(0, b1.getBundleId());
var b2 = framework.installBundle("xyz_2", {name:"xyz", version:"2.2.3.test"});
@@ -33,13 +33,13 @@
};
BundleTest.prototype.testGetLocation = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz_1", {name:"xyz", version:"1.2.3.test"});
assertEquals("xyz_1", b.getLocation());
};
BundleTest.prototype.testGetHeaders = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz_1", {name:"xyz", version:"1.2.3.test", randomHeader: "random"});
assertEquals("xyz", b.getHeaders().name);
assertEquals("1.2.3.test", b.getHeaders().version);
@@ -48,21 +48,21 @@
};
BundleTest.prototype.testGetState = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz_1", {name:"xyz", version:"1.2.3.test", randomHeader: "random"});
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertEquals(Bundle.RESOLVED, b.getState());
+ assertEquals(orion.Bundle.RESOLVED, b.getState());
b.start();
- assertEquals(Bundle.ACTIVE, b.getState());
+ assertEquals(orion.Bundle.ACTIVE, b.getState());
b.stop();
- assertEquals(Bundle.RESOLVED, b.getState());
+ assertEquals(orion.Bundle.RESOLVED, b.getState());
b.uninstall();
- assertEquals(Bundle.UNINSTALLED, b.getState());
+ assertEquals(orion.Bundle.UNINSTALLED, b.getState());
};
BundleTest.prototype.testEquals = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b1 = framework.installBundle("xyz_1", {name:"xyz", version:"1.2.3.test", randomHeader: "random"});
var b2 = framework.installBundle("xyz_2", {name:"xyz", version:"1.2.3.test", randomHeader: "random"});
var b3 = framework.installBundle("xyz_3", {name:"xyz", version:"1.2.4.test", randomHeader: "random"});
@@ -71,7 +71,7 @@
};
BundleTest.prototype.testGetResource = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b1 = framework.installBundle("xyz", {name:"xyz", version:"1.2.3.test", exports: "/abc", resources: "/abc/def.jpg"});
var b2 = framework.installBundle("qrs", {name:"qrs", version:"1.2.3.test", imports: "/abc"});
assertNull(b1.getResource("mno"));
@@ -82,7 +82,7 @@
};
BundleTest.prototype.testStartStop = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz", {
name:"xyz",
version:"1.2.3.test",
@@ -93,19 +93,19 @@
"abc.A.prototype.stop = function() { abc.test = 'stop'};\n",
activator: "abc.A"
});
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertEquals(Bundle.RESOLVED, b.getState());
+ assertEquals(orion.Bundle.RESOLVED, b.getState());
b.start();
- assertEquals(Bundle.ACTIVE, b.getState());
+ assertEquals(orion.Bundle.ACTIVE, b.getState());
assertEquals("start", b.load("abc.test"));
b.stop();
- assertEquals(Bundle.RESOLVED, b.getState());
+ assertEquals(orion.Bundle.RESOLVED, b.getState());
assertEquals("stop", b.load("abc.test"));
b.uninstall();
- assertEquals(Bundle.UNINSTALLED, b.getState());
+ assertEquals(orion.Bundle.UNINSTALLED, b.getState());
diff --git a/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/FrameworkTest.js b/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/FrameworkTest.js
index 252015c..058ee30 100644
--- a/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/FrameworkTest.js
+++ b/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/FrameworkTest.js
@@ -1,12 +1,12 @@
var FrameworkTest = TestCase.create("FrameworkTest");
FrameworkTest.prototype.testEmptyGetBundles = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
assertEquals(0, framework.getBundles().length);
};
FrameworkTest.prototype.getSetProperty = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
assertUndefined(framework.getProperty("test"));
framework.setProperty("test", "value");
assertEquals("test", framework.getProperty("test"));
@@ -15,7 +15,7 @@
};
FrameworkTest.prototype.testNullLocationInstallBundle = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
try {
framework.installBundle(null);
} catch (e) {
@@ -25,25 +25,25 @@
};
FrameworkTest.prototype.testSimpleInstallBundle = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz", {name:"xyz"});
assertEquals(1, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
};
FrameworkTest.prototype.testEmptyRefresh = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
framework.refresh();
};
FrameworkTest.prototype.testSimpleRefresh = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz", {name:"xyz"});
assertEquals(1, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
b.uninstall();
- assertEquals(Bundle.UNINSTALLED, b.getState());
+ assertEquals(orion.Bundle.UNINSTALLED, b.getState());
assertEquals(1, framework.getBundles().length);
framework.refresh();
assertEquals(0, framework.getBundles().length);
@@ -51,122 +51,122 @@
FrameworkTest.prototype.testEmptyResolve = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
framework.resolve();
};
FrameworkTest.prototype.testSimpleResolve = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz", {name:"xyz"});
assertEquals(1, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertEquals(Bundle.RESOLVED, b.getState());
+ assertEquals(orion.Bundle.RESOLVED, b.getState());
};
FrameworkTest.prototype.testResolveNonSingleton = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("cde", {name:"cde", version:"1"});
var b = framework.installBundle("cde2", {name:"cde", version:"2"});
assertEquals(2, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, a.getState());
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, a.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveSingletonFail = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("cde", {name:"cde;singleton:=true", version:"1"});
var b = framework.installBundle("cde2", {name:"cde;singleton:=true", version:"2"});
assertEquals(2, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, a.getState());
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, a.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertFalse(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertFalse(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveImportsFail = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz", {name:"xyz", imports:"abc"});
assertEquals(1, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertFalse(Bundle.RESOLVED == b.getState());
+ assertFalse(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveOptionalImports = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz", {name:"xyz", imports:"abc;resolution:=optional"});
assertEquals(1, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveImportsSuccess = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("cde", {name:"cde", exports:"abc", script:"var abc = {hi:7};"});
var b = framework.installBundle("xyz", {name:"xyz", imports:"abc"});
assertEquals(2, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, a.getState());
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, a.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveVersionedImportsSuccess = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("cde", {name:"cde", exports:"abc;version=1.2", script:"var abc = {hi:7};"});
var b = framework.installBundle("xyz", {name:"xyz", imports:"abc;version=1.2"});
assertEquals(2, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, a.getState());
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, a.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveVersionedImportsFail = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("cde", {name:"cde", exports:"abc;version=1.1", script:"var abc = {hi:7};"});
var b = framework.installBundle("xyz", {name:"xyz", imports:"abc;version=1.2"});
assertEquals(2, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, a.getState());
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, a.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertFalse(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertFalse(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveResourceImportsSuccess = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("cde", {name:"cde", exports:"/abc/def"});
var b = framework.installBundle("xyz", {name:"xyz", imports:"/abc/def"});
assertEquals(2, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, a.getState());
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, a.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveImportsFailAfterUninstall = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("cde", {name:"cde", exports:"abc", script:"var abc = {hi:7};"});
var b = framework.installBundle("xyz", {name:"xyz", imports:"abc"});
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
a.uninstall();
framework.refresh();
- assertFalse(Bundle.RESOLVED == b.getState());
+ assertFalse(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveLikeFunction = function() {
@@ -176,20 +176,20 @@
};
FrameworkTest.prototype.testResolveImportsLoad = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("cde", {name:"cde", exports:"abc", script:"var abc = {hi:7};"});
framework.resolve();
assertEquals(7, a._scope.abc.hi);
assertEquals(7, a.load("abc").hi);
var b = framework.installBundle("xyz", {name:"xyz", imports:"abc", exports:"def", script:"var def = abc;"});
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
assertEquals(7, b.load("def").hi);
};
FrameworkTest.prototype.testResolveMultipleImportsLoad = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("cde", {name:"cde", exports:"abc,xyz", script:"var abc = {hi:7};\nvar xyz = {bye:9};"});
framework.resolve();
assertEquals(7, a._scope.abc.hi);
@@ -197,89 +197,89 @@
assertEquals(9, a.load("xyz").bye);
var b = framework.installBundle("xyz", {name:"xyz", imports:"abc,xyz", exports:"def,ghi", script:"var def = abc;\nvar ghi = xyz;"});
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
assertEquals(7, b.load("def").hi);
assertEquals(9, b.load("ghi").bye);
};
FrameworkTest.prototype.testResolveRequiresFail = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz", {name:"xyz", requires:"abc"});
assertEquals(1, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertFalse(Bundle.RESOLVED == b.getState());
+ assertFalse(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveOptionalRequires = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz", {name:"xyz", requires:"abc;resolution:=optional"});
assertEquals(1, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveRequiresFailAfterUninstall = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("abc", {name:"abc"});
var b = framework.installBundle("xyz", {name:"xyz", requires:"abc"});
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
a.uninstall();
framework.refresh();
- assertFalse(Bundle.RESOLVED == b.getState());
+ assertFalse(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveRequiresSuccess = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("abc", {name:"abc"});
var b = framework.installBundle("xyz", {name:"xyz", requires:"abc"});
assertEquals(2, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, a.getState());
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, a.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveVersionedRequiresSuccess = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("abc", {name:"abc", version:"1.2"});
var b = framework.installBundle("xyz", {name:"xyz", requires:"abc;bundle-version=1.2"});
assertEquals(2, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, a.getState());
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, a.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertTrue(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertTrue(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testResolveVersionedRequiresFail = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var a = framework.installBundle("abc", {name:"abc", version:"1.1"});
var b = framework.installBundle("xyz", {name:"xyz", requires:"abc;bundle-version=1.2"});
assertEquals(2, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, a.getState());
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, a.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.resolve();
- assertTrue(Bundle.RESOLVED == a.getState());
- assertFalse(Bundle.RESOLVED == b.getState());
+ assertTrue(orion.Bundle.RESOLVED == a.getState());
+ assertFalse(orion.Bundle.RESOLVED == b.getState());
};
FrameworkTest.prototype.testEmptyShutdown = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
framework.shutdown();
};
FrameworkTest.prototype.testEmptyShutdown = function() {
- var framework = new Framework();
+ var framework = new orion.Framework();
var b = framework.installBundle("xyz", {name:"xyz"});
assertEquals(1, framework.getBundles().length);
- assertEquals(Bundle.INSTALLED, b.getState());
+ assertEquals(orion.Bundle.INSTALLED, b.getState());
framework.shutdown();
assertEquals(0, framework.getBundles().length);
};
diff --git a/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/VersionRangeTest.js b/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/VersionRangeTest.js
index 1f18a6a..4e7b4be 100644
--- a/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/VersionRangeTest.js
+++ b/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/VersionRangeTest.js
@@ -1,53 +1,53 @@
var VersionRangeTest = TestCase.create("VersionRangeTest");
VersionRangeTest.prototype.testBasicVersionRange = function() {
- var versionRange = new VersionRange(Version.EMPTY_VERSION, true, Version.MAX_VERSION, true);
- assertEquals(Version.EMPTY_VERSION, versionRange.getMinimum());
+ var versionRange = new orion.VersionRange(orion.Version.EMPTY_VERSION, true, orion.Version.MAX_VERSION, true);
+ assertEquals(orion.Version.EMPTY_VERSION, versionRange.getMinimum());
assertTrue(versionRange.getIncludeMinimum());
- assertEquals(Version.MAX_VERSION, versionRange.getMaximum());
+ assertEquals(orion.Version.MAX_VERSION, versionRange.getMaximum());
assertTrue(versionRange.getIncludeMaximum());
};
VersionRangeTest.prototype.testEmptyVersionRange = function() {
- var versionRange = new VersionRange(null, true, null, true);
- assertEquals(VersionRange.EMPTY_RANGE, versionRange);
+ var versionRange = new orion.VersionRange(null, true, null, true);
+ assertEquals(orion.VersionRange.EMPTY_RANGE, versionRange);
};
VersionRangeTest.prototype.testParseBasicVersionRange = function() {
- var versionRange = VersionRange.parseVersionRange("0.0.0");
- assertEquals(Version.EMPTY_VERSION, versionRange.getMinimum());
+ var versionRange = orion.VersionRange.parseVersionRange("0.0.0");
+ assertEquals(orion.Version.EMPTY_VERSION, versionRange.getMinimum());
assertTrue(versionRange.getIncludeMinimum());
- assertEquals(Version.MAX_VERSION, versionRange.getMaximum());
+ assertEquals(orion.Version.MAX_VERSION, versionRange.getMaximum());
assertTrue(versionRange.getIncludeMaximum());
};
VersionRangeTest.prototype.testIncludeMinMax = function() {
- var versionRange1 = new VersionRange(null, true, null, false);
+ var versionRange1 = new orion.VersionRange(null, true, null, false);
assertTrue(versionRange1.getIncludeMinimum());
assertFalse(versionRange1.getIncludeMaximum());
- var versionRange2 = new VersionRange(null, false, null, true);
+ var versionRange2 = new orion.VersionRange(null, false, null, true);
assertFalse(versionRange2.getIncludeMinimum());
assertTrue(versionRange2.getIncludeMaximum());
};
VersionRangeTest.prototype.testIsIncluded = function() {
- var versionRange1 = new VersionRange(null, true, null, false);
- assertTrue(versionRange1.isIncluded(Version.EMPTY_VERSION));
- assertFalse(versionRange1.isIncluded(Version.MAX_VERSION));
+ var versionRange1 = new orion.VersionRange(null, true, null, false);
+ assertTrue(versionRange1.isIncluded(orion.Version.EMPTY_VERSION));
+ assertFalse(versionRange1.isIncluded(orion.Version.MAX_VERSION));
- var versionRange2 = new VersionRange(null, false, null, true);
- assertFalse(versionRange2.isIncluded(Version.EMPTY_VERSION));
- assertTrue(versionRange2.isIncluded(Version.MAX_VERSION));
+ var versionRange2 = new orion.VersionRange(null, false, null, true);
+ assertFalse(versionRange2.isIncluded(orion.Version.EMPTY_VERSION));
+ assertTrue(versionRange2.isIncluded(orion.Version.MAX_VERSION));
};
VersionRangeTest.prototype.testToString = function() {
- var versionRange1 = new VersionRange(new Version(1,0,0), true, null, true);
+ var versionRange1 = new orion.VersionRange(new orion.Version(1,0,0), true, null, true);
assertEquals("1.0.0", versionRange1.toString());
- var versionRange2 = new VersionRange(new Version(1,0,0), true, null, false);
- assertEquals("[1.0.0," + Version.MAX_VERSION.toString() + ")", versionRange2.toString());
+ var versionRange2 = new orion.VersionRange(new orion.Version(1,0,0), true, null, false);
+ assertEquals("[1.0.0," + orion.Version.MAX_VERSION.toString() + ")", versionRange2.toString());
- var versionRange2 = new VersionRange(new Version(1,0,0), false, null, true);
- assertEquals("(1.0.0," + Version.MAX_VERSION.toString() + "]", versionRange2.toString());
+ var versionRange2 = new orion.VersionRange(new orion.Version(1,0,0), false, null, true);
+ assertEquals("(1.0.0," + orion.Version.MAX_VERSION.toString() + "]", versionRange2.toString());
};
diff --git a/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/VersionTest.js b/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/VersionTest.js
index 77a0971..3247bb4 100644
--- a/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/VersionTest.js
+++ b/tests/org.eclipse.e4.languages.javascript.framework.test/scripts/VersionTest.js
@@ -1,7 +1,7 @@
var VersionTest = TestCase.create("VersionTest");
VersionTest.prototype.testBasicVersion = function() {
- var version = new Version(1, 0, 0);
+ var version = new orion.Version(1, 0, 0);
assertEquals(1, version.getMajor());
assertEquals(0, version.getMinor());
assertEquals(0, version.getMicro());
@@ -9,7 +9,7 @@
assertEquals("1.0.0", version.toString());
};
VersionTest.prototype.testQualifiedBasicVersion = function() {
- var version = new Version(1, 0, 0, "qualifier");
+ var version = new orion.Version(1, 0, 0, "qualifier");
assertEquals(1, version.getMajor());
assertEquals(0, version.getMinor());
assertEquals(0, version.getMicro());
@@ -17,21 +17,21 @@
assertEquals("1.0.0.qualifier", version.toString());
};
VersionTest.prototype.testEmptyVersion = function() {
- var version = new Version(0, 0, 0);
- assertEquals(Version.EMPTY_VERSION, version);
+ var version = new orion.Version(0, 0, 0);
+ assertEquals(orion.Version.EMPTY_VERSION, version);
assertEquals("0.0.0", version.toString());
};
VersionTest.prototype.testMaxVersion = function() {
- var version = new Version(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, "extra");
- assertEquals(Version.MAX_VERSION, version);
+ var version = new orion.Version(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE, "extra");
+ assertEquals(orion.Version.MAX_VERSION, version);
};
VersionTest.prototype.testParseEmptyVersion = function() {
- var version = Version.parseVersion("");
- assertEquals(Version.EMPTY_VERSION, version);
+ var version = orion.Version.parseVersion("");
+ assertEquals(orion.Version.EMPTY_VERSION, version);
};
VersionTest.prototype.testParseBasicVersion = function() {
- var version = Version.parseVersion("1.0.0");
+ var version = orion.Version.parseVersion("1.0.0");
assertEquals(1, version.getMajor());
assertEquals(0, version.getMinor());
assertEquals(0, version.getMicro());
@@ -39,7 +39,7 @@
assertEquals("1.0.0", version.toString());
};
VersionTest.prototype.testParseQualifiedBasicVersion = function() {
- var version = Version.parseVersion("1.0.0.qualifier");
+ var version = orion.Version.parseVersion("1.0.0.qualifier");
assertEquals(1, version.getMajor());
assertEquals(0, version.getMinor());
assertEquals(0, version.getMicro());
@@ -47,14 +47,14 @@
assertEquals("1.0.0.qualifier", version.toString());
};
VersionTest.prototype.testCompareVersion = function() {
- var version = Version.parseVersion("1.0.0");
+ var version = orion.Version.parseVersion("1.0.0");
assertTrue(0 === version.compareTo(version));
- assertTrue(0 < version.compareTo(Version.EMPTY_VERSION));
- assertTrue(0 > Version.EMPTY_VERSION.compareTo(version));
+ assertTrue(0 < version.compareTo(orion.Version.EMPTY_VERSION));
+ assertTrue(0 > orion.Version.EMPTY_VERSION.compareTo(version));
};
VersionTest.prototype.testBadMajor = function() {
try {
- var version = new Version("x", 0, 0);
+ var version = new orion.Version("x", 0, 0);
} catch (e) {
return;
}
@@ -62,7 +62,7 @@
};
VersionTest.prototype.testBadMinor = function() {
try {
- var version = new Version(0, "x", 0);
+ var version = new orion.Version(0, "x", 0);
} catch (e) {
return;
}
@@ -70,7 +70,7 @@
};
VersionTest.prototype.testBadMicro = function() {
try {
- var version = new Version(0, 0, "x");
+ var version = new orion.Version(0, 0, "x");
} catch (e) {
return;
}
@@ -78,7 +78,7 @@
}
VersionTest.prototype.testBadQualifier = function() {
try {
- var version = new Version(0, 0, 0, 7);
+ var version = new orion.Version(0, 0, 0, 7);
} catch (e) {
return;
}