Error into a regular Object.
16 | * @memberof module:orion/serialize
17 | * @param {Error|Object} error
18 | * @returns {Object}
19 | */
20 | function serializeError(error) {
21 | var result = error ? JSON.parse(JSON.stringify(error)) : error; // sanitizing Error object
22 | if (error instanceof Error) {
23 | result.__isError = true;
24 | result.message = result.message || error.message;
25 | result.name = result.name || error.name;
26 | result.stack = result.stack || error.stack;
27 | }
28 | return result;
29 | }
30 |
31 | /**
32 | * @exports orion/serialize
33 | */
34 | return {
35 | serializeError: serializeError
36 | };
37 | });
--------------------------------------------------------------------------------
/eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/CallbackIDAwareMessageHandler.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others.
3 | * All rights reserved. This program and the accompanying materials are made
4 | * available under the terms of the Eclipse Public License v1.0
5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
7 | *
8 | * Contributors:
9 | * Pivotal Software, Inc. - initial API and implementation
10 | *******************************************************************************/
11 | package org.eclipse.flux.core;
12 |
13 | import org.json.JSONObject;
14 |
15 | /**
16 | * @author Martin Lippert
17 | */
18 | public abstract class CallbackIDAwareMessageHandler extends AbstractMessageHandler implements IMessageHandler {
19 |
20 | private int expectedCallbackID;
21 |
22 | public CallbackIDAwareMessageHandler(String messageType, int callbackID) {
23 | super(messageType);
24 | this.expectedCallbackID = callbackID;
25 | }
26 |
27 | @Override
28 | public boolean canHandle(String messageType, JSONObject message) {
29 | return super.canHandle(messageType, message) && message.has("callback_id") && message.optInt("callback_id") == this.expectedCallbackID;
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/editor/themes/ambience.css:
--------------------------------------------------------------------------------
1 | .ambience {
2 | color: darkseagreen;
3 | }
4 | .ambience.textview {
5 | background-color: #202020;
6 | }
7 | .ambience .ruler.annotations {
8 | background-color: #3D3D3D;
9 | }
10 | .ambience .ruler.lines {
11 | background-color: #3D3D3D;
12 | }
13 | .ambience .ruler.folding {
14 | background-color: #3D3D3D;
15 | }
16 | .ambience .ruler.overview {
17 | background-color: white;
18 | }
19 | .ambience .rulerLines {
20 | color: black;
21 | }
22 | .ambience .rulerLines.even {
23 | color: black;
24 | }
25 | .ambience .rulerLines.odd {
26 | color: black;
27 | }
28 | .ambience .annotationLine.currentLine {
29 | background-color: lightcyan;
30 | }
31 | .ambience .entity-name-tag {
32 | color: cornFlowerBlue;
33 | }
34 | .ambience .entity-other-attribute-name {
35 | color: cadetBlue;
36 | }
37 | .ambience .string-quoted {
38 | color: lightcoral;
39 | }
40 | .ambience .line_caret {
41 | background-color: lightcyan;
42 | }
43 | .ambience .token_keyword {
44 | color: cornFlowerBlue;
45 | }
46 | .ambience .token_string {
47 | color: lightcoral;
48 | }
49 | .ambience .token_singleline_comment {
50 | color: mediumslateblue;
51 | }
52 | .ambience .token_multiline_comment {
53 | color: mediumslateblue;
54 | }
55 | .ambience .token_doc_comment {
56 | color: mediumslateblue;
57 | }
58 | .ambience .token_doc_html_markup {
59 | color: mediumslateblue;
60 | }
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/editor/themes/raspberrypi.css:
--------------------------------------------------------------------------------
1 | .raspberrypi {
2 | color: dimgray;
3 | }
4 | .raspberrypi.textview {
5 | background-color: seashell;
6 | }
7 | .raspberrypi .ruler.annotations {
8 | background-color: seashell;
9 | }
10 | .raspberrypi .ruler.lines {
11 | background-color: seashell;
12 | }
13 | .raspberrypi .ruler.folding {
14 | background-color: seashell;
15 | }
16 | .raspberrypi .ruler.overview {
17 | background-color: seashell;
18 | }
19 | .raspberrypi .rulerLines {
20 | color: #E73E36;
21 | }
22 | .raspberrypi .rulerLines.even {
23 | color: #E73E36;
24 | }
25 | .raspberrypi .rulerLines.odd {
26 | color: #E73E36;
27 | }
28 | .raspberrypi .annotationLine.currentLine {
29 | background-color: #F5B1AE;
30 | }
31 | .raspberrypi .entity-name-tag {
32 | color: #E73E36;
33 | }
34 | .raspberrypi .entity-other-attribute-name {
35 | color: cadetBlue;
36 | }
37 | .raspberrypi .string-quoted {
38 | color: darkorange;
39 | }
40 | .raspberrypi .line_caret {
41 | background-color: #F5B1AE;
42 | }
43 | .raspberrypi .token_keyword {
44 | color: #E73E36;
45 | }
46 | .raspberrypi .token_string {
47 | color: darkorange;
48 | }
49 | .raspberrypi .token_singleline_comment {
50 | color: #66B32F;
51 | }
52 | .raspberrypi .token_multiline_comment {
53 | color: #66B32F;
54 | }
55 | .raspberrypi .token_doc_comment {
56 | color: #66B32F;
57 | }
58 | .raspberrypi .token_doc_html_markup {
59 | color: #66B32F;
60 | }
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/blameAnnotations.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * @license
3 | * Copyright (c) 2010, 2013 IBM Corporation and others.
4 | * All rights reserved. This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License v1.0
6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
8 | *
9 | * Contributors: IBM Corporation - initial API and implementation
10 | ******************************************************************************/
11 |
12 | /*global define */
13 |
14 | define("orion/blameAnnotations", ["orion/EventTarget"], function(EventTarget) {
15 |
16 |
17 | function BlameService(serviceRegistry) {
18 | this._serviceRegistry = serviceRegistry;
19 | EventTarget.attach(this);
20 | this._serviceRegistration = serviceRegistry.registerService("orion.core.blame", this); //$NON-NLS-0$
21 | }
22 |
23 | BlameService.prototype = /** @lends orion.blameAnnotations.BlameService.prototype */ {
24 | // provider
25 | _setAnnotations: function(blameInfo) {
26 | this.blameInfo = blameInfo;
27 | this.dispatchEvent({type:"blameChanged", blameInfo:blameInfo}); //$NON-NLS-0$
28 | }
29 | };
30 | BlameService.prototype.constructor = BlameService;
31 |
32 | //return the module exports
33 | return {BlameService: BlameService};
34 | });
35 |
36 |
--------------------------------------------------------------------------------
/node.server/startup-messaging-editor.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * @license
3 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others.
4 | * All rights reserved. This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License v1.0
6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
8 | *
9 | * Contributors:
10 | * Pivotal Software, Inc. - initial API and implementation
11 | *******************************************************************************/
12 | /*global require console exports process __dirname*/
13 |
14 | // create and configure express
15 | var express = require('express');
16 | var app = express();
17 |
18 | app.use("/client", express.static(__dirname + '/web-editor'));
19 |
20 | var host = process.env.VCAP_APP_HOST || 'localhost';
21 | var port = process.env.VCAP_APP_PORT || '3000';
22 |
23 | var server = app.listen(port, host);
24 | console.log('Express server started on port ' + port);
25 |
26 | // create and configure socket.io
27 | var io = require('socket.io').listen(server);
28 | io.set('transports', ['websocket']);
29 |
30 | // create and configure services
31 | var MessageCore = require('./messages-core.js').MessageCore;
32 | var messageSync = new MessageCore();
33 |
34 | io.sockets.on('connection', function (socket) {
35 | messageSync.initialize(socket, io.sockets);
36 | });
37 |
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/editor/contentassist.css:
--------------------------------------------------------------------------------
1 | .contentassist {
2 | font-size:10pt;
3 | font-family: "Consolas", "Monaco", "Vera Mono", "monospace";
4 | display: none;
5 | background-color: white;
6 | position: fixed;
7 | top: 100px;
8 | left: 100px;
9 | border: 1px solid #DDD;
10 | z-index:100;
11 | cursor: default;
12 | overflow: auto;
13 | min-width: 70px;
14 | min-height: 50px;
15 | max-width: 350px;
16 | max-height: 150px;
17 | white-space: nowrap;
18 | }
19 |
20 | .contentassist:focus {
21 | border: 1px solid #666;
22 | }
23 |
24 | .contentassist .proposal-emphasis {
25 | font-weight: normal;
26 | }
27 |
28 | .contentassist hr{
29 | border: 0;
30 | height: 0;
31 | border-top: 1px solid rgba(0, 0, 0, 0.1);
32 | border-bottom: 1px solid rgba(255, 255, 255, 0.3);
33 | }
34 |
35 | .contentassist .proposal-noemphasis {
36 | background-color: aliceblue;
37 | font-weight: lighter;
38 | color: grey;
39 | }
40 | .contentassist .proposal-hr {
41 | /* display as horizontal rule */
42 | border: 0;
43 | height: 0;
44 | border-top: 1px solid rgba(0, 0, 0, 0.1);
45 | border-bottom: 1px solid rgba(255, 255, 255, 0.3);
46 | }
47 | .contentassist .proposal-default {
48 | /* nothing */
49 | }
50 |
51 | .contentassist .selected {
52 | /* background-color: #a6bfe1; */
53 | background-color: #FEC;
54 | }
55 |
56 |
57 | .contentassist>div {
58 | padding: 1px 3px 0 3px;
59 | }
60 |
61 | .contentassist>div:hover {
62 | background-color: #EAF2FE;
63 | }
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/log.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * @license
3 | * Copyright (c) 2009, 2012 IBM Corporation and others.
4 | * All rights reserved. This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License v1.0
6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
8 | *
9 | * Contributors: IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 |
12 | /*global define window */
13 |
14 | define(['i18n!orion/nls/messages'], function(messages){
15 |
16 | var exports = {};
17 |
18 | /**
19 | * Creates an instance of the log service using the provided service registry.
20 | * @class The log service provides services for logging information messages
21 | * @name orion.log.LogService
22 | */
23 | exports.LogService = function(serviceRegistry) {
24 | this._serviceRegistry = serviceRegistry;
25 | this._serviceRegistration = serviceRegistry.registerService("orion.core.log", this); //$NON-NLS-0$
26 | };
27 |
28 | exports.LogService.prototype = /** @lends orion.log.LogService.prototype */ {
29 | /**
30 | * Prints an information message to the log.
31 | * @param {String} msg The message to be logged
32 | */
33 | info : function(message) {
34 | // TODO temporary implementation uses status line
35 | // obviously not the real answer
36 | this._serviceRegistry.getService("orion.page.message").setMessage(messages["LOG: "] + message); //$NON-NLS-0$
37 | }
38 | };
39 |
40 | return exports;
41 | });
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/form.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * @license
3 | * Copyright (c) 2012, 2013 IBM Corporation and others.
4 | * All rights reserved. This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License v1.0
6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
8 | *
9 | * Contributors:
10 | * IBM Corporation - initial API and implementation
11 | *******************************************************************************/
12 | /*global define escape*/
13 | define([], function() {
14 | function x_www_form_urlencode(value) {
15 | return encodeURIComponent(value).replace(/[!'()*]/g, escape).replace('%20', '+'); //$NON-NLS-0$ //$NON-NLS-1$
16 | }
17 |
18 | /**
19 | * @name orion.form
20 | * @class Utilities for handling HTML form encoding.
21 | */
22 | return /** @lends orion.form */ {
23 | /**
24 | * Encodes an object of form fields and values into an application/x-www-form-urlencoded string.
25 | * @static
26 | * @param {Object} data The form data to encode.
27 | * @returns {String} The x-www-form-urlencoded string.
28 | */
29 | encodeFormData: function(data) {
30 | data = data || {};
31 | var paramNames = Object.keys(data);
32 | var buf = [];
33 | for (var i=0; i < paramNames.length; i++) {
34 | var param = paramNames[i], value = data[param];
35 | buf.push(x_www_form_urlencode(param) + '=' + x_www_form_urlencode(value)); //$NON-NLS-0$
36 | }
37 | return buf.join('&'); //$NON-NLS-0$
38 | }
39 | };
40 | });
--------------------------------------------------------------------------------
/eclipse.core/org.eclipse.flight.core/about.html:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | April 18, 2014
12 |The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise 15 | indicated below, the Content is provided to you under the terms and conditions of the 16 | Eclipse Public License Version 1.0 ("EPL"), and the Eclipse Distribution License 1.0. A copy of the 17 | EPL is available at https://www.eclipse.org/legal/epl-v10.html. 18 | For purposes of the EPL, "Program" will mean the Content. A copy of the EDL is available at 19 | https://www.eclipse.org/org/documents/edl-v10.html
20 | 21 |If you did not receive this Content directly from the Eclipse Foundation, the Content is 22 | being redistributed by another party ("Redistributor") and different terms and conditions may 23 | apply to your use of any object code in the Content. Check the Redistributor's license that was 24 | provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise 25 | indicated below, the terms and conditions of the EPL still apply to any source code in the Content 26 | and such source code may be obtained at https://www.eclipse.org.
27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/about.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 |April 18, 2014
12 |The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise 15 | indicated below, the Content is provided to you under the terms and conditions of the 16 | Eclipse Public License Version 1.0 ("EPL"), and the Eclipse Distribution License 1.0. A copy of the 17 | EPL is available at https://www.eclipse.org/legal/epl-v10.html. 18 | For purposes of the EPL, "Program" will mean the Content. A copy of the EDL is available at 19 | https://www.eclipse.org/org/documents/edl-v10.html
20 | 21 |If you did not receive this Content directly from the Eclipse Foundation, the Content is 22 | being redistributed by another party ("Redistributor") and different terms and conditions may 23 | apply to your use of any object code in the Content. Check the Redistributor's license that was 24 | provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise 25 | indicated below, the terms and conditions of the EPL still apply to any source code in the Content 26 | and such source code may be obtained at https://www.eclipse.org.
27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /eclipse.services.java/org.eclipse.flight.jdt.service/about.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 |April 18, 2014
12 |The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise 15 | indicated below, the Content is provided to you under the terms and conditions of the 16 | Eclipse Public License Version 1.0 ("EPL"), and the Eclipse Distribution License 1.0. A copy of the 17 | EPL is available at https://www.eclipse.org/legal/epl-v10.html. 18 | For purposes of the EPL, "Program" will mean the Content. A copy of the EDL is available at 19 | https://www.eclipse.org/org/documents/edl-v10.html
20 | 21 |If you did not receive this Content directly from the Eclipse Foundation, the Content is 22 | being redistributed by another party ("Redistributor") and different terms and conditions may 23 | apply to your use of any object code in the Content. Check the Redistributor's license that was 24 | provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise 25 | indicated below, the terms and conditions of the EPL still apply to any source code in the Content 26 | and such source code may be obtained at https://www.eclipse.org.
27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/url.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * @license 3 | * Copyright (c) 2011, 2012 IBM Corporation and others. All rights reserved. This 4 | * program and the accompanying materials are made available under the terms of 5 | * the Eclipse Public License v1.0 (https://www.eclipse.org/legal/epl-v10.html), 6 | * and the Eclipse Distribution License v1.0 7 | * (https://www.eclipse.org/org/documents/edl-v10.html). 8 | * 9 | * Contributors: IBM Corporation - initial API and implementation 10 | ******************************************************************************/ 11 | 12 | /*global define */ 13 | define(function() { 14 | var buildMap = {}; 15 | function jsEscape(text) { 16 | return (text + '') 17 | .replace(/([\\'])/g, '\\$&') //$NON-NLS-0$ 18 | .replace(/[\0]/g, "\\0") //$NON-NLS-0$ 19 | .replace(/[\b]/g, "\\b") //$NON-NLS-0$ 20 | .replace(/[\f]/g, "\\f") //$NON-NLS-0$ 21 | .replace(/[\n]/g, "\\n") //$NON-NLS-0$ 22 | .replace(/[\r]/g, "\\r") //$NON-NLS-0$ 23 | .replace(/[\t]/g, "\\t"); //$NON-NLS-0$ 24 | } 25 | 26 | return { 27 | load: function(name, parentRequire, onLoad, config) { 28 | var temp = parentRequire.toUrl(name + "._"); //$NON-NLS-0$ 29 | var url = temp.substring(0, temp.length - 2); 30 | if (config.isBuild) { 31 | buildMap[name] = url; 32 | } 33 | onLoad(url); 34 | }, 35 | write: function(pluginName, moduleName, write, config) { 36 | if (moduleName in buildMap) { 37 | var text = jsEscape(buildMap[moduleName]); 38 | write("define('" + pluginName + "!" + moduleName + "', function(){return '" + text + "';});\n"); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ 39 | } 40 | } 41 | }; 42 | }); -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/problems.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * @license 3 | * Copyright (c) 2010, 2012 IBM Corporation and others. 4 | * All rights reserved. This program and the accompanying materials are made 5 | * available under the terms of the Eclipse Public License v1.0 6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 8 | * 9 | * Contributors: IBM Corporation - initial API and implementation 10 | ******************************************************************************/ 11 | 12 | /*global define */ 13 | 14 | define(["orion/EventTarget"], function(EventTarget) { 15 | 16 | /** 17 | * Creates a new problem service instance. Client should obtain the service 18 | * orion.core.marker from the service registry rather than instantiate 19 | * this service directly. 20 | * @class The problem service tracks markers and sends notification of marker changes. 21 | * @name orion.problems.ProblemService 22 | */ 23 | function ProblemService(serviceRegistry) { 24 | this._serviceRegistry = serviceRegistry; 25 | EventTarget.attach(this); 26 | this._serviceRegistration = serviceRegistry.registerService("orion.core.marker", this); //$NON-NLS-0$ 27 | } 28 | 29 | ProblemService.prototype = /** @lends orion.problems.ProblemService.prototype */ { 30 | // provider 31 | _setProblems: function(problems) { 32 | this.problems = problems; 33 | this.dispatchEvent({type:"problemsChanged", problems:problems}); //$NON-NLS-0$ 34 | } 35 | }; 36 | ProblemService.prototype.constructor = ProblemService; 37 | 38 | //return the module exports 39 | return {ProblemService: ProblemService}; 40 | }); 41 | 42 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/internal/CloudSyncMetadataListener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others. 3 | * All rights reserved. This program and the accompanying materials are made 4 | * available under the terms of the Eclipse Public License v1.0 5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 7 | * 8 | * Contributors: 9 | * Pivotal Software, Inc. - initial API and implementation 10 | *******************************************************************************/ 11 | package org.eclipse.flux.core.internal; 12 | 13 | import org.eclipse.core.resources.IResourceChangeEvent; 14 | import org.eclipse.core.resources.IResourceChangeListener; 15 | import org.eclipse.core.resources.IResourceDelta; 16 | import org.eclipse.core.resources.IResourceDeltaVisitor; 17 | import org.eclipse.core.runtime.CoreException; 18 | import org.eclipse.flux.core.Repository; 19 | 20 | /** 21 | * @author Martin Lippert 22 | */ 23 | public class CloudSyncMetadataListener implements IResourceChangeListener{ 24 | 25 | private Repository repository; 26 | 27 | public CloudSyncMetadataListener(Repository repository) { 28 | this.repository = repository; 29 | } 30 | 31 | @Override 32 | public void resourceChanged(IResourceChangeEvent event) { 33 | try { 34 | event.getDelta().accept(new IResourceDeltaVisitor() { 35 | @Override 36 | public boolean visit(IResourceDelta delta) throws CoreException { 37 | repository.metadataChanged(delta); 38 | return true; 39 | } 40 | }); 41 | } catch (CoreException e) { 42 | e.printStackTrace(); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/internal/CloudSyncResourceListener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others. 3 | * All rights reserved. This program and the accompanying materials are made 4 | * available under the terms of the Eclipse Public License v1.0 5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 7 | * 8 | * Contributors: 9 | * Pivotal Software, Inc. - initial API and implementation 10 | *******************************************************************************/ 11 | package org.eclipse.flux.core.internal; 12 | 13 | import org.eclipse.core.resources.IResourceChangeEvent; 14 | import org.eclipse.core.resources.IResourceChangeListener; 15 | import org.eclipse.core.resources.IResourceDelta; 16 | import org.eclipse.core.resources.IResourceDeltaVisitor; 17 | import org.eclipse.core.runtime.CoreException; 18 | import org.eclipse.flux.core.Repository; 19 | 20 | /** 21 | * @author Martin Lippert 22 | */ 23 | public class CloudSyncResourceListener implements IResourceChangeListener { 24 | 25 | private Repository repository; 26 | 27 | public CloudSyncResourceListener(Repository repository) { 28 | this.repository = repository; 29 | } 30 | 31 | @Override 32 | public void resourceChanged(IResourceChangeEvent event) { 33 | try { 34 | event.getDelta().accept(new IResourceDeltaVisitor() { 35 | @Override 36 | public boolean visit(IResourceDelta delta) throws CoreException { 37 | repository.resourceChanged(delta); 38 | return true; 39 | } 40 | }); 41 | } catch (CoreException e) { 42 | e.printStackTrace(); 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/src/org/eclipse/flux/ui/integration/handlers/PendingLiveEditStartedResponse.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Pivotal Software, Inc. and others. 3 | * All rights reserved. This program and the accompanying materials are made 4 | * available under the terms of the Eclipse Public License v1.0 5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 7 | * 8 | * Contributors: 9 | * Pivotal Software, Inc. - initial API and implementation 10 | *******************************************************************************/ 11 | package org.eclipse.flux.ui.integration.handlers; 12 | 13 | /** 14 | * @author Martin Lippert 15 | */ 16 | public class PendingLiveEditStartedResponse { 17 | 18 | private String username; 19 | private String projectName; 20 | private String resource; 21 | private String savePointHash; 22 | private long savePointTimestamp; 23 | private String content; 24 | 25 | public PendingLiveEditStartedResponse(String username, String projectName, String resource, String savePointHash, long savePointTimestamp, 26 | String content) { 27 | this.username = username; 28 | this.projectName = projectName; 29 | this.resource = resource; 30 | this.savePointHash = savePointHash; 31 | this.savePointTimestamp = savePointTimestamp; 32 | this.content = content; 33 | } 34 | 35 | public String getUsername() { 36 | return username; 37 | } 38 | 39 | public String getProjectName() { 40 | return projectName; 41 | } 42 | 43 | public String getResource() { 44 | return resource; 45 | } 46 | 47 | public String getSavePointHash() { 48 | return savePointHash; 49 | } 50 | 51 | public long getSavePointTimestamp() { 52 | return savePointTimestamp; 53 | } 54 | 55 | public String getContent() { 56 | return content; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/util.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * @license 3 | * Copyright (c) 2013 IBM Corporation and others. 4 | * All rights reserved. This program and the accompanying materials are made 5 | * available under the terms of the Eclipse Public License v1.0 6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 8 | * 9 | * Contributors: IBM Corporation - initial API and implementation 10 | ******************************************************************************/ 11 | 12 | /*global define*/ 13 | 14 | define("orion/editor/util", [], function() { //$NON-NLS-0$ 15 | 16 | /** @private */ 17 | function addEventListener(node, type, handler, capture) { 18 | if (typeof node.addEventListener === "function") { //$NON-NLS-0$ 19 | node.addEventListener(type, handler, capture === true); 20 | } else { 21 | node.attachEvent("on" + type, handler); //$NON-NLS-0$ 22 | } 23 | } 24 | /** @private */ 25 | function removeEventListener(node, type, handler, capture) { 26 | if (typeof node.removeEventListener === "function") { //$NON-NLS-0$ 27 | node.removeEventListener(type, handler, capture === true); 28 | } else { 29 | node.detachEvent("on" + type, handler); //$NON-NLS-0$ 30 | } 31 | } 32 | /** @private */ 33 | function contains(topNode, node) { 34 | if (!node) { return false; } 35 | if (!topNode.compareDocumentPosition) { 36 | var temp = node; 37 | while (temp) { 38 | if (topNode === temp) { 39 | return true; 40 | } 41 | temp = temp.parentNode; 42 | } 43 | return false; 44 | } 45 | return topNode === node || (topNode.compareDocumentPosition(node) & 16) !== 0; 46 | } 47 | 48 | return { 49 | contains: contains, 50 | addEventListener: addEventListener, 51 | removeEventListener: removeEventListener 52 | }; 53 | }); -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/fileUtils.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * @license 3 | * Copyright (c) 2009, 2012 IBM Corporation and others. 4 | * All rights reserved. This program and the accompanying materials are made 5 | * available under the terms of the Eclipse Public License v1.0 6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 8 | * 9 | * Contributors: IBM Corporation - initial API and implementation 10 | *******************************************************************************/ 11 | /*global define window document navigator URL*/ 12 | 13 | define(['require', 'i18n!orion/nls/messages', 'orion/URL-shim'], function(require, messages) { 14 | 15 | /** 16 | * This class contains static utility methods. It is not intended to be instantiated. 17 | * @class This class contains static utility methods. 18 | * @name orion.fileUtils 19 | */ 20 | 21 | function makeRelative(location) { 22 | if (!location) { 23 | return location; 24 | } 25 | var hostName = window.location.protocol + "//" + window.location.host; //$NON-NLS-0$ 26 | if (location.indexOf(hostName) === 0) { 27 | return location.substring(hostName.length); 28 | } 29 | return location; 30 | } 31 | 32 | /** 33 | * Determines if the path represents the workspace root 34 | * @name orion.util#isAtRoot 35 | * @function 36 | */ 37 | function isAtRoot(path) { 38 | if (!path) { 39 | return false; 40 | } 41 | if (path === "/workspace") { 42 | return true; // sad but true 43 | } 44 | var workspaceUrl = new URL(require.toUrl("workspace"), window.location.href); 45 | var pathUrl = new URL(path, window.location.href); 46 | return pathUrl.href.indexOf(workspaceUrl.href) === 0; //$NON-NLS-0$ 47 | } 48 | 49 | //return module exports 50 | return { 51 | makeRelative: makeRelative, 52 | isAtRoot: isAtRoot 53 | }; 54 | }); 55 | -------------------------------------------------------------------------------- /node.server/startup-memory-repository.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * @license 3 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others. 4 | * All rights reserved. This program and the accompanying materials are made 5 | * available under the terms of the Eclipse Public License v1.0 6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 8 | * 9 | * Contributors: 10 | * Pivotal Software, Inc. - initial API and implementation 11 | *******************************************************************************/ 12 | /*global require console exports process __dirname*/ 13 | 14 | // create and configure express 15 | var express = require('express'); 16 | var app = express(); 17 | 18 | var host = process.env.VCAP_APP_HOST || 'localhost'; 19 | var port = process.env.VCAP_APP_PORT || '3001'; 20 | 21 | var messagingHost = process.env.FLIGHT_MESSAGING_HOST || 'localhost'; 22 | var messagingPort = process.env.FLIGHT_MESSAGING_PORT || 3000; 23 | 24 | var server = app.listen(port, host); 25 | console.log('Express server started on port ' + port); 26 | 27 | var client_io = require('socket.io-client'); 28 | var client_socket = client_io.connect(messagingHost, { 29 | port : messagingPort 30 | }); 31 | 32 | var Repository = require('./repository-inmemory.js').Repository; 33 | var repository = new Repository(); 34 | 35 | var RestRepository = require('./repository-rest-api.js').RestRepository; 36 | var restrepository = new RestRepository(app, repository); 37 | 38 | var MessagesRepository = require('./repository-message-api.js').MessagesRepository; 39 | var messagesrepository = new MessagesRepository(repository); 40 | 41 | client_socket.on('connect', function() { 42 | console.log('client socket connected'); 43 | 44 | repository.setNotificationSender.call(repository, client_socket); 45 | messagesrepository.setSocket.call(messagesrepository, client_socket); 46 | }); 47 | -------------------------------------------------------------------------------- /node.server/startup-mongodb-repository.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * @license 3 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others. 4 | * All rights reserved. This program and the accompanying materials are made 5 | * available under the terms of the Eclipse Public License v1.0 6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 8 | * 9 | * Contributors: 10 | * Pivotal Software, Inc. - initial API and implementation 11 | *******************************************************************************/ 12 | /*global require console exports process __dirname*/ 13 | 14 | // create and configure express 15 | var express = require('express'); 16 | var app = express(); 17 | 18 | var host = process.env.VCAP_APP_HOST || 'localhost'; 19 | var port = process.env.VCAP_APP_PORT || '3002'; 20 | 21 | var messagingHost = process.env.FLIGHT_MESSAGING_HOST || 'localhost'; 22 | var messagingPort = process.env.FLIGHT_MESSAGING_PORT || 3000; 23 | 24 | var server = app.listen(port, host); 25 | console.log('Express server started on port ' + port); 26 | 27 | var client_io = require('socket.io-client'); 28 | var client_socket = client_io.connect(messagingHost, { 29 | port : messagingPort 30 | }); 31 | 32 | var Repository = require('./repository-mongodb.js').Repository; 33 | var repository = new Repository(); 34 | 35 | var RestRepository = require('./repository-rest-api.js').RestRepository; 36 | var restrepository = new RestRepository(app, repository); 37 | 38 | var MessagesRepository = require('./repository-message-api.js').MessagesRepository; 39 | var messagesrepository = new MessagesRepository(repository); 40 | 41 | client_socket.on('connect', function() { 42 | console.log('client socket connected'); 43 | 44 | repository.setNotificationSender.call(repository, client_socket); 45 | messagesrepository.setSocket.call(messagesrepository, client_socket); 46 | }); 47 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/testHelpers.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * @license 3 | * Copyright (c) 2012 IBM Corporation and others. 4 | * All rights reserved. This program and the accompanying materials are made 5 | * available under the terms of the Eclipse Public License v1.0 6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 8 | * 9 | * Contributors: IBM Corporation - initial API and implementation 10 | ******************************************************************************/ 11 | /*global define setTimeout*/ 12 | define(['orion/Deferred'], function(Deferred) { 13 | /** 14 | * Helper for generating a setup-invoke-teardown test case. 15 | * @name orion.test.makeTest 16 | * @function 17 | * @static 18 | * @param {Function} setUp Invoked before the testBody is attempted. This function can return a promise. 19 | * @param {Function} tearDown Invoked after the testBody has been attempted. 20 | * @param {Function} testBody The test body. This can return a promise or an immediate result. 21 | * @returns {Function} An asynchronous test function. 22 | */ 23 | function makeTest(setUp, tearDown, testBody) { 24 | return function() { 25 | var d = new Deferred(); 26 | Deferred.when(setUp(), function() { 27 | try { 28 | var result = testBody(); 29 | if (result && result.then) { 30 | return result.then( 31 | function(r) { 32 | Deferred.when(tearDown(), function() { 33 | d.resolve(r); 34 | }, function(e) { 35 | d.reject(e); 36 | }); 37 | }, 38 | function(e) { 39 | Deferred.when(tearDown(), function() { 40 | d.reject(e); 41 | }, function(e) { 42 | d.reject(e); 43 | }); 44 | }); 45 | } else { 46 | tearDown(); 47 | d.resolve(result); 48 | } 49 | } catch(e) { 50 | tearDown(); 51 | d.reject(e); 52 | } 53 | }); 54 | return d; 55 | }; 56 | } 57 | return { 58 | makeTest: makeTest 59 | }; 60 | }); -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/src/org/eclipse/flux/ui/integration/CloudProjectDecorator.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2014 Pivotal Software, Inc. and others. 3 | * All rights reserved. This program and the accompanying materials are made 4 | * available under the terms of the Eclipse Public License v1.0 5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 7 | * 8 | * Contributors: 9 | * Pivotal Software, Inc. - initial API and implementation 10 | *******************************************************************************/ 11 | package org.eclipse.flux.ui.integration; 12 | 13 | import org.eclipse.core.resources.IProject; 14 | import org.eclipse.jface.viewers.IDecoration; 15 | import org.eclipse.jface.viewers.ILightweightLabelDecorator; 16 | import org.eclipse.jface.viewers.LabelProvider; 17 | import org.eclipse.jface.viewers.LabelProviderChangedEvent; 18 | import org.eclipse.ui.IDecoratorManager; 19 | 20 | /** 21 | * @author Martin Lippert 22 | * @author Miles Parker 23 | */ 24 | public class CloudProjectDecorator extends LabelProvider implements ILightweightLabelDecorator { 25 | 26 | public static final String ID = "org.eclipse.flux.ui.integration.projectdecorator"; 27 | 28 | public static CloudProjectDecorator getInstance() { 29 | IDecoratorManager decoratorManager = FluxUiPlugin.getDefault().getWorkbench().getDecoratorManager(); 30 | if (decoratorManager.getEnabled(ID)) { 31 | return (CloudProjectDecorator) decoratorManager.getBaseLabelProvider(ID); 32 | } 33 | return null; 34 | } 35 | 36 | @Override 37 | public void decorate(Object element, IDecoration decoration) { 38 | if (element instanceof IProject && org.eclipse.flux.core.Activator.getDefault().getRepository().isConnected((IProject) element)) { 39 | decoration.addSuffix(" [connected to flux]"); 40 | } 41 | } 42 | 43 | @Override 44 | public void fireLabelProviderChanged(LabelProviderChangedEvent event) { 45 | super.fireLabelProviderChanged(event); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /eclipse.services.java/org.eclipse.flight.jdt.service/src/org/eclipse/flux/jdt/services/Activator.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others. 3 | * All rights reserved. This program and the accompanying materials are made 4 | * available under the terms of the Eclipse Public License v1.0 5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 7 | * 8 | * Contributors: 9 | * Pivotal Software, Inc. - initial API and implementation 10 | *******************************************************************************/ 11 | package org.eclipse.flux.jdt.services; 12 | 13 | import org.eclipse.flux.core.IMessagingConnector; 14 | import org.eclipse.flux.core.LiveEditCoordinator; 15 | import org.eclipse.flux.core.Repository; 16 | import org.osgi.framework.BundleActivator; 17 | import org.osgi.framework.BundleContext; 18 | 19 | /** 20 | * @author Martin Lippert 21 | */ 22 | public class Activator implements BundleActivator { 23 | 24 | @Override 25 | public void start(BundleContext context) throws Exception { 26 | IMessagingConnector messagingConnector = org.eclipse.flux.core.Activator.getDefault().getMessagingConnector(); 27 | Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository(); 28 | LiveEditCoordinator liveEditCoordinator = org.eclipse.flux.core.Activator.getDefault().getLiveEditCoordinator(); 29 | 30 | LiveEditUnits liveEditUnits = new LiveEditUnits(messagingConnector, liveEditCoordinator, repository); 31 | new ContentAssistService(messagingConnector, liveEditUnits); 32 | new NavigationService(messagingConnector, liveEditUnits); 33 | new RenameService(messagingConnector, liveEditUnits); 34 | 35 | if (Boolean.getBoolean("flux-initjdt")) { 36 | InitializeServiceEnvironment initializer = new InitializeServiceEnvironment(messagingConnector, repository); 37 | initializer.start(); 38 | } 39 | } 40 | 41 | @Override 42 | public void stop(BundleContext context) throws Exception { 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/regex.js: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * @license 3 | * Copyright (c) 2011, 2013 IBM Corporation and others. 4 | * All rights reserved. This program and the accompanying materials are made 5 | * available under the terms of the Eclipse Public License v1.0 6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 8 | * 9 | * Contributors: 10 | * IBM Corporation - initial API and implementation 11 | *******************************************************************************/ 12 | /*global define */ 13 | /*jslint browser:true regexp:false*/ 14 | /** 15 | * @name orion.regex 16 | * @class Utilities for dealing with regular expressions. 17 | * @description Utilities for dealing with regular expressions. 18 | */ 19 | define("orion/regex", [], function() { //$NON-NLS-0$ 20 | /** 21 | * @memberOf orion.regex 22 | * @function 23 | * @static 24 | * @description Escapes regex special characters in the input string. 25 | * @param {String} str The string to escape. 26 | * @returns {String} A copy ofstr with regex special characters escaped.
27 | */
28 | function escape(str) {
29 | return str.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g, "\\$&"); //$NON-NLS-0$
30 | }
31 |
32 | /**
33 | * @memberOf orion.regex
34 | * @function
35 | * @static
36 | * @description Parses a pattern and flags out of a regex literal string.
37 | * @param {String} str The string to parse. Should look something like "/ab+c/" or "/ab+c/i".
38 | * @returns {Object} If str looks like a regex literal, returns an object with properties
39 | *
40 | * - pattern
- {String}
41 | * - flags
- {String}
42 | *
otherwise returns null.
43 | */
44 | function parse(str) {
45 | var regexp = /^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(str);
46 | if (regexp) {
47 | return {
48 | pattern : regexp[1],
49 | flags : regexp[2]
50 | };
51 | }
52 | return null;
53 | }
54 |
55 | return {
56 | escape: escape,
57 | parse: parse
58 | };
59 | });
60 |
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/i18nUtil.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * @license
3 | * Copyright (c) 2012 IBM Corporation and others.
4 | * All rights reserved. This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License v1.0
6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
8 | *
9 | * Contributors: IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 |
12 | /*global define localStorage*/
13 | define(['require', 'orion/Deferred'], function(require, Deferred) {
14 |
15 | var messageBundleDeffereds = {};
16 |
17 | function formatMessage(msg) {
18 | var args = arguments;
19 | return msg.replace(/\$\{([^\}]+)\}/g, function(str, index) {
20 | return args[(index << 0) + 1];
21 | });
22 | }
23 |
24 | function getCachedMessageBundle(name) {
25 | var item = localStorage.getItem('orion/messageBundle/' + name);
26 | if (item) {
27 | var bundle = JSON.parse(item);
28 | if (bundle._expires && bundle._expires > new Date().getTime()) {
29 | delete bundle._expires;
30 | return bundle;
31 | }
32 | }
33 | return null;
34 | }
35 |
36 | function setCachedMessageBundle(name, bundle) {
37 | bundle._expires = new Date().getTime() + 1000 * 900; //15 minutes
38 | localStorage.setItem('orion/messageBundle/' + name, JSON.stringify(bundle));
39 | delete bundle._expires;
40 | }
41 |
42 |
43 | function getMessageBundle(name) {
44 | if (messageBundleDeffereds[name]) {
45 | return messageBundleDeffereds[name];
46 | }
47 |
48 | var d = new Deferred();
49 | messageBundleDeffereds[name] = d;
50 |
51 | var cached = getCachedMessageBundle(name);
52 | if (cached) {
53 | d.resolve(cached);
54 | return d;
55 | }
56 |
57 | function _resolveMessageBundle() {
58 | require(['i18n!' + name], function(bundle) { //$NON-NLS-0$
59 | if (bundle) {
60 | setCachedMessageBundle(name, bundle);
61 | }
62 | d.resolve(bundle);
63 | });
64 | }
65 |
66 | try {
67 | require([name], _resolveMessageBundle);
68 | } catch (ignore) {
69 | require(['orion/i18n!' + name], _resolveMessageBundle); //$NON-NLS-0$
70 | }
71 | return d;
72 | }
73 | return {
74 | getMessageBundle: getMessageBundle,
75 | formatMessage: formatMessage
76 | };
77 | });
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/editor/default-theme.css:
--------------------------------------------------------------------------------
1 | /* Default theme */
2 | .comment {
3 | color: #3C802C;
4 | }
5 |
6 | .comment-block-documentation {
7 | color: #00008F;
8 | }
9 |
10 | .constant {
11 | font-style: italic;
12 | color: blue;
13 | }
14 |
15 | .constant-character-entity {
16 | font-style: normal;
17 | }
18 |
19 | .entity {
20 | color: #3f7f7f;
21 | }
22 |
23 | .entity-name-function, .entity-name-type {
24 | font-weight: bold;
25 | }
26 |
27 | .invalid-illegal {
28 | color: white;
29 | background-color: red;
30 | }
31 |
32 | .invalid-deprecated {
33 | text-decoration: line-through;
34 | }
35 |
36 | .invalid {
37 | color: red;
38 | font-weight: bold;
39 | }
40 |
41 | .keyword-control {
42 | color: #7F0055;
43 | font-weight: bold;
44 | }
45 |
46 | .keyword-operator {
47 | color: #ddd;
48 | }
49 |
50 | .markup-heading {
51 | font-weight: bold;
52 | }
53 |
54 | .markup-quote {
55 | font-style: italic;
56 | }
57 |
58 | .meta-tag {
59 | color: #3f7f7f;
60 | }
61 |
62 | .storage {
63 | color: #7F0055;
64 | }
65 |
66 | .string {
67 | color: blue;
68 | }
69 |
70 | .support {
71 | color: #21439c;
72 | }
73 |
74 | .variable {
75 | color: #0000c0;
76 | }
77 |
78 | .variable-parameter {
79 | color: black;
80 | }
81 |
82 | .variable-language {
83 | color: #7F0055;
84 | font-weight: bold;
85 | }
86 |
87 | /* Hardcoded HTML styles */
88 | .entity-name-tag /*tag name*/ {
89 | color: #CC4C07;
90 | }
91 |
92 | .entity-other-attribute-name {
93 | color: #3C802C;
94 | }
95 |
96 | .punctuation-definition-comment {
97 | color: #3f5fbf;
98 | }
99 |
100 | .punctuation-definition-string {
101 | color: blue;
102 | }
103 |
104 | .string-quoted {
105 | color: #2a00ff;
106 | }
107 |
108 | /* CodeMirror */
109 | .cm-meta { color: #00008F; }
110 | .cm-keyword { font-weight: bold; color: #7F0055; }
111 | .cm-atom { color: #21439c; }
112 | .cm-number { color: black; }
113 | .cm-def { color: green; }
114 | .cm-variable { color: black; }
115 | .cm-variable-2 { color: #004080; }
116 | .cm-variable-3 { color: #004080; }
117 | .cm-property { color: black; }
118 | .cm-operator { color: #222; }
119 | .cm-comment { color: green; }
120 | .cm-string { color: blue; }
121 | /*.cm-string-2 { color: blue; }*/
122 | .cm-error { color: #ff0000; }
123 | .cm-qualifier { color: gray; }
124 | .cm-builtin { color: #7F0055; }
125 | .cm-bracket { color: white; background-color: gray; }
126 | .cm-tag { color: #3f7f7f; }
127 | .cm-attribute { color: #7f007f; }
128 |
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/objects.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * @license
3 | * Copyright (c) 2013 IBM Corporation and others.
4 | * All rights reserved. This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License v1.0
6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
8 | *
9 | * Contributors: IBM Corporation - initial API and implementation
10 | ******************************************************************************/
11 | /*global define*/
12 | define([], function() {
13 | function mixin(target/*, source..*/) {
14 | for (var j = 1; j < arguments.length; j++) {
15 | var source = arguments[j];
16 | for (var key in source) {
17 | if (Object.prototype.hasOwnProperty.call(source, key)) {
18 | target[key] = source[key];
19 | }
20 | }
21 | }
22 | return target;
23 | }
24 |
25 | /**
26 | * @name orion.objects
27 | * @class Object-oriented helpers.
28 | */
29 | return {
30 | /**
31 | * Creates a shallow clone of the given object.
32 | * @name orion.objects.clone
33 | * @function
34 | * @static
35 | * @param {Object|Array} object The object to clone. Must be a "normal" Object or Array. Other built-ins,
36 | * host objects, primitives, etc, will not work.
37 | * @returns {Object|Array} A clone of object.
38 | */
39 | clone: function(object) {
40 | if (Array.isArray(object)) {
41 | return Array.prototype.slice.call(object);
42 | }
43 | var clone = Object.create(Object.getPrototypeOf(object));
44 | mixin(clone, object);
45 | return clone;
46 | },
47 | /**
48 | * Mixes all source's own enumerable properties into target. Multiple source objects
49 | * can be passed as varags.
50 | * @name orion.objects.mixin
51 | * @function
52 | * @static
53 | * @param {Object} target
54 | * @param {Object} source
55 | */
56 | mixin: mixin,
57 | /**
58 | * Wraps an object into an Array if necessary.
59 | * @name orion.objects.toArray
60 | * @function
61 | * @static
62 | * @param {Object} obj An object.
63 | * @returns {Array} Returns obj unchanged, if obj is an Array. Otherwise returns a 1-element Array
64 | * whose sole element is obj.
65 | */
66 | toArray: function(o) {
67 | return Array.isArray(o) ? o : [o];
68 | }
69 | };
70 | });
--------------------------------------------------------------------------------
/node.server/web-editor/js/editor/javaContentAssist.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * @license
3 | * Copyright (c) 2013 Pivotal Software, Inc. and others.
4 | * All rights reserved. This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License v1.0
6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
8 | *
9 | * Contributors:
10 | * Pivotal Software, Inc. - initial API and implementation
11 | *******************************************************************************/
12 | define("editor/javaContentAssist", ['orion/Deferred'], function(Deferred) {
13 |
14 | var currentCallbackId = 0;
15 | var callbacks = {};
16 |
17 | function JavaContentAssistProvider(socket) {
18 | socket.on('contentassistresponse', function (data) {
19 | if(callbacks.hasOwnProperty(data.callback_id)) {
20 | console.log(callbacks[data.callback_id]);
21 | callbacks[data.callback_id].cb.resolve(data.proposals);
22 | delete callbacks[data.callback_id];
23 | }
24 | });
25 | }
26 |
27 | // This creates a new callback ID for a request
28 | function getCallbackId() {
29 | currentCallbackId += 1;
30 | if(currentCallbackId > 10000) {
31 | currentCallbackId = 0;
32 | }
33 | return currentCallbackId;
34 | }
35 |
36 | function sendContentAssistRequest(request, socket) {
37 | var deferred = new Deferred();
38 |
39 | var callbackId = getCallbackId();
40 | callbacks[callbackId] = {
41 | time : new Date(),
42 | cb : deferred
43 | };
44 |
45 | request.callback_id = callbackId;
46 | socket.emit('contentassistrequest', request);
47 |
48 | return deferred.promise;
49 | }
50 |
51 | JavaContentAssistProvider.prototype =
52 | {
53 | computeProposals: function(buffer, offset, context) {
54 | var request = {
55 | 'username' : this.username,
56 | 'project' : this.project,
57 | 'resource' : this.resourcePath,
58 | 'offset' : offset,
59 | 'prefix' : context.prefix
60 | };
61 |
62 | var deferred = sendContentAssistRequest(request, this.socket);
63 | return deferred;
64 | },
65 |
66 | setProject: function(project) {
67 | this.project = project;
68 | },
69 |
70 | setResourcePath: function(resourcePath) {
71 | this.resourcePath = resourcePath;
72 | },
73 |
74 | setUsername: function(username) {
75 | this.username = username;
76 | },
77 |
78 | setSocket: function(socket) {
79 | this.socket = socket;
80 | }
81 |
82 | }
83 |
84 | return {
85 | JavaContentAssistProvider: JavaContentAssistProvider
86 | };
87 | });
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/util.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * @license
3 | * Copyright (c) 2012 IBM Corporation and others.
4 | * All rights reserved. This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License v1.0
6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
8 | *
9 | * Contributors: IBM Corporation - initial API and implementation
10 | *******************************************************************************/
11 |
12 | /*global define navigator document*/
13 | define(function() {
14 |
15 | var userAgent = navigator.userAgent;
16 | var isIE = (userAgent.indexOf("MSIE") !== -1 || userAgent.indexOf("Trident") !== -1) ? document.documentMode : undefined; //$NON-NLS-1$ //$NON-NLS-0$
17 | var isFirefox = parseFloat(userAgent.split("Firefox/")[1] || userAgent.split("Minefield/")[1]) || undefined; //$NON-NLS-1$ //$NON-NLS-0$
18 | var isOpera = userAgent.indexOf("Opera") !== -1; //$NON-NLS-0$
19 | var isChrome = parseFloat(userAgent.split("Chrome/")[1]) || undefined; //$NON-NLS-0$
20 | var isSafari = userAgent.indexOf("Safari") !== -1 && !isChrome; //$NON-NLS-0$
21 | var isWebkit = parseFloat(userAgent.split("WebKit/")[1]) || undefined; //$NON-NLS-0$
22 | var isAndroid = userAgent.indexOf("Android") !== -1; //$NON-NLS-0$
23 | var isIPad = userAgent.indexOf("iPad") !== -1; //$NON-NLS-0$
24 | var isIPhone = userAgent.indexOf("iPhone") !== -1; //$NON-NLS-0$
25 | var isIOS = isIPad || isIPhone;
26 | var isMac = navigator.platform.indexOf("Mac") !== -1; //$NON-NLS-0$
27 | var isWindows = navigator.platform.indexOf("Win") !== -1; //$NON-NLS-0$
28 | var isLinux = navigator.platform.indexOf("Linux") !== -1; //$NON-NLS-0$
29 | var platformDelimiter = isWindows ? "\r\n" : "\n"; //$NON-NLS-1$ //$NON-NLS-0$
30 |
31 | function formatMessage(msg) {
32 | var args = arguments;
33 | return msg.replace(/\$\{([^\}]+)\}/g, function(str, index) { return args[(index << 0) + 1]; });
34 | }
35 |
36 | var XHTML = "http://www.w3.org/1999/xhtml"; //$NON-NLS-0$
37 | function createElement(document, tagName) {
38 | if (document.createElementNS) {
39 | return document.createElementNS(XHTML, tagName);
40 | }
41 | return document.createElement(tagName);
42 | }
43 |
44 | return {
45 | formatMessage: formatMessage,
46 |
47 | createElement: createElement,
48 |
49 | /** Browsers */
50 | isIE: isIE,
51 | isFirefox: isFirefox,
52 | isOpera: isOpera,
53 | isChrome: isChrome,
54 | isSafari: isSafari,
55 | isWebkit: isWebkit,
56 | isAndroid: isAndroid,
57 | isIPad: isIPad,
58 | isIPhone: isIPhone,
59 | isIOS: isIOS,
60 |
61 | /** OSs */
62 | isMac: isMac,
63 | isWindows: isWindows,
64 | isLinux: isLinux,
65 |
66 | platformDelimiter: platformDelimiter
67 | };
68 | });
--------------------------------------------------------------------------------
/eclipse.ui/org.eclipse.flight.ui.integration/src/org/eclipse/flux/ui/integration/handlers/SyncDownloadHandler.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others.
3 | * All rights reserved. This program and the accompanying materials are made
4 | * available under the terms of the Eclipse Public License v1.0
5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
7 | *
8 | * Contributors:
9 | * Pivotal Software, Inc. - initial API and implementation
10 | *******************************************************************************/
11 | package org.eclipse.flux.ui.integration.handlers;
12 |
13 | import org.eclipse.core.commands.AbstractHandler;
14 | import org.eclipse.core.commands.ExecutionEvent;
15 | import org.eclipse.core.commands.ExecutionException;
16 | import org.eclipse.core.resources.IProject;
17 | import org.eclipse.flux.core.DownloadProject;
18 | import org.eclipse.flux.core.IMessagingConnector;
19 | import org.eclipse.flux.core.Repository;
20 | import org.eclipse.flux.core.DownloadProject.CompletionCallback;
21 | import org.eclipse.flux.ui.integration.FluxUiPlugin;
22 | import org.eclipse.jface.dialogs.Dialog;
23 | import org.eclipse.jface.viewers.LabelProvider;
24 | import org.eclipse.swt.widgets.Shell;
25 |
26 | /**
27 | * @author Martin Lippert
28 | */
29 | public class SyncDownloadHandler extends AbstractHandler {
30 |
31 | public static final String ID = "org.springsource.ide.eclipse.ui.cloudsync.connect";
32 |
33 | @Override
34 | public Object execute(final ExecutionEvent event) throws ExecutionException {
35 | final Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository();
36 | final IMessagingConnector messagingConnector = org.eclipse.flux.core.Activator.getDefault().getMessagingConnector();
37 |
38 | final Shell shell = FluxUiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
39 |
40 | SyncDownloadSelectionDialog selectionDialog = new SyncDownloadSelectionDialog(shell, new LabelProvider(), messagingConnector);
41 | int result = selectionDialog.open();
42 |
43 | if (result == Dialog.OK) {
44 | Object[] selectedProjects = selectionDialog.getResult();
45 |
46 | for (Object selectedProject : selectedProjects) {
47 | if (selectedProject instanceof String) {
48 | DownloadProject downloadProject = new DownloadProject(messagingConnector, (String) selectedProject, repository.getUsername());
49 | downloadProject.run(new CompletionCallback() {
50 | @Override
51 | public void downloadFailed() {
52 | }
53 | @Override
54 | public void downloadComplete(IProject project) {
55 | repository.addProject(project);
56 | }
57 | });
58 | }
59 | }
60 | }
61 |
62 | return null;
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/eclipse.ui/org.eclipse.flight.ui.integration/src/org/eclipse/flux/ui/integration/handlers/SyncDownloadSelectionDialog.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others.
3 | * All rights reserved. This program and the accompanying materials are made
4 | * available under the terms of the Eclipse Public License v1.0
5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
7 | *
8 | * Contributors:
9 | * Pivotal Software, Inc. - initial API and implementation
10 | *******************************************************************************/
11 | package org.eclipse.flux.ui.integration.handlers;
12 |
13 | import java.util.ArrayList;
14 | import java.util.List;
15 |
16 | import org.eclipse.flux.core.CallbackIDAwareMessageHandler;
17 | import org.eclipse.flux.core.IMessagingConnector;
18 | import org.eclipse.jface.viewers.ILabelProvider;
19 | import org.eclipse.swt.widgets.Shell;
20 | import org.eclipse.ui.dialogs.ElementListSelectionDialog;
21 | import org.json.JSONArray;
22 | import org.json.JSONException;
23 | import org.json.JSONObject;
24 |
25 | /**
26 | * @author Martin Lippert
27 | */
28 | public class SyncDownloadSelectionDialog extends ElementListSelectionDialog {
29 |
30 | private IMessagingConnector messagingConnector;
31 |
32 | public SyncDownloadSelectionDialog(final Shell parent, final ILabelProvider renderer, final IMessagingConnector messagingConnector) {
33 | super(parent, renderer);
34 | this.messagingConnector = messagingConnector;
35 |
36 | this.setMultipleSelection(true);
37 | this.setAllowDuplicates(false);
38 | this.setTitle("Import Synced Projects...");
39 | }
40 |
41 | @Override
42 | public int open() {
43 | try {
44 | int callbackID = this.hashCode();
45 |
46 | CallbackIDAwareMessageHandler responseHandler = new CallbackIDAwareMessageHandler("getProjectsResponse", callbackID) {
47 | @Override
48 | public void handleMessage(String messageType, JSONObject response) {
49 | try {
50 | ListmoduleName.
20 | * 21 | * This function is intented to by used when RequireJS is not available. 22 | *
23 | * 24 | * @param {String} name The mixin module name. 25 | * @param {String[]} deps The array of dependency names. 26 | * @param {Function} callback The definition function. 27 | */ 28 | if (!window.define) { 29 | window.define = function(name, deps, callback) { 30 | var module = this; 31 | var split = (name || "").split("/"), i, j; //$NON-NLS-0$ 32 | for (i = 0; i < split.length - 1; i++) { 33 | module = module[split[i]] = (module[split[i]] || {}); 34 | } 35 | var depModules = [], depModule; 36 | for (j = 0; j < deps.length; j++) { 37 | depModule = this; 38 | split = deps[j].split("/"); //$NON-NLS-0$ 39 | for (i = 0; i < split.length - 1; i++) { 40 | depModule = depModule[split[i]] = (depModule[split[i]] || {}); 41 | } 42 | depModules.push(depModule); 43 | } 44 | var newModule = callback.apply(this, depModules); 45 | for (var p in newModule) { 46 | if (newModule.hasOwnProperty(p)) { 47 | module[p] = newModule[p]; 48 | } 49 | } 50 | }; 51 | } 52 | 53 | /** 54 | * Require/get the defined modules. 55 | *56 | * This function is intented to by used when RequireJS is not available. 57 | *
58 | * 59 | * @param {String[]|String} deps The array of dependency names. This can also be 60 | * a string, a single dependency name. 61 | * @param {Function} [callback] Optional, the callback function to execute when 62 | * multiple dependencies are required. The callback arguments will have 63 | * references to each module in the same order as the deps array. 64 | * @returns {Object|undefined} If the deps parameter is a string, then this 65 | * function returns the required module definition, otherwise undefined is 66 | * returned. 67 | */ 68 | if (!window.require) { 69 | window.require = function(deps, callback) { 70 | var depsArr = typeof deps === "string" ? [deps] : deps; //$NON-NLS-0$ 71 | var depModules = [], depModule, split, i, j; 72 | for (j = 0; j < depsArr.length; j++) { 73 | depModule = this; 74 | split = depsArr[j].split("/"); //$NON-NLS-0$ 75 | for (i = 0; i < split.length - 1; i++) { 76 | depModule = depModule[split[i]] = (depModule[split[i]] || {}); 77 | } 78 | depModules.push(depModule); 79 | } 80 | if (callback) { 81 | callback.apply(this, depModules); 82 | } 83 | return typeof deps === "string" ? depModules[0] : undefined; //$NON-NLS-0$ 84 | }; 85 | } -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/src/org/eclipse/flux/ui/integration/handlers/SyncDisconnectHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others. 3 | * All rights reserved. This program and the accompanying materials are made 4 | * available under the terms of the Eclipse Public License v1.0 5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html). 7 | * 8 | * Contributors: 9 | * Pivotal Software, Inc. - initial API and implementation 10 | *******************************************************************************/ 11 | package org.eclipse.flux.ui.integration.handlers; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | import org.eclipse.core.commands.AbstractHandler; 17 | import org.eclipse.core.commands.ExecutionEvent; 18 | import org.eclipse.core.commands.ExecutionException; 19 | import org.eclipse.core.expressions.IEvaluationContext; 20 | import org.eclipse.core.resources.IProject; 21 | import org.eclipse.core.runtime.IAdaptable; 22 | import org.eclipse.flux.core.Repository; 23 | import org.eclipse.jface.viewers.ISelection; 24 | import org.eclipse.jface.viewers.IStructuredSelection; 25 | import org.eclipse.ui.ISources; 26 | import org.eclipse.ui.handlers.HandlerUtil; 27 | 28 | /** 29 | * @author Martin Lippert 30 | */ 31 | public class SyncDisconnectHandler extends AbstractHandler { 32 | 33 | @Override 34 | public Object execute(ExecutionEvent event) throws ExecutionException { 35 | ISelection selection = HandlerUtil.getCurrentSelection(event); 36 | IProject[] selectedProjects = getSelectedProjects(selection); 37 | 38 | Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository(); 39 | 40 | for (IProject project : selectedProjects) { 41 | if (repository.isConnected(project)) { 42 | repository.removeProject(project); 43 | } 44 | } 45 | 46 | return null; 47 | } 48 | 49 | @Override 50 | public void setEnabled(Object evaluationContext) { 51 | if (evaluationContext instanceof IEvaluationContext) { 52 | IEvaluationContext evalContext = (IEvaluationContext) evaluationContext; 53 | Object selection = evalContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME); 54 | if (selection instanceof ISelection) { 55 | IProject[] selectedProjects = getSelectedProjects((ISelection) selection); 56 | 57 | Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository(); 58 | for (IProject project : selectedProjects) { 59 | if (repository.isConnected(project)) { 60 | setBaseEnabled(true); 61 | return; 62 | } 63 | } 64 | } 65 | } 66 | 67 | setBaseEnabled(false); 68 | } 69 | 70 | protected IProject[] getSelectedProjects(ISelection selection) { 71 | List| View | 32 | 33 |
|---|
|
36 |
37 | Create the view by clicking one of the buttons at the bottom.
38 |
39 | |
40 |
45 |
| 48 | Contents: 49 | JavaScript 50 | HTML 51 | Java 52 | Plain 53 | Bidi 54 | URL: 55 | Lang: 61 | Load 62 | | 63 | 67 |
| 70 | Options: 71 | 72 | Read Only: 73 | 74 | 75 | Full Selection: 76 | 77 | 78 | Wrap: 79 | 80 | 81 | Expand Tabs: 82 | 83 | 84 | Tab Size: 85 | 86 | 87 | Theme: 88 | 94 | 95 | Set Options 96 | | 97 |
| 100 | Tests: 101 | Test 102 | Performance: 103 | 104 | Run 105 | | 106 |
eventName
29 | * will be passed to the event listener(s).
30 | * @param {Object} event The event to dispatch. The event object MUST have a type field
31 | * @returns {boolean} false if the event has been canceled and any associated default action should not be performed
32 | * listeners (if any) have resolved.
33 | */
34 | dispatchEvent: function(event) {
35 | if (!event.type) {
36 | throw new Error("unspecified type");
37 | }
38 | var listeners = this._namedListeners[event.type];
39 | if (listeners) {
40 | listeners.forEach(function(listener) {
41 | try {
42 | if (typeof listener === "function") {
43 | listener(event);
44 | } else {
45 | listener.handleEvent(event);
46 | }
47 | } catch (e) {
48 | if (typeof console !== 'undefined') {
49 | console.log(e); // for now, probably should dispatch an ("error", e)
50 | }
51 | }
52 | });
53 | }
54 | return !event.defaultPrevented;
55 | },
56 |
57 | /**
58 | * Adds an event listener for a named event
59 | * @param {String} eventName The event name
60 | * @param {Function} listener The function called when an event occurs
61 | */
62 | addEventListener: function(eventName, listener) {
63 | if (typeof listener === "function" || listener.handleEvent) {
64 | this._namedListeners[eventName] = this._namedListeners[eventName] || [];
65 | this._namedListeners[eventName].push(listener);
66 | }
67 | },
68 |
69 | /**
70 | * Removes an event listener for a named event
71 | * @param {String} eventName The event name
72 | * @param {Function} listener The function called when an event occurs
73 | */
74 | removeEventListener: function(eventName, listener) {
75 | var listeners = this._namedListeners[eventName];
76 | if (listeners) {
77 | for (var i = 0; i < listeners.length; i++) {
78 | if (listeners[i] === listener) {
79 | if (listeners.length === 1) {
80 | delete this._namedListeners[eventName];
81 | } else {
82 | listeners.splice(i, 1);
83 | }
84 | break;
85 | }
86 | }
87 | }
88 | }
89 | };
90 | EventTarget.prototype.constructor = EventTarget;
91 |
92 | EventTarget.attach = function(obj) {
93 | var eventTarget = new EventTarget();
94 | obj.dispatchEvent = eventTarget.dispatchEvent.bind(eventTarget);
95 | obj.addEventListener = eventTarget.addEventListener.bind(eventTarget);
96 | obj.removeEventListener = eventTarget.removeEventListener.bind(eventTarget);
97 | };
98 |
99 | return EventTarget;
100 | });
--------------------------------------------------------------------------------
/eclipse.ui/org.eclipse.flight.ui.integration/src/org/eclipse/flux/ui/integration/FluxUiPlugin.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others.
3 | * All rights reserved. This program and the accompanying materials are made
4 | * available under the terms of the Eclipse Public License v1.0
5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
7 | *
8 | * Contributors:
9 | * Pivotal Software, Inc. - initial API and implementation
10 | *******************************************************************************/
11 | package org.eclipse.flux.ui.integration;
12 |
13 | import org.eclipse.core.resources.IProject;
14 | import org.eclipse.flux.core.IRepositoryListener;
15 | import org.eclipse.flux.core.LiveEditCoordinator;
16 | import org.eclipse.flux.core.Repository;
17 | import org.eclipse.flux.ui.integration.handlers.LiveEditConnector;
18 | import org.eclipse.jface.resource.ImageDescriptor;
19 | import org.eclipse.jface.viewers.LabelProviderChangedEvent;
20 | import org.eclipse.swt.widgets.Display;
21 | import org.eclipse.ui.IStartup;
22 | import org.eclipse.ui.plugin.AbstractUIPlugin;
23 | import org.osgi.framework.BundleContext;
24 |
25 | /**
26 | * @author Martin Lippert
27 | */
28 | public class FluxUiPlugin extends AbstractUIPlugin implements IStartup {
29 |
30 | // The plug-in ID
31 | public static final String PLUGIN_ID = "org.eclipse.flux.ui.integration"; //$NON-NLS-1$
32 |
33 | // The shared instance
34 | private static FluxUiPlugin plugin;
35 |
36 | @Override
37 | public void start(BundleContext context) throws Exception {
38 | super.start(context);
39 | plugin = this;
40 | org.eclipse.flux.core.Activator.getDefault().getRepository()
41 | .addRepositoryListener(new IRepositoryListener() {
42 | @Override
43 | public void projectDisconnected(IProject project) {
44 | updateProjectLabel(project);
45 | }
46 |
47 | @Override
48 | public void projectConnected(IProject project) {
49 | updateProjectLabel(project);
50 | }
51 | });
52 |
53 | if (Boolean.getBoolean("flux-eclipse-editor-connect")) {
54 | Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository();
55 | LiveEditCoordinator liveEditCoordinator = org.eclipse.flux.core.Activator.getDefault().getLiveEditCoordinator();
56 | new LiveEditConnector(liveEditCoordinator, repository);
57 | }
58 | }
59 |
60 | @Override
61 | public void stop(BundleContext context) throws Exception {
62 | plugin = null;
63 | super.stop(context);
64 | }
65 |
66 | /**
67 | * Returns the shared instance
68 | *
69 | * @return the shared instance
70 | */
71 | public static FluxUiPlugin getDefault() {
72 | return plugin;
73 | }
74 |
75 | protected static void updateProjectLabel(final IProject project) {
76 | final CloudProjectDecorator projectDecorator = CloudProjectDecorator
77 | .getInstance();
78 | if (projectDecorator != null) {
79 | Display.getDefault().asyncExec(new Runnable() {
80 | public void run() {
81 | projectDecorator
82 | .fireLabelProviderChanged(new LabelProviderChangedEvent(
83 | projectDecorator, project));
84 | }
85 | });
86 | }
87 | }
88 |
89 | /**
90 | * Returns an image descriptor for the image file at the given plug-in
91 | * relative path
92 | *
93 | * @param path
94 | * the path
95 | * @return the image descriptor
96 | */
97 | public static ImageDescriptor getImageDescriptor(String path) {
98 | return imageDescriptorFromPlugin(PLUGIN_ID, path);
99 | }
100 |
101 | /**
102 | * @see org.eclipse.ui.IStartup#earlyStartup()
103 | */
104 | @Override
105 | public void earlyStartup() {
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/node.server/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | // Settings
3 | "passfail" : false, // Stop on first error.
4 | "maxerr" : 20, // Maximum error before stopping.
5 |
6 |
7 | // Predefined globals whom JSHint will ignore.
8 | "browser" : true, // Standard browser globals e.g. `window`, `document`.
9 |
10 | "node" : true,
11 | "rhino" : false,
12 | "couch" : false,
13 | "wsh" : false, // Windows Scripting Host.
14 |
15 | "jquery" : false,
16 | "prototypejs" : false,
17 | "mootools" : false,
18 | "dojo" : false,
19 |
20 | "predef" : [ // Custom globals.
21 | "define",
22 | "module",
23 | "$"
24 | ],
25 |
26 |
27 | // Development.
28 | "debug" : false, // Allow debugger statements e.g. browser breakpoints.
29 | "devel" : false, // Allow developments statements e.g. `console.log();`.
30 |
31 |
32 | // ECMAScript 5.
33 | "es5" : false, // Allow ECMAScript 5 syntax.
34 | "strict" : false, // Require `use strict` pragma in every file.
35 | "globalstrict" : false, // Allow global "use strict" (also enables 'strict').
36 |
37 |
38 | // The Good Parts.
39 | "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
40 | "laxbreak" : true, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
41 | "bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
42 | "boss" : true, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
43 | "curly" : true, // Require {} for every new block or scope.
44 | "eqeqeq" : false, // Require triple equals i.e. `===`.
45 | "eqnull" : true, // Tolerate use of `== null`.
46 | "evil" : false, // Tolerate use of `eval`.
47 | "expr" : true, // Tolerate `ExpressionStatement` as Programs.
48 | "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
49 | "immed" : false, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
50 | "latedef" : false, // Prohibit variable use before definition.
51 | "loopfunc" : false, // Allow functions to be defined within loops.
52 | "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
53 | "nonstandard" : false, // Defines non-standard but widely adopted globals such as escape and unescape.
54 | "regexp" : false, // Prohibit `.` and `[^...]` in regular expressions.
55 | "regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
56 | "scripturl" : true, // Tolerate script-targeted URLs.
57 | "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
58 | "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
59 | "undef" : true, // Require all non-global variables be declared before they are used.
60 |
61 |
62 | // Personal styling preferences.
63 | "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
64 | "noempty" : false, // Prohibit use of empty blocks.
65 | "nonew" : true, // Prohibit use of constructors for side-effects.
66 | "nomen" : false, // Prohibit use of initial or trailing underbars in names.
67 | "onevar" : false, // Allow only one `var` statement per function.
68 | "plusplus" : false, // Prohibit use of `++` & `--`.
69 | "sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
70 | "trailing" : true, // Prohibit trailing whitespaces.
71 | "indent" : 4, // Specify indentation spacing
72 | "white" : false, // Check against strict whitespace and indentation rules.
73 | "smarttabs" : true // Suppresses warnings about mixed tabs and spaces when the latter are used for alignment only
74 | }
75 |
--------------------------------------------------------------------------------
/eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/internal/messaging/SocketIOMessagingConnector.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others.
3 | * All rights reserved. This program and the accompanying materials are made
4 | * available under the terms of the Eclipse Public License v1.0
5 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
6 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
7 | *
8 | * Contributors:
9 | * Pivotal Software, Inc. - initial API and implementation
10 | *******************************************************************************/
11 | package org.eclipse.flux.core.internal.messaging;
12 |
13 | import io.socket.IOAcknowledge;
14 | import io.socket.IOCallback;
15 | import io.socket.SocketIO;
16 | import io.socket.SocketIOException;
17 |
18 | import java.net.MalformedURLException;
19 |
20 | import javax.net.ssl.SSLContext;
21 |
22 | import org.eclipse.flux.core.IMessagingConnector;
23 | import org.json.JSONObject;
24 |
25 | /**
26 | * @author Martin Lippert
27 | */
28 | public class SocketIOMessagingConnector extends AbstractMessagingConnector implements IMessagingConnector {
29 |
30 | static {
31 | javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
32 | public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
33 | return true;
34 | }
35 | });
36 | }
37 |
38 | private SocketIO socket;
39 | private String host;
40 |
41 | private transient boolean connectedToUserspace;
42 | private transient boolean connected;
43 |
44 | public SocketIOMessagingConnector(final String username) {
45 | host = System.getProperty("flux-host", "http://localhost:3000");
46 |
47 | try {
48 | SocketIO.setDefaultSSLSocketFactory(SSLContext.getInstance("Default"));
49 | socket = new SocketIO(host);
50 | socket.connect(new IOCallback() {
51 |
52 | @Override
53 | public void onMessage(JSONObject arg0, IOAcknowledge arg1) {
54 | }
55 |
56 | @Override
57 | public void onMessage(String arg0, IOAcknowledge arg1) {
58 | }
59 |
60 | @Override
61 | public void onError(SocketIOException ex) {
62 | ex.printStackTrace();
63 |
64 | try {
65 | socket = new SocketIO(host);
66 | socket.connect(this);
67 | } catch (MalformedURLException e) {
68 | e.printStackTrace();
69 | }
70 | }
71 |
72 | @Override
73 | public void onConnect() {
74 | try {
75 | connected = true;
76 |
77 | JSONObject message = new JSONObject();
78 | message.put("channel", username);
79 |
80 | socket.emit("connectToChannel", new IOAcknowledge() {
81 | @Override
82 | public void ack(Object... answer) {
83 | try {
84 | if (answer.length == 1 && answer[0] instanceof JSONObject && ((JSONObject)answer[0]).getBoolean("connectedToChannel")) {
85 | connectedToUserspace = true;
86 | notifyConnected();
87 | }
88 | }
89 | catch (Exception e) {
90 | e.printStackTrace();
91 | }
92 | }
93 | }, message);
94 | }
95 | catch (Exception e) {
96 | e.printStackTrace();
97 | }
98 | }
99 |
100 | @Override
101 | public void onDisconnect() {
102 | connected = false;
103 | notifyDisconnected();
104 | }
105 |
106 | @Override
107 | public void on(String event, IOAcknowledge ack, Object... data) {
108 | if (data.length == 1 && data[0] instanceof JSONObject) {
109 | handleIncomingMessage(event, (JSONObject)data[0]);
110 | }
111 | }
112 |
113 | });
114 | } catch (Exception e) {
115 | e.printStackTrace();
116 | }
117 | }
118 |
119 | @Override
120 | public void send(String messageType, JSONObject message) {
121 | socket.emit(messageType, message);
122 | }
123 |
124 | @Override
125 | public boolean isConnected() {
126 | return connected && connectedToUserspace;
127 | }
128 |
129 | }
130 |
--------------------------------------------------------------------------------
/node.server/messages-core.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * @license
3 | * Copyright (c) 2013, 2014 Pivotal Software, Inc. and others.
4 | * All rights reserved. This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License v1.0
6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
8 | *
9 | * Contributors:
10 | * Pivotal Software, Inc. - initial API and implementation
11 | *******************************************************************************/
12 | /*global require console exports process __dirname*/
13 |
14 | var MessageCore = function() {};
15 | exports.MessageCore = MessageCore;
16 |
17 | MessageCore.prototype.initialize = function(socket, sockets) {
18 | console.log('client connected for update notifications');
19 |
20 | this.configureBroadcast(socket, 'projectConnected');
21 | this.configureBroadcast(socket, 'projectDisconnected');
22 |
23 | this.configureBroadcast(socket, 'resourceCreated');
24 | this.configureBroadcast(socket, 'resourceChanged');
25 | this.configureBroadcast(socket, 'resourceDeleted');
26 | this.configureBroadcast(socket, 'resourceStored');
27 |
28 | this.configureBroadcast(socket, 'metadataChanged');
29 |
30 | this.configureRequest(socket, 'getProjectRequest');
31 | this.configureRequest(socket, 'getProjectsRequest');
32 | this.configureRequest(socket, 'getResourceRequest');
33 | this.configureRequest(socket, 'getMetadataRequest');
34 |
35 | this.configureResponse(socket, sockets, 'getProjectsResponse');
36 | this.configureResponse(socket, sockets, 'getProjectResponse');
37 | this.configureResponse(socket, sockets, 'getResourceResponse');
38 | this.configureResponse(socket, sockets, 'getMetadataResponse');
39 |
40 | this.configureRequest(socket, 'getLiveResourcesRequest');
41 | this.configureResponse(socket, sockets, 'getLiveResourcesResponse');
42 |
43 | this.configureRequest(socket, 'liveResourceStarted');
44 | this.configureResponse(socket, sockets, 'liveResourceStartedResponse');
45 |
46 | this.configureBroadcast(socket, 'liveResourceChanged');
47 | this.configureBroadcast(socket, 'liveMetadataChanged');
48 |
49 | this.configureRequest(socket, 'contentassistrequest');
50 | this.configureResponse(socket, sockets, 'contentassistresponse');
51 |
52 | this.configureRequest(socket, 'navigationrequest');
53 | this.configureResponse(socket, sockets, 'navigationresponse');
54 |
55 | this.configureRequest(socket, 'renameinfilerequest');
56 | this.configureResponse(socket, sockets, 'renameinfileresponse');
57 |
58 | socket.on('disconnect', function () {
59 | console.log('client disconnected from update notifications');
60 | });
61 |
62 | socket.on('connectToChannel', function(data, fn) {
63 | // TODO: is user allowed to join this user space?
64 | socket.join(data.channel);
65 | fn({
66 | 'connectedToChannel' : true
67 | });
68 | });
69 |
70 | socket.on('disconnectFromChannel', function(data, fn) {
71 | socket.leave(data.channel);
72 | if (fn) {
73 | fn({
74 | 'disconnectedFromChannel' : true
75 | });
76 | }
77 | });
78 |
79 | };
80 |
81 | MessageCore.prototype.configureBroadcast = function(socket, messageName) {
82 | socket.on(messageName, function(data) {
83 | if (data.username !== undefined) {
84 | socket.broadcast.to(data.username).emit(messageName, data);
85 | }
86 | socket.broadcast.to('internal').emit(messageName, data);
87 | });
88 | };
89 |
90 | MessageCore.prototype.configureRequest = function(socket, messageName) {
91 | socket.on(messageName, function(data) {
92 | data.requestSenderID = socket.id;
93 | if (data.username !== undefined) {
94 | socket.broadcast.to(data.username).emit(messageName, data);
95 | }
96 | socket.broadcast.to('internal').emit(messageName, data);
97 | });
98 | };
99 |
100 | MessageCore.prototype.configureResponse = function(socket, sockets, messageName) {
101 | socket.on(messageName, function(data) {
102 | sockets.socket(data.requestSenderID).emit(messageName, data);
103 | });
104 | };
105 |
--------------------------------------------------------------------------------
/node.server/web-editor/js/orion/bootstrap.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * @license
3 | * Copyright (c) 2011, 2012 IBM Corporation and others.
4 | * All rights reserved. This program and the accompanying materials are made
5 | * available under the terms of the Eclipse Public License v1.0
6 | * (https://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
7 | * License v1.0 (https://www.eclipse.org/org/documents/edl-v10.html).
8 | *
9 | * Contributors:
10 | * IBM Corporation - initial API and implementation
11 | *******************************************************************************/
12 | /*global define document window eclipse orion serviceRegistry:true widgets alert console localStorage setTimeout*/
13 | /*browser:true*/
14 |
15 | define(['require', 'orion/Deferred', 'orion/serviceregistry', 'orion/preferences', 'orion/pluginregistry', 'orion/config'], function(require, Deferred, mServiceregistry, mPreferences, mPluginRegistry, mConfig) {
16 |
17 | var once; // Deferred
18 |
19 | function startup() {
20 | if (once) {
21 | return once;
22 | }
23 | once = new Deferred();
24 |
25 | // initialize service registry and EAS services
26 | var serviceRegistry = new mServiceregistry.ServiceRegistry();
27 |
28 | // This is code to ensure the first visit to orion works
29 | // we read settings and wait for the plugin registry to fully startup before continuing
30 | var preferences = new mPreferences.PreferencesService(serviceRegistry);
31 | return preferences.getPreferences("/plugins").then(function(pluginsPreference) { //$NON-NLS-0$
32 | var configuration = {plugins:{}};
33 | pluginsPreference.keys().forEach(function(key) {
34 | var url = require.toUrl(key);
35 | configuration.plugins[url] = pluginsPreference[key];
36 | });
37 | var pluginRegistry = new mPluginRegistry.PluginRegistry(serviceRegistry, configuration);
38 | return pluginRegistry.start().then(function() {
39 | if (serviceRegistry.getServiceReferences("orion.core.preference.provider").length > 0) { //$NON-NLS-0$
40 | return preferences.getPreferences("/plugins", preferences.USER_SCOPE).then(function(pluginsPreference) { //$NON-NLS-0$
41 | var installs = [];
42 | pluginsPreference.keys().forEach(function(key) {
43 | var url = require.toUrl(key);
44 | if (!pluginRegistry.getPlugin(url)) {
45 | installs.push(pluginRegistry.installPlugin(url,{autostart: "lazy"}).then(function(plugin) {
46 | return plugin.update().then(function() {
47 | return plugin.start({lazy:true});
48 | });
49 | }));
50 | }
51 | });
52 | return Deferred.all(installs, function(e){
53 | console.log(e);
54 | });
55 | });
56 | }
57 | }).then(function() {
58 | return new mConfig.ConfigurationAdminFactory(serviceRegistry, pluginRegistry, preferences).getConfigurationAdmin().then(
59 | serviceRegistry.registerService.bind(serviceRegistry, "orion.cm.configadmin") //$NON-NLS-0$
60 | );
61 | }).then(function() {
62 | var auth = serviceRegistry.getService("orion.core.auth"); //$NON-NLS-0$
63 | if (auth) {
64 | var authPromise = auth.getUser().then(function(user) {
65 | if (!user) {
66 | return auth.getAuthForm(window.location.href).then(function(formURL) {
67 | setTimeout(function() {
68 | window.location = formURL;
69 | }, 0);
70 | });
71 | } else {
72 | localStorage.setItem("lastLogin", new Date().getTime()); //$NON-NLS-0$
73 | }
74 | });
75 | var lastLogin = localStorage.getItem("lastLogin");
76 | if (!lastLogin || lastLogin < (new Date().getTime() - (15 * 60 * 1000))) { // 15 minutes
77 | return authPromise; // if returned waits for auth check before continuing
78 | }
79 | }
80 | }).then(function() {
81 | var result = {
82 | serviceRegistry: serviceRegistry,
83 | preferences: preferences,
84 | pluginRegistry: pluginRegistry
85 | };
86 | once.resolve(result);
87 | return result;
88 | });
89 | });
90 | }
91 | return {startup: startup};
92 | });
93 |
--------------------------------------------------------------------------------
/node.server/web-editor/js/editor/sha1.js:
--------------------------------------------------------------------------------
1 | /*
2 | CryptoJS v3.1.2
3 | code.google.com/p/crypto-js
4 | (c) 2009-2013 by Jeff Mott. All rights reserved.
5 | code.google.com/p/crypto-js/wiki/License
6 | */
7 | var CryptoJS=CryptoJS||function(e,m){var p={},j=p.lib={},l=function(){},f=j.Base={extend:function(a){l.prototype=this;var c=new l;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
8 | n=j.WordArray=f.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=m?c:4*a.length},toString:function(a){return(a||h).stringify(this)},concat:function(a){var c=this.words,q=a.words,d=this.sigBytes;a=a.sigBytes;this.clamp();if(d%4)for(var b=0;b>>2]|=(q[b>>>2]>>>24-8*(b%4)&255)<<24-8*((d+b)%4);else if(65535