Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"shorthand-resolver": "https://github.com/{{owner}}/{{package}}.git"
}
File renamed without changes.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"eqeqeq": true,
"forin": true,
"immed": true,
"latedef": true,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"noempty": true,
Expand Down
66 changes: 56 additions & 10 deletions apps/ide/src/dojoConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,38 @@
* limitations under the License.
*/

(function (global) {
(function (globalObject) {
'use strict';

// in electron, we should remove global.require & global.module
// to make dojo & other amd module work
// how can we detect that we're working in electron?
if (typeof(globalObject.process) === 'object' && typeof(globalObject.require) === 'function' &&
typeof(globalObject.module) === 'object') {
globalObject.nrequire = globalObject.require;
globalObject.nmodule = globalObject.module;
delete globalObject.require;
//noinspection JSAnnotator
delete globalObject.module;
globalObject.__ELECTRON_BROWSER__ = true;
}

var webidaLocale = decodeURIComponent(
document.cookie.replace(/(?:(?:^|.*;\s*)webida\.locale\s*\=\s*([^;]*).*$)|^.*$/, '$1')
);
global.dojoConfig = {
globalObject.dojoConfig = {
async: true,
baseUrl: '../../../bower_components',
parseOnLoad: false,
packages: [
{name: 'xstyle', location: './xstyle'},
{name: 'put-selector', location: './put-selector'},
{name: 'dijit', location: './dijit'},
{name: 'dojo', location: './dojo'},
{name: 'dojox', location: './dojox'},
{name: 'jquery', location: './jquery/dist', main: 'jquery.min'},
{name: 'put-selector', location: './put-selector'},
{name: 'showdown', location: './showdown/dist', main: 'showdown.min'},
{name: 'dojo', location: './dojo'},
{name: 'dijit', location: './dijit'},
{name: 'dojox', location: './dojox'}
{name: 'URIjs', location:'./URIjs/src', main:'URI.min'},
{name: 'xstyle', location: './xstyle'}
],
locale: ((webidaLocale === 'default') || (webidaLocale === '')) ?
(location.search.match(/locale=([\w\-]+)/) ? RegExp.$1 : 'en-us') : webidaLocale,
Expand All @@ -44,14 +59,45 @@
},
aliases: [
['text', 'dojo/text'],
['external/lodash/lodash.min', 'external/lodash/dist/lodash.min'], // new 4.x lodash changed bundle path.
['popup-dialog', 'webida-lib/widgets/dialogs/popup-dialog/PopupDialog'],
// TODO should use these below aliases for versioned resources
['webida', 'webida-lib/webida-0.3'],
['FSCache', 'webida-lib/FSCache-0.1'],
['plugin-manager', 'webida-lib/plugin-manager-0.1'],
['msg', 'webida-lib/msg.js'],
// diff_match_patch is used in codemirror
['diff_match_patch', '//cdnjs.cloudflare.com/ajax/libs/diff_match_patch/20121119/diff_match_patch.js']
['diff_match_patch', '//cdnjs.cloudflare.com/ajax/libs/diff_match_patch/20121119/diff_match_patch.js'],

// following server api will be removed when window.nrequire is true
// so, put these always at the end of aliases array
['webida-lib/server-api', 'webida-lib/webida-0.3'],
['webida-lib/server-pubsub', 'webida-lib/msg']
]
};

// twick requirejs alias to use new server-api when not using using legacy server
// &, for new server api, additional package 'webida-restful-api' is required.
if (window.location.href.indexOf('legacy=') < 0 ) {
var dojoConfig = globalObject.dojoConfig;
dojoConfig.packages.push( {
name: 'webida-service-client',
location: './webida-service-client',
main: 'webida-service-client-bundle'
});
dojoConfig.aliases.pop();
dojoConfig.aliases.pop();
dojoConfig.aliases.push(['webida-lib/server-api', 'webida-service-client']);
dojoConfig.aliases.push(['webida-lib/server-pubsub', 'webida-lib/server-pubsub-compat']);
dojoConfig.aliases.push(['top/site-config.json', 'top/site-config-desktop.json']);
dojoConfig.aliases.push(['urijs', 'URIjs']);
}

if (globalObject.__ELECTRON_BROWSER__) {
// Although dojo may understand cjs require() by building option,
// some bower modules works under amd system only.
// So, we don't allow to mix amd/cjs modules with same require function
globalObject.dojoConfig.has = {
'host-node': false // Prevent dojo from being fooled by Electron
};
}

})(window);
47 changes: 45 additions & 2 deletions apps/ide/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
'webida-lib/app',
'webida-lib/app-config',
'webida-lib/theme',
'webida-lib/util/load-polyfills'
'webida-lib/util/load-polyfills',
'external/URIjs/src/URI'
], function (
ide,
config,
theme,
loader
loader,
URI
) {
'use strict';
theme.loadTheme();
Expand All @@ -37,6 +39,47 @@
ga('create',config.googleAnalytics, 'auto');
ga('send', 'pageview');
}

var uri = new URI(window.location.href);
var bootArgs = uri.query(true);

if (bootArgs.legacy) {
window.legacySiteServerConfig = desktopConfig.legacySiteConfigs[bootArgs.legacy];
if (!window.legacySiteServerConfig) {
alert('cannot read site configuration for legacy remote server');
}
}

if (window.__ELECTRON_BROWSER__) {
var browserWindow = window.nrequire('electron').remote.getCurrentWindow();
var storageKey = 'webida-desktop-window-status-' + bootArgs.workspace;
var winStatus = localStorage.getItem(storageKey);
if (!winStatus) {
console.log('unable to load window status - fallback to config defaults ');
var desktopConfig = localStorage.getItem('webida-desktop-config');
if (desktopConfig) {
desktopConfig = JSON.parse(desktopConfig);
}
winStatus = desktopConfig.ideWindowDefaults;
} else {
winStatus = JSON.parse(winStatus);
}

if (winStatus.x) {
browserWindow.setBounds(winStatus);
} else {
browserWindow.setSize(winStatus.width, winStatus.height);
}
if (winStatus.isMaximized) {
browserWindow.maximze();
}

browserWindow.on('close', function(event) {
var newStatus = browserWindow.getBounds();
newStatus.isMaximized = browserWindow.isMaximized();
localStorage.setItem(storageKey, JSON.stringify(newStatus));
});
}
});
</script>
</head>
Expand Down
43 changes: 43 additions & 0 deletions apps/ide/src/plugins/plugin-settings-desktop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"plugins" : [
"plugins/webida.editor.text-editor",
"plugins/webida.editor.code-editor",
"plugins/webida.editor.code-editor.ca.css.lint",
"plugins/webida.editor.code-editor.ca.html.lint",
"plugins/webida.editor.code-editor.ca.js.lint",
"plugins/webida.editor.code-editor.ca.json.lint",
"plugins/webida.editor.code-editor.content-assist.beautify",
"plugins/webida.editor.code-editor.content-assist.comments",
"plugins/webida.editor.code-editor.content-assist.css.css-smart",
"plugins/webida.editor.code-editor.content-assist.css.default",
"plugins/webida.editor.code-editor.content-assist.html.htmlsmart",
"plugins/webida.editor.code-editor.content-assist.html.html-link",
"plugins/webida.editor.code-editor.content-assist.html.default",
"plugins/webida.editor.code-editor.content-assist.tern",
"plugins/project-configurator",
"plugins/webida.ide.project-management.run",
"plugins/webida.ide.project.deploy",
"plugins/help",
"plugins/webida.preference",
"plugins/webida.plugin-setting",
"plugins/webida.ide.search-result",
"plugins/webida.locale",
"plugins/webida.ide.notification.view",
"plugins/webida.ide.notification.toast",
"webida-lib/plugins/command-system",
"webida-lib/plugins/editors",
"webida-lib/plugins/fs-commands",
"webida-lib/plugins/git",
"webida-lib/plugins/output",
"webida-lib/plugins/preview",
"webida-lib/plugins/session-event-dispatcher",
"webida-lib/plugins/workspace",
"webida-lib/plugins/workbench"
],
"start-plugins" : [
"webida-lib/plugins/command-system",
"webida-lib/plugins/session-event-dispatcher",
"webida-lib/plugins/workbench",
"plugins/webida.ide.notification.toast"
]
}
2 changes: 1 addition & 1 deletion apps/ide/src/plugins/project-wizard/build/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ define([
'webida-lib/app',
'webida-lib/util/logger/logger-client',
'webida-lib/util/path',
'webida-lib/webida-0.3',
'webida-lib/server-api',
'webida-lib/widgets/dialogs/buttoned-dialog/ButtonedDialog',
'./buildProfile',
'../constants',
Expand Down
81 changes: 41 additions & 40 deletions apps/ide/src/plugins/project-wizard/build/signing-new.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright (c) 2012-2015 S-Core Co., Ltd.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -27,7 +27,7 @@ define([
'dijit/registry',
'dojo/Deferred',
'webida-lib/util/path',
'webida-lib/webida-0.3',
'webida-lib/server-api',
'webida-lib/widgets/dialogs/buttoned-dialog/ButtonedDialog',
'text!plugins/project-wizard/layer/export-signing-new.html',
'./buildProfile',
Expand Down Expand Up @@ -92,6 +92,43 @@ define([
NewSigning.prototype.openDialog = function () {
var self = this;
var data = null;
var deferred = new Deferred();

var dlg = new ButtonedDialog({
buttons: [
{ id: 'signingCreate',
caption: 'OK',
methodOnClick: 'checkAndCreate'
},
{ id: 'signingCancel',
caption: 'Cancel',
methodOnClick: 'hide'
}
],
methodOnEnter: 'checkAndCreate',
title: Messages.GEN_SIGNED_WIZARD_NEW_KEY_STORE,
refocus: false,

onHide: function () {
dlg.destroyRecursive();
return deferred.resolve(data);
},

onLoad: function () {
},

checkAndCreate: function () {
_super.setMessage('');
var newName = reg.byId('alias').get('value');
try {
if (self.validate()) {
doCreation(newName);
}
} catch (err) {
_super.setError(err);
}
}
});

function doCreation(newName) {
var alias = newName;
Expand Down Expand Up @@ -125,42 +162,6 @@ define([
});
}

var deferred = new Deferred();
var dlg = new ButtonedDialog({
buttons: [
{ id: 'signingCreate',
caption: 'OK',
methodOnClick: 'checkAndCreate'
},
{ id: 'signingCancel',
caption: 'Cancel',
methodOnClick: 'hide'
}
],
methodOnEnter: 'checkAndCreate',
title: Messages.GEN_SIGNED_WIZARD_NEW_KEY_STORE,
refocus: false,

onHide: function () {
dlg.destroyRecursive();
return deferred.resolve(data);
},

onLoad: function () {
},

checkAndCreate: function () {
_super.setMessage('');
var newName = reg.byId('alias').get('value');
try {
if (self.validate()) {
doCreation(newName);
}
} catch (err) {
_super.setError(err);
}
}
});
_super.setId(dlg.id);
dlg.set('doLayout', false);
dlg.setContentArea(tplLayout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ define([
'dojo',
'dojo/Deferred',
'dojo/store/Memory',
'webida-lib/webida-0.3',
'webida-lib/server-api',
'webida-lib/widgets/dialogs/buttoned-dialog/ButtonedDialog',
'text!plugins/project-wizard/layer/export-signing-select.html',
'./buildProfile',
Expand Down
2 changes: 1 addition & 1 deletion apps/ide/src/plugins/project-wizard/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ define([
'dojo/topic',
'lib/test/bootstrap/bootstrap.custom',
'webida-lib/app',
'webida-lib/webida-0.3',
'webida-lib/server-api',
'webida-lib/util/locale',
'webida-lib/widgets/dialogs/buttoned-dialog/ButtonedDialog',
'text!./layer/pw-layout.html',
Expand Down
2 changes: 1 addition & 1 deletion apps/ide/src/plugins/project-wizard/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @author kh5325.kim@samsung.com
*/
define([
'webida-lib/webida-0.3'
'webida-lib/server-api'
], function (
webida
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ define([
'dojo/store/Memory',
'dojox/grid/EnhancedGrid',
'dojox/grid/enhanced/plugins/IndirectSelection',
'webida-lib/webida-0.3',
'webida-lib/server-api',
'webida-lib/widgets/dialogs/buttoned-dialog/ButtonedDialog',
'text!plugins/project-wizard/layer/device-select.html',
'./gcm'
Expand Down
2 changes: 1 addition & 1 deletion apps/ide/src/plugins/project-wizard/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
define([
'webida-lib/util/logger/logger-client',
'webida-lib/util/path',
'webida-lib/webida-0.3',
'webida-lib/server-api',
'./constants',
'./lib/util'
], function (
Expand Down
Loading