Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update orion.client

  • Loading branch information...
commit 2583a86b41dffdb2d42002b61bd8a24ec2eacdce 1 parent 9b960c6
@mamacdon authored
Showing with 1,142 additions and 224 deletions.
  1. +47 −4 lib/orion.client/bundles/org.eclipse.orion.client.core/web/css/ide.css
  2. +20 −0 lib/orion.client/bundles/org.eclipse.orion.client.core/web/css/images.css
  3. +2 −1  lib/orion.client/bundles/org.eclipse.orion.client.core/web/css/layout.css
  4. +7 −7 lib/orion.client/bundles/org.eclipse.orion.client.core/web/css/theme.css
  5. +2 −2 lib/orion.client/bundles/org.eclipse.orion.client.core/web/edit/edit.css
  6. +7 −2 lib/orion.client/bundles/org.eclipse.orion.client.core/web/edit/setup.js
  7. +13 −4 lib/orion.client/bundles/org.eclipse.orion.client.core/web/gcli/cli.js
  8. BIN  lib/orion.client/bundles/org.eclipse.orion.client.core/web/images/gear-white.png
  9. BIN  lib/orion.client/bundles/org.eclipse.orion.client.core/web/images/gear.png
  10. +48 −4 lib/orion.client/bundles/org.eclipse.orion.client.core/web/js-tests/URL/testcase.js
  11. +1 −1  lib/orion.client/bundles/org.eclipse.orion.client.core/web/js-tests/jsTestSuite.js
  12. +127 −0 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/Deferred.js
  13. +285 −9 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/URL-shim.js
  14. +4 −2 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/commands.js
  15. +3 −0  lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/commonHTMLFragments.js
  16. +0 −46 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/editorCommands.js
  17. +96 −0 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/globalCommands.js
  18. +1 −1  lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/outliner.js
  19. +10 −2 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/searchAndReplace/textSearcher.js
  20. +2 −0  lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/sites/siteClient.js
  21. +28 −6 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/sites/sitesExplorer.js
  22. +14 −1 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/webui/dropdown.js
  23. +14 −1 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/webui/tooltip.js
  24. +4 −5 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/widgets/UserMenu.js
  25. +3 −22 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/widgets/themes/ThemeBuilder.js
  26. +319 −0 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/widgets/themes/editor/MiniThemeChooser.js
  27. +4 −6 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/widgets/themes/editor/ThemeData.js
  28. +18 −38 lib/orion.client/bundles/org.eclipse.orion.client.core/web/plugins/filePlugin/fileImpl.js
  29. +18 −38 lib/orion.client/bundles/org.eclipse.orion.client.core/web/plugins/filePlugin/webdavImpl.js
  30. +10 −3 lib/orion.client/bundles/org.eclipse.orion.client.core/web/shell/shellPage.js
  31. +4 −4 lib/orion.client/bundles/org.eclipse.orion.client.core/web/shell/shellPageFileService.js
  32. +0 −2  lib/orion.client/bundles/org.eclipse.orion.client.editor/web/examples/textview/textStylerOptions.js
  33. +1 −0  lib/orion.client/bundles/org.eclipse.orion.client.editor/web/orion/textview/rulers.css
  34. +30 −13 lib/orion.client/bundles/org.eclipse.orion.client.editor/web/orion/textview/textView.js
View
51 lib/orion.client/bundles/org.eclipse.orion.client.core/web/css/ide.css
@@ -114,6 +114,7 @@ h2 {
color: #404040;
vertical-align: middle;
font-weight: normal;
+ color:silver;
}
.dismiss {
@@ -136,10 +137,12 @@ h2 {
margin-bottom: 8px;
font-weight: normal;
vertical-align: baseline;
+ color:silver;
}
.parameterInputurl {
width: 30em;
+ color:#333;
}
.parameterInputcheckbox {
@@ -149,6 +152,7 @@ h2 {
.parameterInputtextarea {
vertical-align: top;
width: 50em;
+ color:#333;
}
.parameterPopup {
@@ -394,14 +398,15 @@ h2 {
border-radius: 2px;
margin: 8px;
display: none;
- vertical-align:middle;
- font-size:11px;
+ vertical-align: middle;
+ font-size: 11px;
z-index: 50;
+ color: #999;
}
.slideParameters {
- border: 1px solid #808080;
- background-color: #d7d7d7;
+ border: 1px solid #555;
+ background-color: #555;
}
.slideContainerActive {
@@ -716,7 +721,17 @@ h2 {
}
input {
+ border-radius: 3px;
-moz-user-select: text;
+ text-indent: none;
+ text-indent: 0px;
+ text-shadow: none;
+ border: none;
+ border-radius: 2px;
+ color: #333;
+ font-size: 9pt;
+ padding: 2px;
+ margin-left: 5px;
}
.treeIterationCursor {
@@ -828,3 +843,31 @@ input {
.targetSelector{
}
+
+.setting-control {
+ display: inline-block;
+ width: 200px;
+ padding: 4px;
+ margin: 10px;
+ outline: none;
+ background-color: white;
+ border: 1px solid #CCC;
+ border-radius: 3px;
+ font-size: 12px;
+ color: #222;
+}
+
+.settingsPanelLabel {
+ margin-top: 10px;
+ min-width: 145px;
+ text-transform: uppercase;
+ color: #B3ADAA;
+ display: inline-block;
+}
+
+.settingsPanel{
+ position: relative;
+ float: right;
+ margin-right: 24px;
+ padding: 10px;
+}
View
20 lib/orion.client/bundles/org.eclipse.orion.client.core/web/css/images.css
@@ -77,3 +77,23 @@
.core-sprite-stop{ background-position: 0 -685px; width: 16px; height: 16px; }
.core-sprite-stylesheet{ background-position: 0 -703px; width: 16px; height: 16px; }
.core-sprite-warning{ background-position: 0 -721px; width: 16px; height: 16px; }
+
+
+.core-sprite-settings {
+ background: url(../images/gear.png) no-repeat top left;
+ vertical-align: middle;
+ display: inline-block;
+ margin-top: 4px;
+ height: 16px;
+ width: 16px;
+}
+
+.core-sprite-settings-white {
+ background: url(../images/gear-white.png) no-repeat top left;
+ vertical-align: middle;
+ display: inline-block;
+ margin-top: 4px;
+ height: 16px;
+ width: 16px;
+}
+
View
3  lib/orion.client/bundles/org.eclipse.orion.client.core/web/css/layout.css
@@ -72,7 +72,8 @@ hard-coded numbers elsewhere.
.layoutBlock {
clear: both;
margin: 0;
- padding: 2px 8px;
+ /* padding: 2px 8px; */
+ padding: 4px 4px 2px 4px;
vertical-align: baseline;
}
View
14 lib/orion.client/bundles/org.eclipse.orion.client.core/web/css/theme.css
@@ -303,7 +303,7 @@ a.currentLocation:hover {
.dropdownMenu {
color: #222;
background-color: #fbfbfb;
- display: none;
+ visibility: hidden;
z-index: 150;
min-width: 120px;
position: absolute;
@@ -334,18 +334,18 @@ a.currentLocation:hover {
padding: 4px 0;
}
-.dropdownMenu > li:hover {
- text-decoration: none;
- background: #ffeecc;
-}
-
.dropdownMenu > li > *:focus {
outline: 1px dotted #aaa;
+ background: #f3f6fe;
+}
+
+.dropdownMenu > li:hover {
+ text-decoration: none;
background: #ffeecc;
}
.dropdownMenuOpen {
- display: block;
+ visibility: visible;
}
.dropdownSeparator {
View
4 lib/orion.client/bundles/org.eclipse.orion.client.core/web/edit/edit.css
@@ -31,7 +31,7 @@
}
.findSlideoutButton {
- color: #222;
+ color: silver;
border: 1px solid transparent;
text-align: center;
vertical-align: top;
@@ -50,7 +50,7 @@
}
.findSlideoutMenu {
- color: #222;
+ color: silver;
background-color: transparent;
border: 1px solid transparent;
padding: 2px;
View
9 lib/orion.client/bundles/org.eclipse.orion.client.core/web/edit/setup.js
@@ -17,12 +17,12 @@ define(['i18n!orion/edit/nls/messages', 'require', 'dojo', 'orion/selection', 'o
'orion/problems', 'orion/editor/contentAssist', 'orion/editorCommands', 'orion/editor/editorFeatures', 'orion/editor/editor', 'orion/syntaxchecker',
'orion/textview/textView', 'orion/textview/textModel',
'orion/textview/projectionTextModel', 'orion/textview/keyBinding','orion/searchAndReplace/textSearcher',
- 'orion/edit/dispatcher', 'orion/contentTypes', 'orion/PageUtil', 'orion/highlight', "orion/i18nUtil", 'orion/edit/syntaxmodel',
+ 'orion/edit/dispatcher', 'orion/contentTypes', 'orion/PageUtil', 'orion/highlight', "orion/i18nUtil", 'orion/edit/syntaxmodel', 'orion/widgets/themes/editor/MiniThemeChooser',
'dojo/hash'],
function(messages, require, dojo, mSelection, mStatus, mProgress, mDialogs, mCommands, mFavorites,
mFileClient, mOperationsClient, mSearchClient, mGlobalCommands, mOutliner, mProblems, mContentAssist, mEditorCommands, mEditorFeatures, mEditor,
mSyntaxchecker, mTextView, mTextModel, mProjectionTextModel, mKeyBinding, mSearcher,
- mDispatcher, mContentTypes, PageUtil, Highlight, i18nUtil, SyntaxModelWirer) {
+ mDispatcher, mContentTypes, PageUtil, Highlight, i18nUtil, SyntaxModelWirer, mThemeChooser) {
var exports = exports || {};
@@ -139,6 +139,11 @@ exports.setUpEditor = function(serviceRegistry, preferences, isReadOnly){
this._contentType = contentTypeService.getFilenameContentType(this.getTitle());
name = this.getTitle();
}
+
+ var chooser = new mThemeChooser.MiniThemeChooser( preferences, editor.getTextView() );
+
+ mGlobalCommands.addSettings( chooser );
+
mGlobalCommands.setPageTarget({task: "Coding", name: name, target: metadata,
isFavoriteTarget: true, makeAlternate: function() {
if (metadata.Parents && metadata.Parents.length > 0) {
View
17 lib/orion.client/bundles/org.eclipse.orion.client.core/web/gcli/cli.js
@@ -1107,11 +1107,10 @@ Requisition.prototype.exec = function(input) {
if (reply != null && typeof reply.then === 'function') {
reply.then(
function(data) { output.complete(data); },
- function(error) { output.error = true; output.complete(error); });
+ function(error) { output.error = true; output.complete(error); },
+ function(data) { output.progress(data); });
output.promise = reply;
- // Add progress to our promise and add a handler for it here
- // See bug 659300
}
else {
output.complete(reply);
@@ -1629,7 +1628,7 @@ function Output(options) {
}
/**
- * Called when there is data to display
+ * Called when there is data to display and the data completes execution of the command.
* @param data
*/
Output.prototype.complete = function(data) {
@@ -1643,6 +1642,16 @@ Output.prototype.complete = function(data) {
};
/**
+ * Called when there is data to display.
+ * @param data The data up to this point.
+ */
+Output.prototype.progress = function(data) {
+ this.data = data;
+
+ this.onChange({ output: this });
+};
+
+/**
* Convert to a DOM element for display.
* @param element The DOM node to which the data should be written. Existing
* content of 'element' will be removed before 'outputData' is added.
View
BIN  lib/orion.client/bundles/org.eclipse.orion.client.core/web/images/gear-white.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  lib/orion.client/bundles/org.eclipse.orion.client.core/web/images/gear.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
52 lib/orion.client/bundles/org.eclipse.orion.client.core/web/js-tests/URL/testcase.js
@@ -13,7 +13,7 @@
define(["orion/assert", "orion/URL-shim", "domReady!"], function(assert) {
var tests = {};
-
+
tests.testSpecificationURL = function() {
var spec = "http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html";
var url = new URL(spec);
@@ -27,7 +27,7 @@ define(["orion/assert", "orion/URL-shim", "domReady!"], function(assert) {
assert.equal(url.search, "");
assert.equal(url.hash, "");
};
-
+
tests.testExampleURL = function() {
var spec = "http://www.example.com/a/b/c.html?p=q&r=s&p&p=t#hash";
var url = new URL(spec);
@@ -41,6 +41,50 @@ define(["orion/assert", "orion/URL-shim", "domReady!"], function(assert) {
assert.equal(url.search, "?p=q&r=s&p&p=t");
assert.equal(url.hash, "#hash");
};
-
+
+ tests.testUsernamePasswordURL = function() {
+ var spec = "http://www.example.com/a/b/c.html?p=q&r=s&p&p=t#hash";
+ var url = new URL(spec);
+ url.username = "a name";
+ assert.equal(url.href, "http://a%20name@www.example.com/a/b/c.html?p=q&r=s&p&p=t#hash");
+ url.password = "a password";
+ assert.equal(url.href, "http://a%20name:a%20password@www.example.com/a/b/c.html?p=q&r=s&p&p=t#hash");
+ url.username = "";
+ assert.equal(url.href, "http://:a%20password@www.example.com/a/b/c.html?p=q&r=s&p&p=t#hash");
+ url.username = "a name";
+ url.password = "";
+ assert.equal(url.href, "http://a%20name@www.example.com/a/b/c.html?p=q&r=s&p&p=t#hash");
+ url.username = "";
+ assert.equal(url.href, spec);
+ };
+
+ tests.testQuery = function() {
+ var spec = "http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html";
+ var url = new URL(spec);
+ assert.equal(url.search,"");
+ assert.equal(url.query.size,0);
+ url.search = "?a=1&b=2";
+ assert.equal(url.query.size,2);
+ assert.equal(url.query.get("a"), "1");
+ assert.equal(url.query.get("b"), "2");
+ url.query.set("b","3");
+ assert.equal(url.query.get("b"), "3");
+ assert.equal(url.search, "?a=1&b=3");
+ assert.equal(url.query.has("c"), false);
+ assert.equal(url.query.has("a"), true);
+ assert.equal(url.query.has("b"), true);
+ url.query.append("b","4");
+ url.query.append("c","5");
+ url.query.append("a param","a value");
+ url.query.set("empty");
+ url.query.append("b","6");
+ assert.equal(url.search, "?a=1&b=3&b=4&c=5&a%20param=a%20value&empty&b=6");
+ url.query['delete']("b");
+ assert.equal(url.search, "?a=1&c=5&a%20param=a%20value&empty");
+ url.query.clear();
+ assert.equal(url.search, "");
+
+ };
+
return tests;
-});
+});
View
2  lib/orion.client/bundles/org.eclipse.orion.client.core/web/js-tests/jsTestSuite.js
@@ -110,7 +110,6 @@ OrionTestCase("textview", "/js-tests/textview/test.html");
OrionTestCase("contentAssist", "/js-tests/editor/contentAssist/test.html");
OrionTestCase("jsTemplateContentAssist", "/js-tests/jsTemplateContentAssist/test.html");
OrionTestCase("contentTypes", "/js-tests/contentTypes/test.html");
-OrionTestCase("commands", "/js-tests/commands/test.html");
OrionTestCase("extensionParsing", "/js-tests/extensionParsing/test.html");
OrionTestCase("xhr", "/js-tests/xhr/test.html");
OrionTestCase("config", "/js-tests/config/test.html");
@@ -119,6 +118,7 @@ OrionTestCase("setting", "/js-tests/settings/test.html");
OrionTestCase("esprima-content-assist", "/js-tests/esprima/esprimaJsContentAssistTests.html");
OrionTestCase("asyncStyler", "/js-tests/asyncStyler/test.html");
OrionTestCase("syntaxmodel", "/js-tests/syntaxmodel/test.html");
+OrionTestCase("commands", "/js-tests/commands/test.html");
//OrionTestCase("searchRendering", "/js-tests/searchRendering/test.html");
//OrionUITestCase("textviewPerformance", "/js-tests/textview/test-performance.html");
View
127 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/Deferred.js
@@ -69,6 +69,39 @@
};
}
+
+ /**
+ * @name orion.Promise
+ * @class Interface representing an eventual value.
+ * @description Promise is an interface that represents an eventual value returned from the single completion of an operation.
+ *
+ * <p>For a concrete class that provides Promise-based APIs, see {@link orion.Deferred}.</p>
+ * @see orion.Deferred#promise
+ * @see orion.Deferred
+ */
+ /**
+ * @name then
+ * @methodOf orion.Promise.prototype
+ * @description Adds handlers to be called on fulfillment or progress of this promise.
+ * @param {Function} [onResolve] Called when this promise is resolved.
+ * @param {Function} [onReject] Called when this promise is rejected.
+ * @param {Function} [onProgress] May be called to report progress events on this promise.
+ * @returns {orion.Promise} A new promise that is fulfilled when the given onResolve or onReject callback is finished.
+ * The callback's return value gives the fulfillment value of the returned promise.
+ */
+
+ /**
+ * @name orion.Deferred
+ * @borrows orion.Promise#then as #then
+ * @class Provides abstraction over asynchronous operations.
+ * @description Deferred provides abstraction over asynchronous operations.
+ *
+ * <p>Because Deferred implements the {@link orion.Promise} interface, a Deferred may be used anywhere a Promise is called for.
+ * However, in most such cases it is recommended to use the Deferred's {@link #promise} field instead, which exposes a read-only
+ * interface to callers.</p>
+ * @param {Function} [optOnCancel] Will be invoked if the Deferred is canceled. The <code>optOnCancel</code> function is invoked
+ * passing the reason the Deferred was canceled (or a new <code>Error</code> if no reason was provided).
+ */
function Deferred(optOnCancel) {
var result, state, head, tail, canceled = false,
_this = this;
@@ -108,6 +141,14 @@
return false;
}
+ /**
+ * Rejects this Deferred.
+ * @name reject
+ * @methodOf orion.Deferred.prototype
+ * @param {Object} error
+ * @param {Boolean} [strict]
+ * @returns {orion.Promise}
+ */
this.reject = function(error, strict) {
if (!checkFulfilled(strict)) {
state = "rejected"; //$NON-NLS-0$
@@ -119,6 +160,14 @@
return _this.promise;
};
+ /**
+ * Resolves this Deferred.
+ * @name resolve
+ * @methodOf orion.Deferred.prototype
+ * @param {Object} value
+ * @param {Boolean} [strict]
+ * @returns {orion.Promise}
+ */
this.resolve = function(value, strict) {
if (!checkFulfilled(strict)) {
state = "resolved"; //$NON-NLS-0$
@@ -130,6 +179,14 @@
return _this.promise;
};
+ /**
+ * Notifies listeners of progress on this Deferred.
+ * @name progress
+ * @methodOf orion.Deferred.prototype
+ * @param {Object} update The progress update.
+ * @param {Boolean} [strict]
+ * @returns {orion.Promise}
+ */
this.progress = function(update, strict) {
if (!checkFulfilled(strict)) {
var listener = head;
@@ -143,6 +200,13 @@
return _this.promise;
};
+ /**
+ * Cancels this Deferred.
+ * @name cancel
+ * @methodOf orion.Deferred.prototype
+ * @param {Object} reason The reason for canceling this Deferred.
+ * @param {Boolean} [strict]
+ */
this.cancel = function(reason, strict) {
if (!checkFulfilled(strict)) {
canceled = true;
@@ -187,22 +251,53 @@
return listener.deferred.promise;
};
+ /**
+ * Returns whether this Deferred was resolved.
+ * @name isResolved
+ * @methodOf orion.Deferred.prototype
+ * @returns {Boolean} <code>true</code> if this Deferred was resolved, otherwise <code>false</code>.
+ */
this.isResolved = function() {
return state === "resolved"; //$NON-NLS-0$
};
+ /**
+ * Returns whether this Deferred was rejected.
+ * @name isRejected
+ * @methodOf orion.Deferred.prototype
+ * @returns {Boolean} <code>true</code> if this Deferred was rejected, otherwise <code>false</code>.
+ */
this.isRejected = function() {
return state === "rejected"; //$NON-NLS-0$
};
+ /**
+ * Returns whether this Deferred was fulfilled. A Deferred is <dfn>fulfilled</dfn> iff it was rejected or resolved.
+ * Thus, calling this method is equivalent to checking <code>deferred.isResolved() || deferred.isRejected()</code>.
+ * @name isFulfilled
+ * @methodOf orion.Deferred.prototype
+ * @returns {Boolean} <code>true</code> if this Deferred was fulfilled, otherwise <code>false</code>.
+ */
this.isFulfilled = function() {
return !!state;
};
+ /**
+ * Returns whether this Deferred was canceled.
+ * @name isCanceled
+ * @methodOf orion.Deferred.prototype
+ * @returns {Boolean} <code>true</code> if this Deferred was canceled, otherwise <code>false</code>.
+ */
this.isCanceled = function() {
return canceled;
};
+ /**
+ * The read-only promise underlying this Deferred.
+ * @name promise
+ * @fieldOf orion.Deferred.prototype
+ * @type orion.Promise
+ */
this.promise = {
then: this.then,
cancel: this.cancel,
@@ -220,6 +315,24 @@
this.promise.state = this.state;
}
+ /**
+ * Takes multiple promises and returns a new promise that represents the outcome of all the promises.
+ * <p>When <code>all</code> is called with a single parameter, the returned promise has <dfn>eager</dfn> semantics,
+ * meaning if one of the input promises is rejected, the returned promise also rejects, without waiting for the
+ * rest of the promises to fulfill.</p>
+ *
+ * To obtain <dfn>lazy</dfn> semantics (meaning the returned promise waits for all input promises to fulfill), pass the
+ * optional parameter <code>optOnError</code>.
+ * @name all
+ * @methodOf orion.Deferred
+ * @static
+ * @param {orion.Promise[]} promises The promises.
+ * @param {Function} [optOnError] Handles a rejected input promise. When invoked, <code>optOnError</code> is passed the reason
+ * the input promise was rejected. The return value of this <code>optOnError</code> call serves as the value of the rejected promise.
+ * @returns {orion.Promise} A new promise. The returned promise is generally fulfilled to an <code>Array</code> whose elements
+ * give the fulfillment values of the input promises. However if an input promise is rejected and eager semantics is used, the
+ * returned promise will instead be fulfilled to a single error value.</p>
+ */
Deferred.all = function(promises, optOnError) {
var count = promises.length,
result = [],
@@ -263,6 +376,20 @@
return deferred.promise;
};
+ /**
+ * Applies callbacks to a promise or to a regular object.
+ * @name when
+ * @methodOf orion.Deferred
+ * @static
+ * @param {Object|orion.Promise} value Either a {@link orion.Promise}, or a normal value.
+ * @param {Function} onResolve Called when the <code>value</code> promise is resolved. If <code>value</code> is not a promise,
+ * this function is called immediately.
+ * @param {Function} onReject Called when the <code>value</code> promise is rejected. If <code>value</code> is not a promise,
+ * this function is never called.
+ * @param {Function} onProgress Called when the <code>value</code> promise provides a progress update. If <code>value</code> is
+ * not a promise, this function is never called.
+ * @returns {orion.Promise} A new promise.
+ */
Deferred.when = function(value, onResolve, onReject, onProgress) {
var promise, deferred;
if (value && typeof value.then === "function") { //$NON-NLS-0$
View
294 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/URL-shim.js
@@ -10,13 +10,231 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
/*global document window*/
-// URL Shim -- see http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html
+// URL Shim -- see http://http://url.spec.whatwg.org/ and http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html
(function() {
if (typeof window.URL === "function" && new window.URL("http://www.w3.org").protocol === "http:") {
return;
}
+
+ var _USERNAME_PASSWORD_RE = /([^:]*):?(.*)/;
+ function _createMapIterator(entries, kind) {
+ var index = 0;
+ return {
+ next: function() {
+ if (index < entries.length) {
+ var entry = entries[index++];
+ switch (kind) {
+ case "keys":
+ return entry[0];
+ case "values":
+ return entry[1];
+ case "keys+values":
+ return [entry[0], entry[1]];
+ default:
+ throw new TypeError();
+ }
+ }
+ throw new Error("Stop Iteration");
+ }
+ };
+ }
+
+ function _checkString(txt) {
+ if (typeof txt !== "string") {
+ throw new TypeError();
+ }
+ }
+
+ function _checkValue(value) {
+ if (typeof value !== "string" && value !== null) {
+ if (typeof value === "undefined") {
+ value = null;
+ } else {
+ throw new TypeError();
+ }
+ }
+ return value;
+ }
+
+ // See http://url.spec.whatwg.org/#interface-urlquery
+ function URLQuery() {
+ Object.defineProperty(this, "_entries", {
+ value: [] // array of [key,value]
+ });
+ Object.defineProperty(this, "_dirty", {
+ value: false,
+ writable: true
+ });
+ }
+
+ Object.defineProperties(URLQuery.prototype, {
+ _parseSearch: {
+ value: function(search) {
+ this.clear();
+ this._dirty = false;
+ if (search) {
+ _checkString(search);
+ var pairs = search.slice(1).split("&");
+ for (var i = 0; i < pairs.length; i++) {
+ var pair = pairs[i];
+ var parsed = /([^=]*)(=?)(.*)/.exec(pair);
+ var name = decodeURIComponent(parsed[1] || "");
+ var hasEquals = !!parsed[2];
+ var value = hasEquals ? decodeURIComponent(parsed[3] || "") : null;
+ this.append(name, value);
+ }
+ }
+ }
+ },
+ _updateSearch: {
+ value: function(anchor) {
+ if (this._dirty) {
+ this._dirty = false;
+ if (this.size === 0) {
+ anchor.search = "";
+ } else {
+ anchor.search = "?" + this._entries.map(function(entry) {
+ var pair = encodeURIComponent(entry[0]);
+ if (entry[1] !== null) {
+ pair += "=" + encodeURIComponent(entry[1]);
+ }
+ return pair;
+ }).join("&");
+ }
+ }
+ }
+ },
+ get: {
+ value: function(key) {
+ _checkString(key);
+ var result;
+ this._entries.some(function(entry) {
+ if (entry[0] === key) {
+ result = entry[1];
+ return true;
+ }
+ });
+ return result;
+ },
+ enumerable: true
+ },
+ set: {
+ value: function(key, value) {
+ _checkString(key);
+ value = _checkValue(value);
+ var found = false;
+ this._dirty = true;
+ this._entries.some(function(entry) {
+ if (entry[0] === key) {
+ found = true;
+ entry[1] = value;
+ return true;
+ }
+ });
+ if (!found) {
+ this._entries.push([key, value]);
+ }
+ },
+ enumerable: true
+ },
+ has: {
+ value: function(key) {
+ _checkString(key);
+ var found = false;
+ this._entries.some(function(entry) {
+ if (entry[0] === key) {
+ found = true;
+ return true;
+ }
+ });
+ return found;
+ },
+ enumerable: true
+ },
+ 'delete': {
+ value: function(key) {
+ _checkString(key);
+ var found = false;
+ for (var i = this._entries.length - 1; i > -1; i--) {
+ var entry = this._entries[i];
+ if (entry[0] === key) {
+ this._dirty = true;
+ found = true;
+ this._entries.splice(i, 1);
+ }
+ }
+ return found;
+ },
+ enumerable: true
+ },
+ clear: {
+ value: function() {
+ if (this._entries.length !== 0) {
+ this._entries.length = 0;
+ this._dirty = true;
+ }
+ },
+ enumerable: true
+ },
+ forEach: {
+ value: function(callback, thisArg) {
+ var thisMap = this;
+ this._entries.forEach(function(entry) {
+ callback.call(thisArg, entry[1], entry[0], thisMap);
+ });
+ },
+ enumerable: true
+ },
+ keys: {
+ value: function() {
+ return _createMapIterator(this._entries, "keys");
+ },
+ enumerable: true
+ },
+ values: {
+ value: function() {
+ return _createMapIterator(this._entries, "values");
+ },
+ enumerable: true
+ },
+ items: {
+ value: function() {
+ return _createMapIterator(this._entries, "keys+values");
+ }
+ },
+ size: {
+ get: function() {
+ return this._entries.length;
+ },
+ enumerable: true
+ },
+ getAll: {
+ value: function(key) {
+ _checkString(key);
+ var result = [];
+ this._entries.forEach(function(entry) {
+ if (entry[0] === key) {
+ result.push(entry[1]);
+ }
+ });
+ return result;
+ },
+ enumerable: true
+ },
+ append: {
+ value: function(key, value) {
+ _checkString(key);
+ value = _checkValue(value);
+ this._entries.push([key, value]);
+ this._dirty = true;
+ },
+ enumerable: true
+ }
+ });
+
+ // See http://url.spec.whatwg.org/#api
function URL(url, base) {
url = url || "";
if (typeof url !== "string") {
@@ -32,7 +250,7 @@
if (base) {
var baseAnchor = doc.createElement("a");
baseAnchor.href = base;
- if (baseAnchor.protocol.length < 2) {
+ if (baseAnchor.protocol.length < 2 || !baseAnchor.host) {
throw new Error("InvalidStateError");
}
var baseElement = doc.createElement("base");
@@ -46,21 +264,22 @@
Object.defineProperty(this, "_urlAnchor", {
value: urlAnchor
});
+ Object.defineProperty(this, "query", {
+ value: new URLQuery(urlAnchor.search),
+ enumerable: true
+ });
}
Object.defineProperties(URL.prototype, {
- toString: {
- value: function() {
- return this._urlAnchor.href;
- },
- enumerable: false
- },
href: {
get: function() {
+ this.query._updateSearch(this._urlAnchor);
return this._urlAnchor.href;
},
set: function(value) {
+ _checkString(value);
this._urlAnchor.href = value;
+ this.query._parseSearch(this._urlAnchor.search);
},
enumerable: true
},
@@ -78,15 +297,66 @@
return this._urlAnchor.protocol;
},
set: function(value) {
+ _checkString(value);
this._urlAnchor.protocol = value;
},
enumerable: true
},
+ _userinfo: { // note: not part of spec so not enumerable
+ get: function() {
+ var re = new RegExp("^" + this._urlAnchor.protocol + "(\\/\\/)(?:([^@]*)?@)?" + this._urlAnchor.host);
+ var result = re.exec(this._urlAnchor.href);
+ var userinfo = result[2];
+ return userinfo || "";
+ },
+ set: function(value) {
+ _checkString(value);
+ this.query._updateSearch(this._urlAnchor);
+ var re = new RegExp("^" + this._urlAnchor.protocol + "(\\/\\/)(?:([^@]*)?@)?" + this._urlAnchor.host);
+ var replacement = this._urlAnchor.protocol + "//" + (value ? value + "@" : "") + this._urlAnchor.host;
+ this._urlAnchor.href = this._urlAnchor.href.replace(re, replacement);
+ }
+ },
+ username: {
+ get: function() {
+ var parsed = _USERNAME_PASSWORD_RE.exec(this._userinfo);
+ var username = decodeURIComponent(parsed[1] || "");
+ return username;
+ },
+ set: function(value) {
+ _checkString(value);
+ var parsed = _USERNAME_PASSWORD_RE.exec(this._userinfo);
+ var userpass = [encodeURIComponent(value || "")];
+ if (parsed[2] !== null) {
+ userpass.push(parsed[2]);
+ }
+ this._userinfo = userpass.join(":");
+ },
+ enumerable: true
+ },
+ password: {
+ get: function() {
+ var parsed = _USERNAME_PASSWORD_RE.exec(this._userinfo);
+ var password = decodeURIComponent(parsed[2] || "");
+ return password;
+ },
+ set: function(value) {
+ _checkString(value);
+ var parsed = _USERNAME_PASSWORD_RE.exec(this._userinfo);
+ var userpass = [parsed[1] || ""];
+ if (value) {
+ userpass.push(encodeURIComponent(value));
+ }
+ this._userinfo = userpass.join(":");
+ },
+ enumerable: true
+ },
host: {
get: function() {
return this._urlAnchor.host;
},
set: function(value) {
+ _checkString(value);
this._urlAnchor.host = value;
},
enumerable: true
@@ -96,6 +366,7 @@
return this._urlAnchor.hostname;
},
set: function(value) {
+ _checkString(value);
this._urlAnchor.hostname = value;
},
enumerable: true
@@ -105,6 +376,7 @@
return this._urlAnchor.port;
},
set: function(value) {
+ _checkString(value);
this._urlAnchor.port = value;
},
enumerable: true
@@ -114,16 +386,20 @@
return this._urlAnchor.pathname;
},
set: function(value) {
+ _checkString(value);
this._urlAnchor.pathname = value;
},
enumerable: true
},
search: {
get: function() {
+ this.query._updateSearch(this._urlAnchor);
return this._urlAnchor.search;
},
set: function(value) {
+ _checkString(value);
this._urlAnchor.search = value;
+ this.query._parseSearch(this._urlAnchor.search);
},
enumerable: true
},
@@ -132,6 +408,7 @@
return this._urlAnchor.hash;
},
set: function(value) {
+ _checkString(value);
this._urlAnchor.hash = value;
},
enumerable: true
@@ -150,5 +427,4 @@
});
}
window.URL = URL;
- return URL;
}());
View
6 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/commands.js
@@ -849,8 +849,10 @@ define(['i18n!orion/nls/messages', 'require', 'orion/uiUtils', 'orion/PageUtil',
if (command.choiceCallback) {
var menuParent;
var nodeClass;
+ var nested;
if (renderType === "tool" || renderType === "button") { //$NON-NLS-1$ //$NON-NLS-0$
menuParent = parent;
+ nested = false;
if (parent.nodeName.toLowerCase() === "ul") { //$NON-NLS-0$
menuParent = document.createElement("li"); //$NON-NLS-0$
parent.appendChild(menuParent);
@@ -859,13 +861,14 @@ define(['i18n!orion/nls/messages', 'require', 'orion/uiUtils', 'orion/PageUtil',
}
} else {
menuParent = parent;
+ nested = true;
}
// dropdown button
var self = this;
var populateFunction = function(menu) {
this.populateChoicesMenu(menu, items, handler, userData, self);
};
- this._createDropdownMenu(menuParent, command.name, true, populateFunction.bind(command));
+ this._createDropdownMenu(menuParent, command.name, nested, populateFunction.bind(command));
} else {
if (renderType === "tool") { //$NON-NLS-0$
id = "tool" + command.id + i; //$NON-NLS-0$ // using the index ensures unique ids within the DOM when a command repeats for each item
@@ -1196,7 +1199,6 @@ define(['i18n!orion/nls/messages', 'require', 'orion/uiUtils', 'orion/PageUtil',
*/
_makeLink: function(parent, context, aClass, position) {
var element = document.createElement("a"); //$NON-NLS-0$
- element.tabIndex = 0;
element.id = this.name;
if (aClass) {
element.classList.add(aClass); //$NON-NLS-0$
View
3  lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/commonHTMLFragments.js
@@ -90,6 +90,9 @@ define(['i18n!orion/nls/messages', 'require', 'orion/webui/littlelib'],
'<ul class="layoutLeft commandList pageActions" id="pageActions"></ul>' + //$NON-NLS-0$
'<ul class="layoutLeft commandList pageActions" id="selectionTools"></ul>' + //$NON-NLS-0$
'<img class="layoutRight progressPane" src="'+ require.toUrl("images/none.png") +'" id="progressPane" tabindex="0" role="progressbar" aria-label="Operations - Press spacebar to show current operations"></img>' + //$NON-NLS-4$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ '<div class="layoutRight" style="padding-left:7px;padding-right:7px;margin-top:3px;" id="settingsTab" style="visibility:hidden;">' +
+ '<div class="layoutRight settings core-sprite-settings" id="settingsAction" role="settings" aria-live="off" style="visibility:hidden;"></div>' + //$NON-NLS-0$
+ '</div>' +
'<div class="layoutRight status" id="statusPane" role="status" aria-live="off"></div>' + //$NON-NLS-0$
'<ul class="layoutRight commandList pageActions" id="pageNavigationActions"></ul>' + //$NON-NLS-0$
'<div id="notificationArea" class="layoutLeft layoutBlock slideContainer">' + //$NON-NLS-0$
View
46 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/editorCommands.js
@@ -149,52 +149,6 @@ exports.EditorCommandFactory = (function() {
this.commandService.addCommand(saveCommand);
this.commandService.registerCommandContribution(this.toolbarId, "orion.save", 1, null, false, new mCommands.CommandKeyBinding('s', true)); //$NON-NLS-1$ //$NON-NLS-0$
-
-
- if( document.webkitCancelFullScreen || document.mozCancelFullScreen ){
-
- editor.getTextView().setAction("fullscreen", dojo.hitch(this, function (){
- var element = document.getElementById('innerPanels');
-
- if( element.webkitRequestFullScreen ){
- element.webkitRequestFullScreen();
- }else if( element.mozRequestFullScreen ){
- element.mozRequestFullScreen();
- }
- }));
-
- editor.getTextView().setAction("normalscreen", dojo.hitch(this, function (){
- var element = document.getElementById('innerPanels');
- if( document.webkitCancelFullScreen ){
- document.webkitCancelFullScreen();
- }else if( document.mozCancelFullScreen ){
- document.mozCancelFullScreen();
- }
- }));
-
-
- var fullScreenCommand = new mCommands.Command({
-
- name: 'Fullscreen',
- tooltip: 'Edit in full screen mode',
- id: "orion.fullscreen",
- callback: function(data){
-
- if( data.domNode.innerHTML === 'Fullscreen' ){
- data.domNode.innerHTML = 'Exit Fullscreen';
- data.items.getTextView().invokeAction("fullscreen");
- }else{
- data.domNode.innerHTML = 'Fullscreen';
-
- data.items.getTextView().invokeAction("normalscreen");
- }
- }
- });
-
- this.commandService.addCommand(fullScreenCommand);
- this.commandService.registerCommandContribution(this.toolbarId, "orion.fullscreen", 1, null, false, new mCommands.CommandKeyBinding('u', true)); //$NON-NLS-1$ //$NON-NLS-0$
-
- }
// page navigation commands (go to line)
var lineParameter = new mCommands.ParametersDescription([new mCommands.CommandParameter('line', 'number', 'Line:')], {hasOptionalParameters: false}, //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
View
96 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/globalCommands.js
@@ -594,6 +594,101 @@ define(['i18n!orion/nls/messages', 'require', 'dojo', 'dijit', 'orion/commonHTML
}
}
+ function isDescendant(parent, child) {
+ var node = child.parentNode;
+ while (node !== null) {
+ if (node === parent) {
+ return true;
+ }
+ node = node.parentNode;
+ }
+ return false;
+ }
+
+
+ /* This function adds a settings dialog to a page. It adds it so that
+ a settings gear will appear at the right hand side */
+
+ function addSettings( settings ){
+ var settingsNode = document.getElementById("settingsTab");
+ var settingsButton = document.getElementById("settingsAction");
+ var CLICKED = false;
+
+ settingsNode.style.visibility = '';
+ settingsButton.style.visibility = '';
+ settingsButton.onclick = function(){
+
+ if( !CLICKED ){
+
+ CLICKED = true;
+
+ var TAB_HEIGHT = 24;
+ var TAB_WIDTH = 25;
+ var PANEL_HEIGHT = 150;
+ var PANEL_WIDTH = 220;
+ var BORDER_RADIUS = '3px';
+ var COLOR = '#555';
+
+ settingsNode.style.backgroundColor = COLOR;
+ settingsNode.style.zIndex = '99';
+ settingsNode.style.borderTopRightRadius = BORDER_RADIUS;
+ settingsNode.style.borderTopLeftRadius = BORDER_RADIUS;
+
+ settingsButton.className = "core-sprite-settings-white";
+
+ settingsNode.id = 'settingsNode';
+ settingsButton.id = 'settingsButton';
+
+ var rightPane = document.getElementById( 'innerPanels' );
+ var rpBox = rightPane.getBoundingClientRect();
+ var box = settingsNode.getBoundingClientRect();
+ var leftPane = document.getElementById( 'outlineContainer' );
+ var lpBox = leftPane.getBoundingClientRect();
+
+ var panel = document.createElement( 'div' );
+ panel.className = 'settingsPanel';
+ panel.style.width = PANEL_WIDTH + 'px';
+ panel.style.height = PANEL_HEIGHT + 'px';
+ panel.style.backgroundColor = COLOR;
+ panel.style.zIndex = '99';
+ panel.style.top = box.top - rpBox.top + TAB_HEIGHT -4 + 'px';
+ panel.id = 'settingsPanel';
+ panel.style.borderTopLeftRadius = BORDER_RADIUS;
+ panel.style.borderBottomRightRadius = BORDER_RADIUS;
+ panel.style.borderBottomLeftRadius = BORDER_RADIUS;
+
+ rightPane.appendChild( panel );
+
+ settings.appendTo( panel );
+
+ var listener = window.addEventListener("click", function(event) {
+
+ switch( event.target.id ){
+
+ case 'settingsPanel':
+ case 'settingsButton':
+ case 'settingsNode':
+ break;
+
+ default:
+
+ if( !isDescendant( panel, event.target ) ){
+ settingsButton.className = "core-sprite-settings";
+ settingsNode.style.backgroundColor = 'white';
+
+ rightPane.removeChild( panel );
+ CLICKED = false;
+
+ settings.destroy();
+ window.removeEventListener( listener );
+ }
+
+ break;
+ }
+ }, false);
+ }
+ };
+ }
/**
* Generates the banner at the top of a page.
@@ -1060,6 +1155,7 @@ define(['i18n!orion/nls/messages', 'require', 'dojo', 'dijit', 'orion/commonHTML
//return the module exports
return {
+ addSettings: addSettings,
generateBanner: generateBanner,
getToolbarElements: getToolbarElements,
layoutToolbarElements: layoutToolbarElements,
View
2  lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/outliner.js
@@ -228,7 +228,7 @@ define(['i18n!orion/nls/messages', 'dojo', 'orion/uiUtils', 'orion/section', 'or
for (var i=0; i < this.outlineProviders.length; i++) {
var provider = this.outlineProviders[i],
name = provider.displayName || provider.getProperty("name") || (provider.name + provider.serviceId) || "undefined", //$NON-NLS-1$ //$NON-NLS-0$
- prefix = (provider.getProperty("id") === this.providerId) ? "&bull; " : ""; //$NON-NLS-1$ //$NON-NLS-0$
+ prefix = (provider.getProperty("id") === this.providerId) ? "* " : ""; //$NON-NLS-1$ //$NON-NLS-0$
choices.push({
name: prefix + name,
callback: dojo.hitch(this, this.setSelectedProvider, provider)});
View
12 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/searchAndReplace/textSearcher.js
@@ -371,8 +371,16 @@ orion.TextSearcher = (function() {
end = result.end;
}
}
- editor.setText(newStr, start, end);
- editor.setSelection(start , start + newStr.length, true);
+ if (this._useRegExp) {
+ var newStrWithSubstitutions = editor.getText().substring(start, end).replace(new RegExp(searchStr), newStr);
+ if (newStrWithSubstitutions) {
+ editor.setText(newStrWithSubstitutions, start, end)
+ editor.setSelection(start, start + newStrWithSubstitutions.length, true);
+ }
+ } else {
+ editor.setText(newStr, start, end);
+ editor.setSelection(start, start + newStr.length, true);
+ }
this.endUndo();
if (this._findAfterReplace && searchStr){
this._doFind(searchStr, this.getSearchStartIndex(false), false, this._wrapSearch);
View
2  lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/sites/siteClient.js
@@ -57,6 +57,8 @@ define(['i18n!orion/sites/nls/messages', 'require', 'orion/Deferred', 'orion/fil
this._selfHost = siteServiceRef.getProperty('canSelfHost'); //$NON-NLS-0$
this._sitePattern = siteServiceRef.getProperty('sitePattern'); //$NON-NLS-0$
this._filePattern = siteServiceRef.getProperty('filePattern'); //$NON-NLS-0$
+ this._name = siteServiceRef.getProperty('name'); //$NON-NLS-0$
+ this._id = siteServiceRef.getProperty('id'); //$NON-NLS-0$
this._getService = function() {
return this._siteService;
View
34 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/sites/sitesExplorer.js
@@ -9,9 +9,9 @@
* Contributors: IBM Corporation - initial API and implementation
******************************************************************************/
/*global define document*/
-define(['i18n!orion/sites/nls/messages', 'orion/i18nUtil', 'dojo', 'orion/explorers/explorer', 'orion/Deferred', 'orion/commands', 'orion/globalCommands',
+define(['i18n!orion/sites/nls/messages', 'orion/i18nUtil', 'dojo', 'orion/explorers/explorer', 'orion/Deferred', 'orion/commands', 'orion/section', 'orion/globalCommands',
'orion/selection', 'orion/sites/siteUtils', 'orion/explorers/navigationUtils', 'orion/sites/siteClient', 'orion/sites/siteCommands', 'orion/treetable'],
- function(messages, i18nUtil, dojo, mExplorer, Deferred, mCommands, mGlobalCommands, mSelection, mSiteUtils, mNavUtils, mSiteClient, mSiteCommands, treetable) {
+ function(messages, i18nUtil, dojo, mExplorer, Deferred, mCommands, mSection, mGlobalCommands, mSelection, mSiteUtils, mNavUtils, mSiteClient, mSiteCommands, treetable) {
var SiteServicesExplorer, SitesRenderer, SiteTreeModel;
/**
@@ -61,7 +61,11 @@ define(['i18n!orion/sites/nls/messages', 'orion/i18nUtil', 'dojo', 'orion/explor
if (siteServices.length > 0) {
siteServices[0].getSiteConfigurations().then(
function(/**Array*/ siteConfigurations) {
- result.push.apply(result, siteConfigurations);
+ var item = {};
+ item.siteService = siteServices[0];
+ item.siteConfigurations = siteConfigurations;
+
+ result.push(item);
that._getSiteConfigurations(siteServices.slice(1), result, deferred);
}
);
@@ -103,7 +107,22 @@ define(['i18n!orion/sites/nls/messages', 'orion/i18nUtil', 'dojo', 'orion/explor
commandService.registerCommandContribution(that.defaultActionWrapperId, 'orion.site.start', 20); //$NON-NLS-0$
commandService.registerCommandContribution(that.defaultActionWrapperId, 'orion.site.stop', 30); //$NON-NLS-0$
- that.createTree(that.parentId, new SiteTreeModel(siteConfigurations), {setFocus: true});
+ for (var i=0; i<siteConfigurations.length; i++){
+
+ if (siteConfigurations.length > 1){
+ var titleWrapper = new mSection.Section(dojo.byId(that.parentId), {
+ id: siteConfigurations[i].siteService._id + "_Section", //$NON-NLS-0$
+ title: siteConfigurations[i].siteService._name,
+ content: '<div id="' + siteConfigurations[i].siteService._id + '_Node" class="mainPadding"></list>', //$NON-NLS-1$ //$NON-NLS-0$
+ canHide: true
+ });
+ } else {
+ var contentParent = dojo.create("div", {"role": "region", "class":"sectionTable"}, dojo.byId(that.parentId), "last");
+ contentParent.innerHTML = '<div id="' + siteConfigurations[i].siteService._id + '_Node" class="mainPadding"></div>'; //$NON-NLS-1$ //$NON-NLS-0$
+ }
+
+ that.createTree(siteConfigurations[i].siteService._id + "_Node", new SiteTreeModel(siteConfigurations[i].siteConfigurations), {setFocus: true});
+ }
// TODO should show Create per each site service
that._updatePageActions(that.registry, siteServiceRefs[0]); //$NON-NLS-1$ //$NON-NLS-0$
@@ -137,10 +156,13 @@ define(['i18n!orion/sites/nls/messages', 'orion/i18nUtil', 'dojo', 'orion/explor
SiteServicesExplorer.prototype.refresh = function(){
var that = this;
-
+
this._getSiteConfigurations(this.siteClients).then(
function(siteConfigurations){
- that.createTree(that.parentId, new SiteTreeModel(siteConfigurations), {setFocus: true});
+ for (var i=0; i<siteConfigurations.length; i++){
+ dojo.empty(siteConfigurations[i].siteService._id + "_Node");
+ that.createTree(siteConfigurations[i].siteService._id + "_Node", new SiteTreeModel(siteConfigurations[i].siteConfigurations), {setFocus: true});
+ }
}
);
};
View
15 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/webui/dropdown.js
@@ -84,6 +84,7 @@ define(['require', 'orion/webui/littlelib'], function(require, lib) {
lib.addAutoDismiss([this._triggerNode, this._dropdownNode], this.close.bind(this));
this._hookedAutoDismiss = true;
}
+ this._positionDropdown();
this._triggerNode.classList.add("dropdownTriggerOpen"); //$NON-NLS-0$
this._dropdownNode.classList.add("dropdownMenuOpen"); //$NON-NLS-0$
items[0].focus();
@@ -92,6 +93,16 @@ define(['require', 'orion/webui/littlelib'], function(require, lib) {
return false;
},
+ _positionDropdown: function() {
+ this._dropdownNode.style.left = "";
+ var bounds = lib.bounds(this._dropdownNode);
+ var totalBounds = lib.bounds(document.documentElement);
+ if (bounds.left + bounds.width > totalBounds.left + totalBounds.width) {
+ var left = totalBounds.width - bounds.width - 4;
+ this._dropdownNode.style.left = left + "px"; //$NON-NLS-0$
+ }
+ },
+
/**
* Close the dropdown.
*/
@@ -147,9 +158,11 @@ define(['require', 'orion/webui/littlelib'], function(require, lib) {
if (event.keyCode === lib.KEY.UP && index > 0) {
index--;
items[index].focus();
+ lib.stop(event);
} else if (event.keyCode === lib.KEY.DOWN && index < items.length - 1) {
index++;
items[index].focus();
+ lib.stop(event);
} else if (event.keyCode === lib.KEY.ENTER || event.keyCode === lib.KEY.RIGHT) {
if (focusItem.classList.contains("dropdownTrigger") && focusItem.dropdown) { //$NON-NLS-0$
focusItem.dropdown.open();
@@ -157,10 +170,10 @@ define(['require', 'orion/webui/littlelib'], function(require, lib) {
}
} else if (event.keyCode === lib.KEY.LEFT && focusItem.parentNode.parentNode.classList.contains("dropdownMenuOpen")) { //$NON-NLS-0$
this.close(true);
+ lib.stop(event);
}
}
}
- lib.stop(event);
} else if (event.keyCode === lib.KEY.ESCAPE) {
this.close(true);
lib.stop(event);
View
15 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/webui/tooltip.js
@@ -153,7 +153,20 @@ define(['require', 'orion/webui/littlelib'], function(require, lib) {
return false;
}
}
-
+ if (left < 0) {
+ if (force) {
+ left = 4;
+ } else {
+ return false;
+ }
+ }
+ if (top < 0) {
+ if (force) {
+ top = 4;
+ } else {
+ return false;
+ }
+ }
this._tailBorder = document.createElement("span"); //$NON-NLS-0$
this._tailBorder.classList.add("tooltipTailBorderFrom"+position); //$NON-NLS-0$
this._tail = document.createElement("span"); //$NON-NLS-0$
View
9 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/widgets/UserMenu.js
@@ -52,8 +52,8 @@ define(['i18n!orion/widgets/nls/messages', 'require', 'orion/webui/littlelib', '
element.classList.add("dropdownMenuItem"); //$NON-NLS-0$
element.addEventListener("click", click, false); //$NON-NLS-0$
// onClick events do not register for spans when using the keyboard
- element.addEventListener("keydown", this, function(e) { //$NON-NLS-0$
- if (e.keyCode === lib.key.ENTER || e.charCode === lib.key.SPACE) {
+ element.addEventListener("keydown", function(e) { //$NON-NLS-0$
+ if (e.keyCode === lib.KEY.ENTER || e.charCode === lib.KEY.SPACE) {
click();
}
}, false);
@@ -117,7 +117,6 @@ define(['i18n!orion/widgets/nls/messages', 'require', 'orion/webui/littlelib', '
var link = doc.createElement("a"); //$NON-NLS-0$
link.role = "menuitem"; //$NON-NLS-0$
link.classList.add("dropdownMenuItem"); //$NON-NLS-0$
-
link.href = item.href;
link.textContent = item.textContent;
li.appendChild(link);
@@ -125,9 +124,9 @@ define(['i18n!orion/widgets/nls/messages', 'require', 'orion/webui/littlelib', '
});
if(this.keyAssistFunction){
- var keyAssist = document.createElement("li");//$NON-NLS-0$
+ var keyAssist = document.createElement("li"); //$NON-NLS-0$
var element = this._makeMenuItem(messages["Keyboard Shortcuts"], this.keyAssistFunction);
- element.classList.add("key-assist-menuitem");
+ element.classList.add("key-assist-menuitem"); //$NON-NLS-0$
keyAssist.appendChild(element);
getCategory(0).appendChild(keyAssist);
}
View
25 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/widgets/themes/ThemeBuilder.js
@@ -5,7 +5,6 @@
* 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: Anton McConville - IBM Corporation - initial API and implementation
******************************************************************************/
/*global dojo dijit widgets orion window console define localStorage*/
@@ -75,11 +74,6 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/c
this.commandService = args.commandService;
this.preferences = args.preferences;
-
- if( args.setFont ){
-
-
- }
this.initializeStorage();
@@ -683,16 +677,6 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/c
var orderedShapes = [];
-// Array.prototype.sortByElement = function(e){
-// return this.sort(function(a,b){
-// if( a[e] && b[e] ){
-// return (a[e] > b[e]) ? 1 : (a[e] < b[e]) ? -1 : 0;
-// }else return 1;
-// });
-// }
-//
-// this.dataset.shapes.sortByElement( 'order' );
-
for( var item in this.dataset.shapes ){
if( this.settings && this.settings[ this.dataset.shapes[item].family ] ){
@@ -765,6 +749,7 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/c
if( !existingTheme ){
this.styles.push( newtheme );
}
+
themename = newtheme.name;
if( dojo.byId( 'themesaver' ).value ){
@@ -804,8 +789,6 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/c
OVERVIEW = true;
var data = this.themeData.getViewData();
this.drawOutlineData(data);
-// dojo.byId( 'pickercontainer' ).style.display = '';
-// dojo.byId( 'savecontainer' ).style.display = 'none';
dojo.byId( 'stringcontainer' ).style.display = 'none';
}
@@ -927,8 +910,7 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/c
/* Check to see if the Orion theme is in the themes preferences ... if it is,
then we don't need to populate again, otherwise we do need to populate. */
-
-
+
selection = prefs.get( 'selected' );
if(selection){ selection = JSON.parse( selection ); }
@@ -1064,8 +1046,7 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/c
var fontsizepicker = dijit.byId( 'fontsizepicker' );
if (fontsizepicker) {
fontsizepicker.destroyRecursive();
- }
-
+ }
}
ThemeBuilder.prototype.destroy = destroy;
View
319 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/widgets/themes/editor/MiniThemeChooser.js
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * @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: Anton McConville - IBM Corporation - initial API and implementation
+ ******************************************************************************/
+/*global dojo dijit widgets orion window console define localStorage*/
+/*jslint browser:true*/
+
+define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/commands', 'orion/globalCommands', 'orion/PageUtil', 'orion/widgets/themes/ThemeComponent', 'orion/widgets/themes/editor/ThemeData'],
+ function(messages, require, dojo, dijit, mCommands, mGlobalCommands, PageUtil, Component, ThemeData ) {
+
+ function MiniThemeChooser(preferences, textview){
+ this.preferences = preferences;
+ this.textview = textview;
+ this.themeData = new ThemeData.ThemeData();
+ this.initializeStorage();
+ }
+
+ MiniThemeChooser.prototype.template = '<div id="themeContainer">' +
+ '<div id="pickercontainer" style="display:block;">' +
+ '<span class="settingsPanelLabel">Chosen Theme:</span>' +
+ '<div id="themepicker"></div>' +
+ '</div>' +
+ '<div id="sizecontainer">' +
+ '<span class="settingsPanelLabel">Font Size:</span>' +
+ '<div id="fontsizepicker"></div>' +
+ '</div>' +
+ '</div>';
+
+ function appendTo( node ){
+ node.innerHTML = this.template;
+ this.addFontSizePicker();
+ this.addThemePicker();
+ }
+
+ MiniThemeChooser.prototype.appendTo = appendTo;
+
+ function selectTheme( name ){
+
+ var themeInfo = this.themeData.getThemeStorageInfo();
+ var themeData = this.themeData;
+ var selectedTheme;
+ var reload = false;
+ var settings;
+
+ if( name ){ reload = true; }
+
+ var builder = this;
+
+ /* Find the selected style details */
+
+ this.preferences.getPreferences(themeInfo.storage, 2).then(function(prefs){ //$NON-NLS-0$
+
+ var currentTheme = prefs.get( 'selected' );
+
+ if( !currentTheme && !name ){
+ name = themeInfo.defaultTheme;
+ var styleset = themeData.getStyles();
+ prefs.put( themeInfo.styleset, JSON.stringify(styleset) );
+ }
+
+ if( name ){
+
+ selectedTheme = { 'selected': name };
+
+ var styles = prefs.get( 'editorstyles' );
+
+ if( styles ){
+ styles = JSON.parse( styles );
+
+ for( var s in styles ){
+
+ if( styles[s].name === name ){
+
+ settings = styles[s];
+ break;
+ }
+ }
+ }
+
+ prefs.put( 'selected', JSON.stringify(selectedTheme) );
+ }
+
+ } );
+
+ /* Write the selected style details into storage */
+
+ this.preferences.getPreferences('/settings', 2).then(function(prefs){
+
+ if( settings ){
+ var font = {};
+ font.label = 'Font';
+ font.data = [ { label:'Family', value: 'Sans Serif', ui:'Font' },
+ { label:'Size', value: settings['fontSize'].value, ui:'Font' },
+ { label:'Color', value: settings['text'].value },
+ { label:'Background', value: settings['background'].value } ];
+
+ var subcategories = [ { element: 'fontFamily', value: 'sans serif' },
+ { element: 'fontSize', value: settings['fontSize'] },
+ { element: 'fontWeight', value: 'normal' },
+ { element: 'text', value: settings['text'] },
+ { element: 'background', value: settings['background'] },
+ { element: 'string', value: settings['string'] },
+ { element: 'annotationRuler', value: settings['annotationRuler'] },
+ { element: 'comment', value: settings['comment'] },
+ { element: 'keyword', value: settings['keyword'] },
+ { element: 'overviewRuler', value: settings['overviewRuler'] },
+ { element: 'annotationRuler', value: settings['annotationRuler'] },
+ { element: 'lineNumber', value: settings['lineNumber'] },
+ { element: 'currentLine', value: settings['currentLine'] },
+ { element: 'attribute', value: settings['attribute'] }
+ ];
+
+ prefs.put( 'JavaScript Editor', JSON.stringify(subcategories) );
+
+ if( reload ){
+ window.location.reload();
+ }
+ }
+ } );
+ }
+
+ MiniThemeChooser.prototype.selectTheme = selectTheme;
+
+ function initializeStorage(){
+ var builder = this;
+ var themeInfo = this.themeData.getThemeStorageInfo();
+ var themeData = this.themeData;
+ this.selectTheme();
+ }
+
+ MiniThemeChooser.prototype.initializeStorage = initializeStorage;
+
+ function selectFontSize( size ){
+
+ var themeInfo = this.themeData.getThemeStorageInfo();
+
+ var tv = this.textview;
+
+ this.preferences.getPreferences('/settings', 2).then(function(prefs){
+
+ var styles = prefs.get( 'JavaScript Editor' );
+
+ if(styles){
+ styles = JSON.parse( styles );
+
+ for( var s in styles ){
+ if( styles[s].element === 'fontSize' ){
+ styles[s].value = size;
+ break;
+ }
+ }
+ }
+
+ prefs.put( 'JavaScript Editor', JSON.stringify(styles) );
+
+ /* First cut - going to reload the page, will work on making this
+ happen dynamically. First of all I want to makes sure the
+ infrastructure is working to add settings and operate
+ the settings panel */
+
+ window.location.reload();
+
+ /* Just setting the style is not enough - having trouble
+ closing in on the right hooks within the editor
+ to update the view
+
+ var nodes = document.querySelectorAll( '.userTheme' );
+ for( var item in nodes ){
+ nodes[item].style.fontSize = size;
+ } */
+
+ });
+ }
+
+ MiniThemeChooser.prototype.selectFontSize = selectFontSize;
+
+ function addFontSizePicker(){
+
+ var MiniThemeChooser = this;
+
+ var currentSize = '10pt';
+
+ var themeInfo = this.themeData.getThemeStorageInfo();
+
+ this.preferences.getPreferences('/settings', 2).then(function(prefs){
+
+ var styles = prefs.get( 'JavaScript Editor' );
+
+ if(styles){
+ styles = JSON.parse( styles );
+
+ for( var s in styles ){
+ if( styles[s].element === 'fontSize' ){
+ currentSize = styles[s].value;
+ break;
+ }
+ }
+ }
+
+ var picker = document.getElementById( 'fontsizepicker' );
+
+ var options = [];
+
+ for( var size = 8; size < 19; size++ ){
+
+ var set = {
+ value: size + 'pt',
+ label: size + 'pt'
+ };
+
+ if( set.label === currentSize ){ set.selected = 'true'; }
+
+ this.fontSize = currentSize;
+
+ options.push(set);
+ }
+
+ this.sizeSelect = new orion.widgets.settings.Select( {options:options}, picker );
+ this.sizeSelect.setStorageItem = dojo.hitch( MiniThemeChooser, 'selectFontSize' );
+
+ });
+ }
+
+ MiniThemeChooser.prototype.addFontSizePicker = addFontSizePicker;
+
+ function addThemePicker(){
+
+ var options = [];
+
+ var MiniThemeChooser = this;
+
+ var selection;
+
+ var builder = this;
+
+ var themeInfo = this.themeData.getThemeStorageInfo();
+
+ this.preferences.getPreferences(themeInfo.storage, 2).then(dojo.hitch(this, function(prefs){ //$NON-NLS-0$
+
+ /* Check to see if the Orion theme is in the themes preferences ... if it is,
+ then we don't need to populate again, otherwise we do need to populate. */
+
+ selection = prefs.get( 'selected' );
+
+ if(selection){ selection = JSON.parse( selection ); }
+
+ var styles = prefs.get( themeInfo.styleset );
+
+ if(styles){ styles = JSON.parse( styles ); }
+
+ if(!styles){
+
+ /* If we're in this condition, then the themes are not in local storage yet.
+ Going to make sure */
+
+ styles = builder.styleset;
+ }
+
+ if(!selection) {
+ selection = { 'selected':'Prospecto' };
+ }
+
+ if( styles ){
+
+ for( var theme in styles ){
+
+ var set = {
+ value: styles[theme].name,
+ label: styles[theme].name
+ };
+
+ if( selection ){
+ if( styles[theme].name === selection.selected ){
+ set.selected = true;
+ }
+ }
+
+ options.push(set);
+
+ MiniThemeChooser.styles = styles;
+ }
+ }
+
+ var picker = document.getElementById( 'themepicker' );
+
+ this.themeSelect = new orion.widgets.settings.Select( {options:options}, picker );
+ this.themeSelect.setStorageItem = dojo.hitch( MiniThemeChooser, 'selectTheme' );
+
+ } ));
+ }
+
+ MiniThemeChooser.prototype.addThemePicker = addThemePicker;
+
+ function destroy(){
+ var picker = dijit.byId( 'themepicker' );
+ if (picker) {
+ picker.destroyRecursive();
+ }
+
+ var fontsizepicker = dijit.byId( 'fontsizepicker' );
+ if (fontsizepicker) {
+ fontsizepicker.destroyRecursive();
+ }
+ }
+
+ MiniThemeChooser.prototype.destroy = destroy;
+
+ return{
+ MiniThemeChooser:MiniThemeChooser,
+ destroy:destroy
+ };
+ }
+);
View
10 lib/orion.client/bundles/org.eclipse.orion.client.core/web/orion/widgets/themes/editor/ThemeData.js
@@ -49,7 +49,7 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit'],
StyleSet.prototype.overviewRuler = '#FBFBFB';
StyleSet.prototype.lineNumberOdd = 'white';
StyleSet.prototype.lineNumberEven = 'white';
- StyleSet.prototype.lineNumber = '#bfbfbf';
+ StyleSet.prototype.lineNumber = 'silver';
StyleSet.prototype.tag = 'darkorange';
StyleSet.prototype.attribute = 'cadetBlue';
StyleSet.prototypefontSize = '10pt';
@@ -88,9 +88,9 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit'],
prospecto.text = 'darkSlateGray';
prospecto.string = 'cornFlowerBlue';
prospecto.overviewRuler = 'white';
- prospecto.lineNumberOdd = 'darkSlateGray';
- prospecto.lineNumberEven = 'darkSlateGray';
- prospecto.lineNumber = 'darkSlateGray';
+ prospecto.lineNumberOdd = 'silver';
+ prospecto.lineNumberEven = 'silver';
+ prospecto.lineNumber = 'silver';
prospecto.currentLine = '#EAF2FE';
prospecto.tag = 'darkorange';
prospecto.attribute = 'cadetBlue';
@@ -703,8 +703,6 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit'],
ThemeData.prototype.importTheme = importTheme;
function processSettings( settings, preferences ){
-
- console.log( settings );
if( !settings['fontSize'] ){
settings['fontSize'] = { value:'10pt' };
View
56 lib/orion.client/bundles/org.eclipse.orion.client.core/web/plugins/filePlugin/fileImpl.js
@@ -484,63 +484,43 @@ define(["orion/Deferred", "orion/xhr", "orion/es5shim"], function(Deferred, xhr)
function _call2(method, url, headers, body) {
var d = new Deferred(); // create a promise
var xhr = new XMLHttpRequest();
- var header;
try {
xhr.open(method, url);
- if (headers !== null) {
- for (header in headers) {
- if (headers.hasOwnProperty(header)) {
- xhr.setRequestHeader(header, headers[header]);
- }
- }
+ if (headers) {
+ Object.keys(headers).forEach(function(header){
+ xhr.setRequestHeader(header, headers[header]);
+ });
}
xhr.responseType = "arraybuffer";
xhr.send(body);
- xhr.onreadystatechange = function() {
- if (xhr.readyState === 4) {
- d.resolve({
- status: xhr.status,
- statusText: xhr.statusText,
- headers: xhr.getAllResponseHeaders(),
- response: xhr.response //builder.getBlob()
- });
- }
+ xhr.onload = function() {
+ d.resolve({
+ status: xhr.status,
+ statusText: xhr.statusText,
+ headers: xhr.getAllResponseHeaders(),
+ response: xhr.response //builder.getBlob()
+ });
};
} catch (e) {
d.reject(e);
}
return d; // return the promise immediately
- }
-
- window.BlobBuilder = window.MozBlobBuilder || window.WebKitBlobBuilder || window.BlobBuilder;
- if (window.BlobBuilder) {
+ }
+
+ if (window.Blob) {
FileServiceImpl.prototype.readBlob = function(location) {
- return _call2("GET", location).then(function(response) {
- if (window.WebKitBlobBuilder) { // webkit works better with blobs, FF with ArrayBuffers
- var builder = new BlobBuilder();
- builder.append(response.response);
- return builder.getBlob();
- }
- return response.response;
- });
+ return _call2("GET", location).then(function(result) {
+ return result.response;
+ });
};
-
+
FileServiceImpl.prototype.writeBlob = function(location, contents, args) {
var headerData = {};
if (args && args.ETag) {
headerData["If-Match"] = args.ETag;
}
-
- if (!contents.type) { // webkit works better with blobs, FF with ArrayBuffers
- var builder = new BlobBuilder();
- if (contents) {
- builder.append(contents);
- }
- contents = builder.getBlob();
- }
return _call2("PUT", location, headerData, contents);
};
-
}
return FileServiceImpl;
View
56 lib/orion.client/bundles/org.eclipse.orion.client.core/web/plugins/filePlugin/webdavImpl.js
@@ -485,63 +485,43 @@ eclipse.DAVFileServiceImpl= (function() {
function _call2(method, url, headers, body) {
var d = new dojo.Deferred(); // create a promise
var xhr = new XMLHttpRequest();
- var header;
try {
xhr.open(method, url);
- if (headers !== null) {
- for (header in headers) {
- if (headers.hasOwnProperty(header)) {
- xhr.setRequestHeader(header, headers[header]);
- }
- }
+ if (headers) {
+ Object.keys(headers).forEach(function(header){
+ xhr.setRequestHeader(header, headers[header]);
+ });
}
xhr.responseType = "arraybuffer";
xhr.send(body);
- xhr.onreadystatechange = function() {
- if (xhr.readyState === 4) {
- d.resolve({
- status: xhr.status,
- statusText: xhr.statusText,
- headers: xhr.getAllResponseHeaders(),
- response: xhr.response //builder.getBlob()
- });
- }
+ xhr.onload = function() {
+ d.resolve({
+ status: xhr.status,
+ statusText: xhr.statusText,
+ headers: xhr.getAllResponseHeaders(),
+ response: xhr.response //builder.getBlob()
+ });
};
} catch (e) {
d.reject(e);
}
return d; // return the promise immediately
- }
-
- window.BlobBuilder = window.MozBlobBuilder || window.WebKitBlobBuilder || window.BlobBuilder;
- if (window.BlobBuilder) {
+ }
+
+ if (window.Blob) {
DAVFileServiceImpl.prototype.readBlob = function(location) {
- return _call2("GET", location).then(function(response) {
- if (window.WebKitBlobBuilder) { // webkit works better with blobs, FF with ArrayBuffers
- var builder = new window.BlobBuilder();
- builder.append(response.response);
- return builder.getBlob();
- }
- return response.response;
- });
+ return _call2("GET", location).then(function(result) {
+ return result.response;
+ });
};
-
+
DAVFileServiceImpl.prototype.writeBlob = function(location, contents, args) {
var headerData = {};
if (args && args.ETag) {
headerData["If-Match"] = args.ETag;
}
-
- if (!contents.type) { // webkit works better with blobs, FF with ArrayBuffers
- var builder = new window.BlobBuilder();
- if (contents) {
- builder.append(contents);
- }
- contents = builder.getBlob();
- }
return _call2("PUT", location, headerData, contents);
};
-
}
return DAVFileServiceImpl;
}());
View
13 lib/orion.client/bundles/org.eclipse.orion.client.core/web/shell/shellPage.js
@@ -15,9 +15,9 @@
define(["i18n!orion/shell/nls/messages", "require", "dojo", "orion/bootstrap", "orion/commands", "orion/fileClient", "orion/searchClient", "orion/globalCommands",
"orion/widgets/Shell", "orion/treetable", "shell/shellPageFileService", "shell/paramType-file", "shell/paramType-plugin", "shell/paramType-service",
- "orion/i18nUtil", "shell/extensionCommands", "orion/contentTypes", "orion/pluginregistry", "orion/PageUtil", "orion/URITemplate"],
+ "orion/i18nUtil", "shell/extensionCommands", "orion/contentTypes", "orion/pluginregistry", "orion/PageUtil", "orion/URITemplate", "orion/Deferred"],
function(messages, require, dojo, mBootstrap, mCommands, mFileClient, mSearchClient, mGlobalCommands, mShell, mTreeTable, mShellPageFileService, mFileParamType,
- mPluginParamType, mServiceParamType, i18nUtil, mExtensionCommands, mContentTypes, mPluginRegistry, PageUtil, URITemplate) {
+ mPluginParamType, mServiceParamType, i18nUtil, mExtensionCommands, mContentTypes, mPluginRegistry, PageUtil, URITemplate, Deferred) {
var shellPageFileService, fileClient, output;
var hashUpdated = false;
@@ -545,13 +545,20 @@ define(["i18n!orion/shell/nls/messages", "require", "dojo", "orion/bootstrap", "
function contributedExecFunc(service) {
if (typeof(service.callback) === "function") { //$NON-NLS-0$
return function(args, context) {
- var promise = context.createPromise();
+ // Use orion/Deferred since it supports progress; gcli/promise does not.
+ //var promise = context.createPromise();
+ var promise = new Deferred();
service.callback(args).then(
function(result) {
promise.resolve(result);
},
function(error) {
resolveError(promise, error);
+ },
+ function(data) {
+ if (typeof promise.progress === "function") {
+ promise.progress(data);
+ }
}
);
return promise;
View
8 lib/orion.client/bundles/org.eclipse.orion.client.core/web/shell/shellPageFileService.js
@@ -182,7 +182,7 @@ define(["dojo", "orion/bootstrap", "orion/fileClient"], function (dojo, mBootstr
/** @private */
_retrieveNode: function(node, func, errorFunc) {
- if (node.Parents && node.Children) {
+ if (node.parent && node.Children) {
if (func) {
func(node);
}
@@ -215,13 +215,13 @@ define(["dojo", "orion/bootstrap", "orion/fileClient"], function (dojo, mBootstr
node.parent = self.rootNode;
} else if (node.Parents.length === 0) {
/* node's parent is the root of a file service */
- var index = node.Location.indexOf(self.SEPARATOR, 1);
- var location = node.Location.substring(0, index);
+ var location = fileClient.fileServiceRootURL(node.Location);
fileClient.loadWorkspace(location).then(
function(parent) {
parent.parent = self.rootNode;
node.parent = parent;
- });
+ }
+ );
} else {
node.parent = node.Parents[0];
for (var i = 0; i < node.Parents.length - 1; i++) {
View
2  lib/orion.client/bundles/org.eclipse.orion.client.editor/web/examples/textview/textStylerOptions.js
@@ -131,10 +131,8 @@ define("examples/textview/textStylerOptions", ['orion/bootstrap', 'orion/textvie
if (className) {
var color = elements[settingName];
- var weight = elements['fontWeight'];
result.push("." + theme + " ." + className + " {");
result.push("\tcolor: " + color + ";");
- result.push("\tfont-weight: " + weight + ";");
result.push("}");
}
}
View
1  lib/orion.client/bundles/org.eclipse.orion.client.editor/web/orion/textview/rulers.css
@@ -18,6 +18,7 @@
/* Styles for the line number ruler */
.rulerLines {
+ color: silver;
}
.rulerLines.even
.rulerLines.odd {
View
43 lib/orion.client/bundles/org.eclipse.orion.client.editor/web/orion/textview/textView.js
@@ -473,7 +473,7 @@ define("orion/textview/textView", ['orion/textview/textModel', 'orion/textview/k
}
var spacesCount = tabSize - (data.tabOffset % tabSize);
if (spacesCount > 0) {
- //TODO hack to preserve text length in getDOMText()
+ //TODO hack to preserve tabs in getDOMText()
var spaces = "\u00A0"; //$NON-NLS-0$
for (var i = 1; i < spacesCount; i++) {
spaces += " "; //$NON-NLS-0$
@@ -4720,22 +4720,39 @@ define("orion/textview/textView", ['orion/textview/textModel', 'orion/textview/k
var lineChild = child.firstChild;
var text = "", offset = 0;
while (lineChild) {
- var textNode = lineChild.firstChild;
- while (textNode) {
- if (offsetNode === textNode) {
- offset = text.length;
- }
- if (lineChild.ignoreChars) {
- for (var i = 0; i < textNode.length; i++) {
- var ch = textNode.data.substring(i, i + 1);
- if (ch !== " " && ch !== "\u200C") { //$NON-NLS-1$ //$NON-NLS-0$
- text += ch === "\u00A0" ? "\t" : ch; //$NON-NLS-1$ //$NON-NLS-0$
+ var textNode;
+ if (lineChild.ignoreChars) {
+ textNode = lineChild.lastChild;
+ var ignored = 0, childText = [], childOffset = -1;
+ while (textNode) {
+ var data = textNode.data;
+ for (var i = data.length - 1; i >= 0; i--) {
+ var ch = data.substring(i, i + 1);
+ if (ignored < lineChild.ignoreChars && (ch === " " || ch === "\u200C" || ch === "\uFEFF")) { //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
+ ignored++;
+ } else {
+ childText.push(ch === "\u00A0" ? "\t" : ch); //$NON-NLS-1$ //$NON-NLS-0$
}
}
- } else {
+ if (offsetNode === textNode) {
+ childOffset = childText.length;
+ }
+ textNode = textNode.previousSibling;
+ }
+ childText = childText.reverse().join("");
+ if (childOffset !== -1) {
+ offset = text.length + childText.length - childOffset;
+ }
+ text += childText;
+ } else {
+ textNode = lineChild.firstChild;
+ while (textNode) {
+ if (offsetNode === textNode) {
+ offset = text.length;
+ }
text += textNode.data;
+ textNode = textNode.nextSibling;
}
- textNode = textNode.nextSibling;
}
lineChild = lineChild.nextSibling;
}
Please sign in to comment.