diff options
author | Libing Wang <libingw@ca.ibm.com> | 2016-05-02 17:42:32 -0400 |
---|---|---|
committer | Libing Wang <libingw@ca.ibm.com> | 2016-05-02 17:42:32 -0400 |
commit | e5aa63ea7e1b54f88185385f0785b2758e9b1fe1 (patch) | |
tree | 76194f733722c441c3fdbe7df1252560edc5c1cd | |
parent | 088c957e317704e98208140241c550f55e50ac6a (diff) | |
download | org.eclipse.orion.client-origin/stable_20160502.zip org.eclipse.orion.client-origin/stable_20160502.tar.gz org.eclipse.orion.client-origin/stable_20160502.tar.bz2 |
Bug 491800 - codeEdit: Need a way to pass statusReporter during widget creation.origin/stable_20160502
-rw-r--r-- | bundles/org.eclipse.orion.client.ui/web/embeddedEditor/demo/built-codeEdit.js | 15 | ||||
-rw-r--r-- | bundles/org.eclipse.orion.client.ui/web/embeddedEditor/helper/editorSetup.js | 6 |
2 files changed, 17 insertions, 4 deletions
diff --git a/bundles/org.eclipse.orion.client.ui/web/embeddedEditor/demo/built-codeEdit.js b/bundles/org.eclipse.orion.client.ui/web/embeddedEditor/demo/built-codeEdit.js index e5eb6a0..68301a7 100644 --- a/bundles/org.eclipse.orion.client.ui/web/embeddedEditor/demo/built-codeEdit.js +++ b/bundles/org.eclipse.orion.client.ui/web/embeddedEditor/demo/built-codeEdit.js @@ -40,7 +40,7 @@ Deferred) { var embeddedEditor = new mEmbeddedEditor({
_defaultPlugins: defaultPluginURLs,
//defaultPlugins: [],
- //editorConfig: {showWhitespaces: true, zoomRuler: true, zoomRulerLocalVisible: true},
+ editorConfig: {showWhitespaces: true, zoomRuler: true, zoomRulerLocalVisible: true},
toolbarId: "__toolbar__"/*,
userPlugins:["editorCommandsPlugin.html"]*/});
var cto = {
@@ -120,7 +120,18 @@ Deferred) { }
return new Deferred().resolve(oc);
}
- embeddedEditor.create({parent: "embeddedEditor"}).then(function(editorViewer) {
+
+ var statusReporter = function(message, type, isAccessible) {
+ if (type === "progress") {
+ console.log( "Progress message: " + message);
+ } else if (type === "error") { //$NON-NLS-0$
+ console.log( "Error message: " + message);
+ } else {
+ console.log( "Normal message: " + message);
+ }
+ };
+
+ embeddedEditor.create({parent: "embeddedEditor", statusReporter: statusReporter}).then(function(editorViewer) {
document.getElementById("progressMessageDiv").textContent = "Plugins loaded!";
editorViewer.setContents(contents, "application/javascript");
//editorViewer.inputManager.setAutoSaveTimeout(-1);
diff --git a/bundles/org.eclipse.orion.client.ui/web/embeddedEditor/helper/editorSetup.js b/bundles/org.eclipse.orion.client.ui/web/embeddedEditor/helper/editorSetup.js index 3009220..809d176 100644 --- a/bundles/org.eclipse.orion.client.ui/web/embeddedEditor/helper/editorSetup.js +++ b/bundles/org.eclipse.orion.client.ui/web/embeddedEditor/helper/editorSetup.js @@ -61,7 +61,8 @@ define([ },
- defaultOptions: function(parentId) {
+ defaultOptions: function(options) {
+ var parentId = options.parent;
var model = new mTextModel.TextModel();
var id = idCounter.toString();
var context = Object.create(null);
@@ -78,6 +79,7 @@ define([ contentTypeRegistry: this._contentTypeRegistry,
editorCommands: this._editorCommands,
editorConfig: this._editorConfig,
+ statusReporter: options.statusReporter,
progressService: this._progressService,
inputManager: this._inputManager, // fake it
fileService: this._fileClient, // fake it
@@ -96,7 +98,7 @@ define([ createEditor: function(options, startupOptions) {
this.createInputManager();
- this.editorView = new mEditorView.EditorView(this.defaultOptions(options.parent));
+ this.editorView = new mEditorView.EditorView(this.defaultOptions(options));
idCounter++;
this.editorView.create();
this._inputManager.editor = this.editorView.editor;
|