├── LICENSE ├── node.server ├── .project ├── web-editor │ ├── js │ │ ├── orion │ │ │ ├── editor │ │ │ │ ├── themes │ │ │ │ │ ├── default.css │ │ │ │ │ ├── eclipse.css │ │ │ │ │ ├── blue.css │ │ │ │ │ ├── nimbus.css │ │ │ │ │ ├── tierra.css │ │ │ │ │ ├── adelante.css │ │ │ │ │ ├── prospecto.css │ │ │ │ │ ├── ambience.css │ │ │ │ │ └── raspberrypi.css │ │ │ │ ├── images │ │ │ │ │ ├── plus.png │ │ │ │ │ ├── task.gif │ │ │ │ │ ├── error.gif │ │ │ │ │ ├── search.gif │ │ │ │ │ ├── bookmark.gif │ │ │ │ │ ├── collapsed.png │ │ │ │ │ ├── expanded.png │ │ │ │ │ ├── multiple.gif │ │ │ │ │ ├── warning.gif │ │ │ │ │ ├── white_tab.png │ │ │ │ │ ├── breakpoint.gif │ │ │ │ │ ├── currentLine.gif │ │ │ │ │ ├── white_space.png │ │ │ │ │ ├── currentBracket.png │ │ │ │ │ ├── squiggly_error.png │ │ │ │ │ ├── squiggly_task.png │ │ │ │ │ ├── flat-icons │ │ │ │ │ │ ├── error.png │ │ │ │ │ │ ├── task.png │ │ │ │ │ │ ├── bookmark.png │ │ │ │ │ │ └── warning.png │ │ │ │ │ ├── mark_occurrences.gif │ │ │ │ │ ├── matchingBracket.png │ │ │ │ │ ├── squiggly_warning.png │ │ │ │ │ ├── squiggly_bookmark.png │ │ │ │ │ └── squiggly_breakpoint.png │ │ │ │ ├── editor.css │ │ │ │ ├── rulers.css │ │ │ │ ├── textview.css │ │ │ │ ├── tooltip.css │ │ │ │ ├── i18n.js │ │ │ │ ├── editorFeatures.js │ │ │ │ ├── nls │ │ │ │ │ └── messages.js │ │ │ │ ├── contentassist.css │ │ │ │ ├── util.js │ │ │ │ ├── default-theme.css │ │ │ │ ├── htmlGrammar.js │ │ │ │ ├── global.js │ │ │ │ ├── shim.js │ │ │ │ └── factories.js │ │ │ ├── serialize.js │ │ │ ├── blameAnnotations.js │ │ │ ├── log.js │ │ │ ├── form.js │ │ │ ├── url.js │ │ │ ├── problems.js │ │ │ ├── fileUtils.js │ │ │ ├── testHelpers.js │ │ │ ├── regex.js │ │ │ ├── i18nUtil.js │ │ │ ├── objects.js │ │ │ ├── util.js │ │ │ ├── Storage.js │ │ │ ├── EventTarget.js │ │ │ ├── bootstrap.js │ │ │ ├── HTMLTemplates-shim.js │ │ │ ├── operation.js │ │ │ └── i18n.js │ │ ├── editor │ │ │ ├── textview │ │ │ │ ├── class_obj.gif │ │ │ │ ├── methdef_obj.gif │ │ │ │ ├── methpri_obj.gif │ │ │ │ ├── methpro_obj.gif │ │ │ │ ├── methpub_obj.gif │ │ │ │ ├── field_default_obj.gif │ │ │ │ ├── field_private_obj.gif │ │ │ │ ├── field_public_obj.gif │ │ │ │ ├── field_protected_obj.gif │ │ │ │ ├── themes │ │ │ │ │ ├── default.css │ │ │ │ │ ├── orion.css │ │ │ │ │ └── dark.css │ │ │ │ ├── demo.css │ │ │ │ ├── htmlStyles.css │ │ │ │ ├── embeddededitor.css │ │ │ │ ├── textstyler.css │ │ │ │ └── demo.html │ │ │ ├── javaContentAssist.js │ │ │ └── sha1.js │ │ └── requirejs │ │ │ └── domReady.js │ └── html │ │ └── editor.html ├── package.json ├── startup-messaging-editor.js ├── startup-memory-repository.js ├── startup-mongodb-repository.js ├── startup-all-in-one.js ├── .jshintrc ├── messages-core.js └── repository-rest-api.js ├── .gitignore ├── EDL v1.0 license.txt ├── eclipse.services.java └── org.eclipse.flight.jdt.service │ ├── build.properties │ ├── .classpath │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ ├── META-INF │ └── MANIFEST.MF │ ├── .project │ ├── about.html │ └── src │ └── org │ └── eclipse │ └── flux │ └── jdt │ └── services │ ├── Activator.java │ ├── LiveEditProblemRequestor.java │ └── RenameService.java ├── eclipse.core └── org.eclipse.flight.core │ ├── lib │ └── socketio.jar │ ├── build.properties │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ ├── .classpath │ ├── .project │ ├── src │ └── org │ │ └── eclipse │ │ └── flux │ │ └── core │ │ ├── IConnectionListener.java │ │ ├── IRepositoryListener.java │ │ ├── IMessageHandler.java │ │ ├── IMessagingConnector.java │ │ ├── AbstractMessageHandler.java │ │ ├── ILiveEditConnector.java │ │ ├── CallbackIDAwareMessageHandler.java │ │ ├── internal │ │ ├── CloudSyncMetadataListener.java │ │ ├── CloudSyncResourceListener.java │ │ └── messaging │ │ │ ├── AbstractMessagingConnector.java │ │ │ └── SocketIOMessagingConnector.java │ │ └── ConnectedProject.java │ ├── META-INF │ └── MANIFEST.MF │ └── about.html ├── eclipse.ui └── org.eclipse.flight.ui.integration │ ├── build.properties │ ├── .classpath │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ ├── .project │ ├── META-INF │ └── MANIFEST.MF │ ├── about.html │ ├── src │ └── org │ │ └── eclipse │ │ └── flux │ │ └── ui │ │ └── integration │ │ ├── handlers │ │ ├── PendingLiveEditStartedResponse.java │ │ ├── SyncDownloadHandler.java │ │ ├── SyncDownloadSelectionDialog.java │ │ ├── SyncDisconnectHandler.java │ │ └── SyncConnectHandler.java │ │ ├── CloudProjectDecorator.java │ │ └── FluxUiPlugin.java │ └── plugin.xml └── eclipse.releng ├── .project └── flux-eclipse-target.target /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /node.server/.project: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | bin/ 3 | node_modules/ 4 | /node.server/plugable-fs/github-fs/secret.json 5 | -------------------------------------------------------------------------------- /EDL v1.0 license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/EDL v1.0 license.txt -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/themes/default.css: -------------------------------------------------------------------------------- 1 | @import "../../../orion/editor/editor.css"; 2 | -------------------------------------------------------------------------------- /eclipse.services.java/org.eclipse.flight.jdt.service/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = bin/ 3 | bin.includes = META-INF/,\ 4 | . 5 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/lib/socketio.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/eclipse.core/org.eclipse.flight.core/lib/socketio.jar -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/plus.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/task.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/task.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/class_obj.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/editor/textview/class_obj.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/error.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/error.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/search.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/search.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/methdef_obj.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/editor/textview/methdef_obj.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/methpri_obj.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/editor/textview/methpri_obj.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/methpro_obj.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/editor/textview/methpro_obj.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/methpub_obj.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/editor/textview/methpub_obj.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/bookmark.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/bookmark.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/collapsed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/collapsed.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/expanded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/expanded.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/multiple.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/multiple.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/warning.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/warning.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/white_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/white_tab.png -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = bin/ 3 | bin.includes = META-INF/,\ 4 | .,\ 5 | lib/socketio.jar 6 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/breakpoint.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/breakpoint.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/currentLine.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/currentLine.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/white_space.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/white_space.png -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = bin/ 3 | bin.includes = META-INF/,\ 4 | .,\ 5 | plugin.xml 6 | -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/field_default_obj.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/editor/textview/field_default_obj.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/field_private_obj.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/editor/textview/field_private_obj.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/field_public_obj.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/editor/textview/field_public_obj.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/currentBracket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/currentBracket.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/squiggly_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/squiggly_error.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/squiggly_task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/squiggly_task.png -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/field_protected_obj.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/editor/textview/field_protected_obj.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/flat-icons/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/flat-icons/error.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/flat-icons/task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/flat-icons/task.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/mark_occurrences.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/mark_occurrences.gif -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/matchingBracket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/matchingBracket.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/squiggly_warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/squiggly_warning.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/flat-icons/bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/flat-icons/bookmark.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/flat-icons/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/flat-icons/warning.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/squiggly_bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/squiggly_bookmark.png -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/images/squiggly_breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-attic/flight627/master/node.server/web-editor/js/orion/editor/images/squiggly_breakpoint.png -------------------------------------------------------------------------------- /eclipse.releng/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.eclipse.flux.releng 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/themes/default.css: -------------------------------------------------------------------------------- 1 | @import "../../../orion/textview/textview.css"; 2 | @import "../../../orion/textview/rulers.css"; 3 | @import "../../../orion/textview/annotations.css"; 4 | @import "../../../orion/textview/tooltip.css"; 5 | @import "../textstyler.css"; 6 | @import "../../editor/htmlStyles.css"; 7 | -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/demo.css: -------------------------------------------------------------------------------- 1 | @import "./themes/default.css"; 2 | 3 | .button { 4 | color: teal; 5 | cursor: pointer; 6 | text-decoration: underline; 7 | padding: 0px 2px 0px 2px; 8 | } 9 | 10 | .parentElement { 11 | border: 1px solid teal; 12 | } 13 | 14 | .option { 15 | border: 1px solid teal; 16 | padding: 2px 2px 3px 2px; 17 | } 18 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/editor.css: -------------------------------------------------------------------------------- 1 | @import "../../orion/editor/textview.css"; 2 | @import "../../orion/editor/rulers.css"; 3 | @import "../../orion/editor/tooltip.css"; 4 | @import "../../orion/editor/contentassist.css"; 5 | 6 | @import "../../examples/editor/textstyler.css"; 7 | @import "../../orion/editor/default-theme.css"; 8 | 9 | @import "../../orion/editor/annotations.css"; -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/themes/orion.css: -------------------------------------------------------------------------------- 1 | .orion { 2 | color: black; 3 | } 4 | 5 | .orion .textview { 6 | background-color: #ffd400; 7 | } 8 | 9 | .orion .ruler { 10 | background-color: #ededed; 11 | } 12 | 13 | .orion .line_caret { 14 | background-color: #fcffca; 15 | } 16 | 17 | .orion .annotationLine.currentLine { 18 | background-color: #fcffca; 19 | } -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/rulers.css: -------------------------------------------------------------------------------- 1 | /* Styles for rulers */ 2 | .ruler { 3 | } 4 | .ruler.annotations { 5 | width: 16px; 6 | } 7 | .ruler.folding { 8 | width: 14px; 9 | } 10 | .ruler.lines { 11 | text-align: right; 12 | } 13 | .ruler.overview { 14 | width: 14px; 15 | } 16 | 17 | /* Styles for the line number ruler */ 18 | .rulerLines { 19 | color: silver; 20 | } 21 | .rulerLines.even 22 | .rulerLines.odd { 23 | } -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.7 8 | -------------------------------------------------------------------------------- /eclipse.services.java/org.eclipse.flight.jdt.service/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.7 8 | -------------------------------------------------------------------------------- /eclipse.services.java/org.eclipse.flight.jdt.service/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.compliance=1.7 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.7 8 | -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/htmlStyles.css: -------------------------------------------------------------------------------- 1 | /* Styling for html syntax highlighting */ 2 | .entity-name-tag { 3 | color: #3f7f7f; 4 | } 5 | 6 | .entity-other-attribute-name { 7 | color: #7f007f; 8 | } 9 | 10 | .punctuation-definition-comment { 11 | color: #3f5fbf; 12 | } 13 | 14 | .comment { 15 | color: #3f5fbf; 16 | } 17 | 18 | .string-quoted { 19 | color: #2a00ff; 20 | font-style: italic; 21 | } 22 | 23 | .invalid { 24 | color: red; 25 | font-weight: bold; 26 | } -------------------------------------------------------------------------------- /node.server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flux-server", 3 | "preferGlobal": true, 4 | "version": "0.1.0", 5 | "author": "Martin Lippert ", 6 | "description": "Project Flux - Server", 7 | "dependencies" : { 8 | "express" : "3.0.x", 9 | "socket.io" : "0.9.x", 10 | "socket.io-client" : "0.9.x", 11 | "mongodb" : "1.3.x" 12 | }, 13 | 14 | "scripts": { 15 | "start": "node startup-all-in-one.js" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/themes/dark.css: -------------------------------------------------------------------------------- 1 | .dark { 2 | color: gray; 3 | font-size: 12pt; 4 | } 5 | 6 | .dark .textview { 7 | background-color: #202020; 8 | } 9 | 10 | .dark .ruler { 11 | color: white; 12 | background-color: #505050; 13 | } 14 | 15 | .dark .token_doc_comment { 16 | color: magenta; 17 | } 18 | 19 | .dark .line_caret { 20 | background-color: #fefefe; 21 | } 22 | 23 | .dark .annotationLine.currentLine { 24 | background-color: #fefefe; 25 | } 26 | 27 | .dark .annotationRange.task { 28 | color: magenta; 29 | } -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/textview.css: -------------------------------------------------------------------------------- 1 | .textview { 2 | background-color: white; 3 | font-family: "Consolas", "Monaco", "Vera Mono", "monospace"; 4 | font-size: 10pt; 5 | min-width: 50px; 6 | min-height: 50px; 7 | } 8 | 9 | .textviewScroll { 10 | padding: 1px 2px; 11 | } 12 | 13 | .textviewContent { 14 | cursor: auto; 15 | } 16 | 17 | .textviewLeftRuler { 18 | border-right: 1px solid #eaeaea; 19 | } 20 | 21 | .textviewRightRuler { 22 | border-left: 1px solid #eaeaea; 23 | } 24 | 25 | .textviewMarginRuler { 26 | border-left: 1px solid #eaeaea; 27 | } 28 | 29 | .textviewBlockCursor { 30 | background: black; 31 | opacity: 0.4; 32 | } -------------------------------------------------------------------------------- /eclipse.services.java/org.eclipse.flight.jdt.service/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: JDT as a service 4 | Bundle-SymbolicName: org.eclipse.flux.jdt.service 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-RequiredExecutionEnvironment: JavaSE-1.7 7 | Require-Bundle: org.eclipse.flux.core, 8 | org.eclipse.jdt.core, 9 | org.json, 10 | org.eclipse.core.runtime, 11 | org.eclipse.core.resources 12 | Bundle-Activator: org.eclipse.flux.jdt.services.Activator 13 | Bundle-Vendor: Eclipse.org - Flux 14 | Import-Package: org.apache.commons.codec.digest 15 | Export-Package: org.eclipse.flux.jdt.services 16 | Bundle-ActivationPolicy: lazy 17 | 18 | -------------------------------------------------------------------------------- /eclipse.releng/flux-eclipse-target.target: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.eclipse.flux.core 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.pde.PluginNature 26 | org.eclipse.jdt.core.javanature 27 | 28 | 29 | -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.eclipse.flux.ui.integration 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.pde.PluginNature 26 | org.eclipse.jdt.core.javanature 27 | 28 | 29 | -------------------------------------------------------------------------------- /eclipse.services.java/org.eclipse.flight.jdt.service/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.eclipse.flux.jdt.service 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.pde.ManifestBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.pde.SchemaBuilder 20 | 21 | 22 | 23 | 24 | 25 | org.eclipse.pde.PluginNature 26 | org.eclipse.jdt.core.javanature 27 | 28 | 29 | -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: Flux UI Integration 4 | Bundle-SymbolicName: org.eclipse.flux.ui.integration;singleton:=true 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-Vendor: Eclipse.org - Flux 7 | Bundle-RequiredExecutionEnvironment: JavaSE-1.7 8 | Require-Bundle: org.eclipse.ui, 9 | org.eclipse.core.resources, 10 | org.eclipse.core.runtime, 11 | org.eclipse.core.expressions, 12 | org.json, 13 | org.eclipse.flux.core, 14 | org.eclipse.jdt.ui, 15 | org.eclipse.ui.workbench.texteditor, 16 | org.eclipse.jface.text, 17 | org.eclipse.flux.jdt.service;bundle-version="1.0.0";resolution:=optional, 18 | org.apache.commons.lang, 19 | org.apache.commons.codec, 20 | org.eclipse.core.filebuffers 21 | Bundle-Activator: org.eclipse.flux.ui.integration.FluxUiPlugin 22 | Bundle-ActivationPolicy: lazy 23 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/IConnectionListener.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 | /** 14 | * @author Martin Lippert 15 | */ 16 | public interface IConnectionListener { 17 | 18 | void connected(); 19 | void disconnected(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: Flux Core 4 | Bundle-SymbolicName: org.eclipse.flux.core 5 | Bundle-Version: 1.0.0.qualifier 6 | Bundle-Vendor: Eclipse.org - Flux 7 | Bundle-RequiredExecutionEnvironment: JavaSE-1.7 8 | Import-Package: org.apache.commons.lang, 9 | org.osgi.framework 10 | Require-Bundle: org.json, 11 | org.eclipse.core.resources, 12 | org.apache.commons.codec, 13 | org.eclipse.core.runtime, 14 | org.apache.commons.io, 15 | org.eclipse.jdt.core 16 | Bundle-ClassPath: lib/socketio.jar, 17 | . 18 | Export-Package: org.eclipse.flux.core 19 | Bundle-ActivationPolicy: lazy; exclude:="io.socket, org.java_websocket, org.java_websocket.client, org.java_websocket.drafts, org.java_websocket.exceptions, org.java_websocket.framing, org.java_websocket.handshake, org.java_websocket.server, org.java_websocket.util, org.json" 20 | Bundle-Activator: org.eclipse.flux.core.Activator 21 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/tooltip.css: -------------------------------------------------------------------------------- 1 | .tooltipTheme.textview { 2 | background-color: InfoBackground !important; 3 | color: InfoText !important; 4 | } 5 | 6 | .tooltipTheme .textviewScroll { 7 | padding: 0px; 8 | } 9 | 10 | /* Styles for the view tooltips */ 11 | .textviewTooltip { 12 | font-family: "Consolas", "Monaco", "Vera Mono", "monospace"; 13 | font-size: 10pt; 14 | background-color: InfoBackground; 15 | color: InfoText; 16 | padding: 2px; 17 | border-radius: 4px; 18 | border: 1px solid black; 19 | z-index: 100; 20 | position: fixed; 21 | overflow: hidden; 22 | } 23 | 24 | .textviewTooltip em { 25 | font-style: normal; 26 | font-weight: bold; 27 | } 28 | 29 | .textviewTooltip span { 30 | vertical-align: baseline; 31 | } 32 | 33 | .textviewTooltip .tooltipRow { 34 | display: table-row; 35 | } 36 | 37 | .textviewTooltip .tooltipTitle { 38 | float: right; 39 | } 40 | 41 | .tooltipTheme .annotationLine.currentLine { 42 | background-color: transparent !important; 43 | } -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/IRepositoryListener.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.eclipse.core.resources.IProject; 14 | 15 | /** 16 | * @author Martin Lippert 17 | */ 18 | public interface IRepositoryListener { 19 | 20 | void projectConnected(IProject project); 21 | void projectDisconnected(IProject project); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/i18n.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 | define({ 14 | load: function(name, parentRequire, onLoad, config) { 15 | if (parentRequire.specified && parentRequire.specified("orion/bootstrap")) { //$NON-NLS-0$ 16 | parentRequire(["orion/i18n!" + name], function(languages) { //$NON-NLS-0$ 17 | onLoad(languages); 18 | }); 19 | } else { 20 | onLoad({}); 21 | } 22 | } 23 | }); -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/IMessageHandler.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 interface IMessageHandler { 19 | 20 | String getMessageType(); 21 | 22 | boolean canHandle(String messageType, JSONObject message); 23 | void handleMessage(String messageType, JSONObject message); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/embeddededitor.css: -------------------------------------------------------------------------------- 1 | @import "../../orion/editor/textview.css"; 2 | @import "../../orion/editor/rulers.css"; 3 | @import "../../orion/editor/annotations.css"; 4 | @import "../../orion/editor/tooltip.css"; 5 | @import "../../orion/editor/contentassist.css"; 6 | @import "textstyler.css"; 7 | @import "htmlStyles.css"; 8 | 9 | body { 10 | margin: 0; 11 | padding: 0; 12 | font: 14px Monaco; 13 | } 14 | 15 | a { 16 | cursor: hand; 17 | text-decoration: none; 18 | color: #ffffff; 19 | } 20 | 21 | a:hover { 22 | cursor: hand; 23 | text-decoration: underline; 24 | color: #ffffff; 25 | } 26 | /* 27 | .contentassist { 28 | display: none; 29 | background-color: #ffffff; 30 | padding: 2px; 31 | position: fixed; 32 | top: 100px; 33 | left: 100px; 34 | border: 1px solid #cccccc; 35 | z-index:10; 36 | cursor: default; 37 | overflow: auto; 38 | height: 150px; 39 | width: 500px; 40 | } 41 | 42 | .contentassist .selected { 43 | background-color: #dddddd; 44 | } 45 | 46 | .textviewContainer { 47 | font: 14px Monaco; 48 | } 49 | */ -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/editorFeatures.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 | 14 | define("orion/editor/editorFeatures", [ //$NON-NLS-0$ 15 | 'orion/editor/factories', //$NON-NLS-0$ 16 | 'orion/editor/actions', //$NON-NLS-0$ 17 | 'orion/editor/linkedMode', //$NON-NLS-0$ 18 | 'orion/objects' //$NON-NLS-0$ 19 | ], function(mFactories, mActions, mLinkedMode, objects) { 20 | return objects.mixin({}, mFactories, mActions, mLinkedMode); 21 | }); 22 | -------------------------------------------------------------------------------- /node.server/web-editor/html/editor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Embedded Orion Editor 8 | 9 | 10 | 11 | 24 | 25 | 26 | 27 |
28 |
29 | 30 | 31 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/nls/messages.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: 10 | * Felipe Heidrich (IBM Corporation) - initial API and implementation 11 | * Silenio Quarti (IBM Corporation) - initial API and implementation 12 | ******************************************************************************/ 13 | 14 | /*global define*/ 15 | 16 | define(['orion/editor/i18n!orion/editor/nls/messages', 'orion/editor/nls/root/messages'], function(bundle, root) { 17 | var result = { 18 | root: root 19 | }; 20 | for (var key in bundle) { 21 | if (bundle.hasOwnProperty(key)) { 22 | if (typeof result[key] === 'undefined') { 23 | result[key] = bundle[key]; 24 | } 25 | } 26 | } 27 | return result; 28 | }); 29 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/IMessagingConnector.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 interface IMessagingConnector { 19 | 20 | boolean isConnected(); 21 | void send(String messageType, JSONObject message); 22 | 23 | void addConnectionListener(IConnectionListener connectionListener); 24 | void removeConnectionListener(IConnectionListener connectionListener); 25 | void addMessageHandler(IMessageHandler messageHandler); 26 | void removeMessageHandler(IMessageHandler messageHandler); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/AbstractMessageHandler.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 AbstractMessageHandler implements IMessageHandler { 19 | 20 | private String messageType; 21 | 22 | public AbstractMessageHandler(String messageType) { 23 | this.messageType = messageType; 24 | } 25 | 26 | @Override 27 | public String getMessageType() { 28 | return this.messageType; 29 | } 30 | 31 | @Override 32 | public boolean canHandle(String messageType, JSONObject message) { 33 | return this.messageType.equals(messageType); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/ILiveEditConnector.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 | /** 14 | * @author Martin Lippert 15 | */ 16 | public interface ILiveEditConnector { 17 | 18 | String getConnectorID(); 19 | 20 | void liveEditingStarted(String requestSenderID, int callbackID, String username, String resourcePath, String hash, long timestamp); 21 | void liveEditingStartedResponse(String requestSenderID, int callbackID, String username, String projectName, String resourcePath, String savePointHash, long savePointTimestamp, String content); 22 | void liveEditingEvent(String username, String resourcePath, int offset, int removeCount, String newText); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/textstyler.css: -------------------------------------------------------------------------------- 1 | .token_singleline_comment { 2 | color: green; 3 | } 4 | 5 | .token_multiline_comment { 6 | color: green; 7 | } 8 | 9 | .token_doc_comment { 10 | color: #00008F; 11 | } 12 | 13 | .token_doc_html_markup { 14 | color: #7F7F9F; 15 | } 16 | 17 | .token_doc_tag { 18 | color: #7F9FBF; 19 | } 20 | 21 | .token_task_tag { 22 | color: #7F9FBF; 23 | } 24 | 25 | .token_string { 26 | color: blue; 27 | } 28 | 29 | .token_number { 30 | color: blue; 31 | } 32 | 33 | .token_keyword { 34 | color: darkred; 35 | font-weight: bold; 36 | } 37 | 38 | .token_space { 39 | /* images/white_space.png */ 40 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAABnRSTlMA/wAAAACkwsAdAAAAIUlEQVR4nGP4z8CAC+GUIEXuABhgkTuABEiRw2cmae4EAH05X7xDolNRAAAAAElFTkSuQmCC"); 41 | background-repeat: no-repeat; 42 | background-position: center center; 43 | } 44 | 45 | .token_tab { 46 | /* images/white_tab.png */ 47 | background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAJCAIAAACJ2loDAAAABnRSTlMA/wD/AP83WBt9AAAAMklEQVR4nGP4TwRgoK6i52c3bz5w6zMSA6tJn28d2Lx589nnCAYu63AaSLxJRLoJPwAAeNk0aG4opfMAAAAASUVORK5CYII="); 48 | background-repeat: no-repeat; 49 | background-position: left center; 50 | } 51 | 52 | .line_caret { 53 | background-color: #EAF2FE; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/themes/eclipse.css: -------------------------------------------------------------------------------- 1 | .eclipse { 2 | color: darkSlateGray; 3 | } 4 | .eclipse.textview { 5 | background-color: white; 6 | } 7 | .eclipse .ruler.annotations { 8 | background-color: white; 9 | } 10 | .eclipse .ruler.lines { 11 | background-color: white; 12 | } 13 | .eclipse .ruler.folding { 14 | background-color: white; 15 | } 16 | .eclipse .ruler.overview { 17 | background-color: white; 18 | } 19 | .eclipse .rulerLines { 20 | color: #444; 21 | } 22 | .eclipse .rulerLines.even { 23 | color: #444; 24 | } 25 | .eclipse .rulerLines.odd { 26 | color: #444; 27 | } 28 | .eclipse .annotationLine.currentLine { 29 | background-color: #EAF2FE; 30 | } 31 | .eclipse .entity-name-tag { 32 | color: #7f0055; 33 | } 34 | .eclipse .entity-other-attribute-name { 35 | color: cadetBlue; 36 | } 37 | .eclipse .string-quoted { 38 | color: blue; 39 | } 40 | .eclipse .line_caret { 41 | background-color: #EAF2FE; 42 | } 43 | .eclipse .token_keyword { 44 | color: #7f0055; 45 | } 46 | .eclipse .token_string { 47 | color: blue; 48 | } 49 | .eclipse .token_singleline_comment { 50 | color: green; 51 | } 52 | .eclipse .token_multiline_comment { 53 | color: green; 54 | } 55 | .eclipse .token_doc_comment { 56 | color: green; 57 | } 58 | .eclipse .token_doc_html_markup { 59 | color: green; 60 | } -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/themes/blue.css: -------------------------------------------------------------------------------- 1 | .blue { 2 | color: navy; 3 | } 4 | .blue.textview { 5 | background-color: aliceBlue; 6 | } 7 | .blue .ruler.annotations { 8 | background-color: lavender; 9 | } 10 | .blue .ruler.lines { 11 | background-color: lavender; 12 | } 13 | .blue .ruler.folding { 14 | background-color: lavender; 15 | } 16 | .blue .ruler.overview { 17 | background-color: lavender; 18 | } 19 | .blue .rulerLines { 20 | color: darkSlateGray; 21 | } 22 | .blue .rulerLines.even { 23 | color: darkSlateGray; 24 | } 25 | .blue .rulerLines.odd { 26 | color: darkSlateGray; 27 | } 28 | .blue .annotationLine.currentLine { 29 | background-color: white; 30 | } 31 | .blue .entity-name-tag { 32 | color: cornFlowerBlue; 33 | } 34 | .blue .entity-other-attribute-name { 35 | color: cadetBlue; 36 | } 37 | .blue .string-quoted { 38 | color: cornFlowerBlue; 39 | } 40 | .blue .line_caret { 41 | background-color: white; 42 | } 43 | .blue .token_keyword { 44 | color: cornFlowerBlue; 45 | } 46 | .blue .token_string { 47 | color: cornFlowerBlue; 48 | } 49 | .blue .token_singleline_comment { 50 | color: indigo; 51 | } 52 | .blue .token_multiline_comment { 53 | color: indigo; 54 | } 55 | .blue .token_doc_comment { 56 | color: indigo; 57 | } 58 | .blue .token_doc_html_markup { 59 | color: indigo; 60 | } -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/themes/nimbus.css: -------------------------------------------------------------------------------- 1 | .nimbus { 2 | color: white; 3 | } 4 | .nimbus.textview { 5 | background-color: dimgray; 6 | } 7 | .nimbus .ruler.annotations { 8 | background-color: #444; 9 | } 10 | .nimbus .ruler.lines { 11 | background-color: #444; 12 | } 13 | .nimbus .ruler.folding { 14 | background-color: #444; 15 | } 16 | .nimbus .ruler.overview { 17 | background-color: #444; 18 | } 19 | .nimbus .rulerLines { 20 | color: #aaa; 21 | } 22 | .nimbus .rulerLines.even { 23 | color: #aaa; 24 | } 25 | .nimbus .rulerLines.odd { 26 | color: #aaa; 27 | } 28 | .nimbus .annotationLine.currentLine { 29 | background-color: #aabfbb; 30 | } 31 | .nimbus .entity-name-tag { 32 | color: darkorange; 33 | } 34 | .nimbus .entity-other-attribute-name { 35 | color: cadetBlue; 36 | } 37 | .nimbus .string-quoted { 38 | color: cornflowerblue; 39 | } 40 | .nimbus .line_caret { 41 | background-color: #aabfbb; 42 | } 43 | .nimbus .token_keyword { 44 | color: darkorange; 45 | } 46 | .nimbus .token_string { 47 | color: cornflowerblue; 48 | } 49 | .nimbus .token_singleline_comment { 50 | color: darkseagreen; 51 | } 52 | .nimbus .token_multiline_comment { 53 | color: darkseagreen; 54 | } 55 | .nimbus .token_doc_comment { 56 | color: darkseagreen; 57 | } 58 | .nimbus .token_doc_html_markup { 59 | color: darkseagreen; 60 | } -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/themes/tierra.css: -------------------------------------------------------------------------------- 1 | .tierra { 2 | color: #555555; 3 | } 4 | .tierra.textview { 5 | background-color: lemonchiffon; 6 | } 7 | .tierra .ruler.annotations { 8 | background-color: moccasin; 9 | } 10 | .tierra .ruler.lines { 11 | background-color: moccasin; 12 | } 13 | .tierra .ruler.folding { 14 | background-color: moccasin; 15 | } 16 | .tierra .ruler.overview { 17 | background-color: moccasin; 18 | } 19 | .tierra .rulerLines { 20 | color: chocolate; 21 | } 22 | .tierra .rulerLines.even { 23 | color: chocolate; 24 | } 25 | .tierra .rulerLines.odd { 26 | color: chocolate; 27 | } 28 | .tierra .annotationLine.currentLine { 29 | background-color: #baa289; 30 | } 31 | .tierra .entity-name-tag { 32 | color: darkred; 33 | } 34 | .tierra .entity-other-attribute-name { 35 | color: cadetBlue; 36 | } 37 | .tierra .string-quoted { 38 | color: orangered; 39 | } 40 | .tierra .line_caret { 41 | background-color: #baa289; 42 | } 43 | .tierra .token_keyword { 44 | color: darkred; 45 | } 46 | .tierra .token_string { 47 | color: orangered; 48 | } 49 | .tierra .token_singleline_comment { 50 | color: darkseagreen; 51 | } 52 | .tierra .token_multiline_comment { 53 | color: darkseagreen; 54 | } 55 | .tierra .token_doc_comment { 56 | color: darkseagreen; 57 | } 58 | .tierra .token_doc_html_markup { 59 | color: darkseagreen; 60 | } -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/themes/adelante.css: -------------------------------------------------------------------------------- 1 | .adelante { 2 | color: dimgray; 3 | } 4 | .adelante.textview { 5 | background-color: #F1E7C8; 6 | } 7 | .adelante .ruler.annotations { 8 | background-color: #E2D2B2; 9 | } 10 | .adelante .ruler.lines { 11 | background-color: #E2D2B2; 12 | } 13 | .adelante .ruler.folding { 14 | background-color: #E2D2B2; 15 | } 16 | .adelante .ruler.overview { 17 | background-color: #E2D2B2; 18 | } 19 | .adelante .rulerLines { 20 | color: #AF473B; 21 | } 22 | .adelante .rulerLines.even { 23 | color: #AF473B; 24 | } 25 | .adelante .rulerLines.odd { 26 | color: #AF473B; 27 | } 28 | .adelante .annotationLine.currentLine { 29 | background-color: #9e937b; 30 | } 31 | .adelante .entity-name-tag { 32 | color: #AF473B; 33 | } 34 | .adelante .entity-other-attribute-name { 35 | color: cadetBlue; 36 | } 37 | .adelante .string-quoted { 38 | color: #DE5D3B; 39 | } 40 | .adelante .line_caret { 41 | background-color: #9e937b; 42 | } 43 | .adelante .token_keyword { 44 | color: #AF473B; 45 | } 46 | .adelante .token_string { 47 | color: #DE5D3B; 48 | } 49 | .adelante .token_singleline_comment { 50 | color: #5D774E; 51 | } 52 | .adelante .token_multiline_comment { 53 | color: #5D774E; 54 | } 55 | .adelante .token_doc_comment { 56 | color: #5D774E; 57 | } 58 | .adelante .token_doc_html_markup { 59 | color: #5D774E; 60 | } -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/themes/prospecto.css: -------------------------------------------------------------------------------- 1 | .prospecto { 2 | color: #333; 3 | } 4 | .prospecto.textview { 5 | background-color: white; 6 | } 7 | .prospecto .ruler.annotations { 8 | background-color: white; 9 | } 10 | .prospecto .ruler.lines { 11 | background-color: white; 12 | } 13 | .prospecto .ruler.folding { 14 | background-color: white; 15 | } 16 | .prospecto .ruler.overview { 17 | background-color: white; 18 | } 19 | .prospecto .rulerLines { 20 | color: silver; 21 | } 22 | .prospecto .rulerLines.even { 23 | color: silver; 24 | } 25 | .prospecto .rulerLines.odd { 26 | color: silver; 27 | } 28 | .prospecto .annotationLine.currentLine { 29 | background-color: #EAF2FE; 30 | } 31 | .prospecto .entity-name-tag { 32 | color: #CC4C07; 33 | } 34 | .prospecto .entity-other-attribute-name { 35 | color: cadetBlue; 36 | } 37 | .prospecto .string-quoted { 38 | color: #446FBD; 39 | } 40 | .prospecto .line_caret { 41 | background-color: #EAF2FE; 42 | } 43 | .prospecto .token_keyword { 44 | color: #CC4C07; 45 | } 46 | .prospecto .token_string { 47 | color: #446FBD; 48 | } 49 | .prospecto .token_singleline_comment { 50 | color: #3C802C; 51 | } 52 | .prospecto .token_multiline_comment { 53 | color: #3C802C; 54 | } 55 | .prospecto .token_doc_comment { 56 | color: #3C802C; 57 | } 58 | .prospecto .token_doc_html_markup { 59 | color: #3C802C; 60 | } -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/serialize.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 | 14 | /** 15 | * Converts an 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 | About 7 | 8 | 9 |

About This Content

10 | 11 |

April 18, 2014

12 |

License

13 | 14 |

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 | About 7 | 8 | 9 |

About This Content

10 | 11 |

April 18, 2014

12 |

License

13 | 14 |

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 | About 7 | 8 | 9 |

About This Content

10 | 11 |

April 18, 2014

12 |

License

13 | 14 |

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 of str 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 | List projectsNames = new ArrayList(); 51 | JSONArray projects = response.getJSONArray("projects"); 52 | for (int i = 0; i < projects.length(); i++) { 53 | JSONObject project = projects.getJSONObject(i); 54 | String projectName = project.getString("name"); 55 | 56 | projectsNames.add(projectName); 57 | } 58 | setElements((String[]) projectsNames.toArray(new String[projectsNames.size()])); 59 | } 60 | catch (Exception e) { 61 | e.printStackTrace(); 62 | } 63 | 64 | messagingConnector.removeMessageHandler(this); 65 | } 66 | }; 67 | 68 | this.messagingConnector.addMessageHandler(responseHandler); 69 | 70 | JSONObject message = new JSONObject(); 71 | message.put("callback_id", callbackID); 72 | this.messagingConnector.send("getProjectsRequest", message); 73 | } catch (JSONException e1) { 74 | e1.printStackTrace(); 75 | } 76 | 77 | return super.open(); 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /node.server/startup-all-in-one.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 mongo = require('mongodb'); 17 | var app = express(); 18 | 19 | app.use("/client", express.static(__dirname + '/web-editor')); 20 | 21 | var host = process.env.VCAP_APP_HOST || 'localhost'; 22 | var port = process.env.VCAP_APP_PORT || '3000'; 23 | 24 | var messagingHost = process.env.FLIGHT_MESSAGING_HOST || 'localhost'; 25 | var messagingPort = process.env.FLIGHT_MESSAGING_PORT || 3000; 26 | 27 | var server = app.listen(port, host); 28 | console.log('Express server started on port ' + port); 29 | 30 | // create and configure socket.io 31 | var io = require('socket.io').listen(server); 32 | io.set('transports', ['websocket']); 33 | 34 | // create and configure services 35 | var MessageCore = require('./messages-core.js').MessageCore; 36 | var messageSync = new MessageCore(); 37 | 38 | io.sockets.on('connection', function (socket) { 39 | messageSync.initialize(socket, io.sockets); 40 | }); 41 | 42 | // check for MongoDB and create in-memory-repo in case MongoDB is not available 43 | var MongoClient = mongo.MongoClient; 44 | MongoClient.connect("mongodb://localhost:27017/flight-db", function(err, db) { 45 | 46 | var Repository; 47 | var repository; 48 | 49 | if (err) { 50 | console.log('create in-memory backup repository'); 51 | Repository = require('./repository-inmemory.js').Repository; 52 | } 53 | else { 54 | console.log('create mongodb-based backup repository'); 55 | Repository = require('./repository-mongodb.js').Repository; 56 | } 57 | 58 | repository = new Repository(); 59 | 60 | var RestRepository = require('./repository-rest-api.js').RestRepository; 61 | var restrepository = new RestRepository(app, repository); 62 | 63 | var MessagesRepository = require('./repository-message-api.js').MessagesRepository; 64 | var messagesrepository = new MessagesRepository(repository); 65 | 66 | var client_io = require('socket.io-client'); 67 | 68 | var client_socket = client_io.connect(messagingHost, { 69 | port : messagingPort 70 | }); 71 | 72 | client_socket.on('connect', function() { 73 | console.log('client socket connected'); 74 | 75 | client_socket.emit('connectToChannel', { 76 | 'channel' : 'internal' 77 | }, function(answer) { 78 | if (answer.connectedToChannel) { 79 | repository.setNotificationSender.call(repository, client_socket); 80 | messagesrepository.setSocket.call(messagesrepository, client_socket); 81 | } 82 | }); 83 | }); 84 | 85 | }); 86 | -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/internal/messaging/AbstractMessagingConnector.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 java.util.Collection; 14 | import java.util.concurrent.ConcurrentHashMap; 15 | import java.util.concurrent.ConcurrentLinkedDeque; 16 | import java.util.concurrent.ConcurrentMap; 17 | 18 | import org.eclipse.flux.core.IConnectionListener; 19 | import org.eclipse.flux.core.IMessageHandler; 20 | import org.eclipse.flux.core.IMessagingConnector; 21 | import org.json.JSONObject; 22 | 23 | /** 24 | * @author Martin Lippert 25 | */ 26 | public abstract class AbstractMessagingConnector implements IMessagingConnector { 27 | 28 | private Collection connectionListeners; 29 | private ConcurrentMap> messageHandlers; 30 | 31 | public AbstractMessagingConnector() { 32 | this.connectionListeners = new ConcurrentLinkedDeque<>(); 33 | this.messageHandlers = new ConcurrentHashMap<>(); 34 | } 35 | 36 | @Override 37 | public void addConnectionListener(IConnectionListener connectionListener) { 38 | this.connectionListeners.add(connectionListener); 39 | } 40 | 41 | @Override 42 | public void removeConnectionListener(IConnectionListener connectionListener) { 43 | this.connectionListeners.remove(connectionListener); 44 | } 45 | 46 | @Override 47 | public void addMessageHandler(IMessageHandler messageHandler) { 48 | this.messageHandlers.putIfAbsent(messageHandler.getMessageType(), new ConcurrentLinkedDeque()); 49 | this.messageHandlers.get(messageHandler.getMessageType()).add(messageHandler); 50 | } 51 | 52 | @Override 53 | public void removeMessageHandler(IMessageHandler messageHandler) { 54 | this.messageHandlers.get(messageHandler.getMessageType()).remove(messageHandler); 55 | } 56 | 57 | protected void notifyConnected() { 58 | for (IConnectionListener connectionListener : connectionListeners) { 59 | connectionListener.connected(); 60 | } 61 | } 62 | 63 | protected void notifyDisconnected() { 64 | for (IConnectionListener connectionListener : connectionListeners) { 65 | connectionListener.disconnected(); 66 | } 67 | } 68 | 69 | protected void handleIncomingMessage(String messageType, JSONObject message) { 70 | Collection handlers = this.messageHandlers.get(messageType); 71 | if (handlers != null) { 72 | for (IMessageHandler handler : handlers) { 73 | if (handler.canHandle(messageType, message)) { 74 | handler.handleMessage(messageType, message); 75 | } 76 | } 77 | } 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/htmlGrammar.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: IBM Corporation - initial API and implementation 10 | ******************************************************************************/ 11 | 12 | /*jslint */ 13 | /*global define */ 14 | 15 | define("orion/editor/htmlGrammar", [], function() { 16 | 17 | /** 18 | * Provides a grammar that can do some very rough syntax highlighting for HTML. 19 | * @class orion.syntax.HtmlGrammar 20 | */ 21 | function HtmlGrammar() { 22 | /** 23 | * Object containing the grammar rules. 24 | * @public 25 | * @type Object 26 | */ 27 | return { 28 | "scopeName": "source.html", 29 | "uuid": "3B5C76FB-EBB5-D930-F40C-047D082CE99B", 30 | "patterns": [ 31 | { 32 | "begin": "", 34 | "contentName": "entity.name.tag.doctype.html", 35 | "beginCaptures": { 36 | "0": { "name": "entity.name.tag.doctype.html" } 37 | }, 38 | "endCaptures": { 39 | "0": { "name": "entity.name.tag.doctype.html" } 40 | } 41 | }, 42 | { 43 | "begin": "", 45 | "beginCaptures": { 46 | "0": { "name": "punctuation.definition.comment.html" } 47 | }, 48 | "endCaptures": { 49 | "0": { "name": "punctuation.definition.comment.html" } 50 | }, 51 | "patterns": [ 52 | { 53 | "match": "--", 54 | "name": "invalid.illegal.badcomment.html" 55 | } 56 | ], 57 | "contentName": "comment.block.html" 58 | }, 59 | { // startDelimiter + tagName 60 | "match": "<[A-Za-z0-9_\\-:]+(?= ?)", 61 | "name": "entity.name.tag.html" 62 | }, 63 | { "include": "#attrName" }, 64 | { "include": "#qString" }, 65 | { "include": "#qqString" }, 66 | { "include": "#entity" }, 67 | // TODO attrName, qString, qqString should be applied first while inside a tag 68 | { // startDelimiter + slash + tagName + endDelimiter 69 | "match": "", 70 | "name": "entity.name.tag.html" 71 | }, 72 | { // end delimiter of open tag 73 | "match": ">", 74 | "name": "entity.name.tag.html" 75 | } ], 76 | "repository": { 77 | "attrName": { // attribute name 78 | "match": "[A-Za-z\\-:]+(?=\\s*=\\s*['\"])", 79 | "name": "entity.other.attribute.name.html" 80 | }, 81 | "qqString": { // double quoted string 82 | "match": "(\")[^\"]+(\")", 83 | "name": "string.quoted.double.html" 84 | }, 85 | "qString": { // single quoted string 86 | "match": "(')[^']+(\')", 87 | "name": "string.quoted.single.html" 88 | }, 89 | "entity": { 90 | "match": "&[A-Za-z0-9]+;", 91 | "name": "constant.character.entity.html" 92 | } 93 | } 94 | }; 95 | } 96 | 97 | return {HtmlGrammar: HtmlGrammar}; 98 | }); 99 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/global.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: 10 | * Felipe Heidrich (IBM Corporation) - initial API and implementation 11 | * Silenio Quarti (IBM Corporation) - initial API and implementation 12 | * Mihai Sucan (Mozilla Foundation) - fix for Bug#364214 13 | */ 14 | 15 | /*global window */ 16 | 17 | /** 18 | * Evaluates the definition function and mixes in the returned module with 19 | * the module specified by moduleName. 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 | ListselectedProjects = new ArrayList(); 72 | 73 | if (selection instanceof IStructuredSelection) { 74 | IStructuredSelection structuredSelection = (IStructuredSelection) selection; 75 | Object[] selectedObjects = structuredSelection.toArray(); 76 | for (int i = 0; i < selectedObjects.length; i++) { 77 | if (selectedObjects[i] instanceof IAdaptable) { 78 | IProject project = (IProject) ((IAdaptable)selectedObjects[i]).getAdapter(IProject.class); 79 | if (project != null) { 80 | selectedProjects.add(project); 81 | } 82 | } 83 | } 84 | } 85 | 86 | return (IProject[]) selectedProjects.toArray(new IProject[selectedProjects.size()]); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/Storage.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: 10 | * IBM Corporation - initial API and implementation 11 | *******************************************************************************/ 12 | /*global define console */ 13 | 14 | define(["orion/EventTarget"], function(EventTarget) { 15 | function StorageEvent(key, oldValue, newValue, storageArea, timeStamp) { 16 | return { 17 | type: "storage", 18 | key: key, 19 | oldValue: oldValue || null, 20 | newValue: newValue || null, 21 | url : "", 22 | storageArea: storageArea, 23 | timeStamp: timeStamp || new Date().getTime() 24 | }; 25 | } 26 | 27 | // Should use an ES6 proxy for getter/setter/deleter -- someday 28 | function Storage(obj, prefix) { 29 | var _eventTarget = new EventTarget(); 30 | var _keys; 31 | 32 | this.addEventListener = _eventTarget.addEventListener.bind(_eventTarget); 33 | this.removeEventListener = _eventTarget.removeEventListener.bind(_eventTarget); 34 | 35 | function _getKeys() { 36 | if (!_keys) { 37 | _keys = Object.keys(obj); 38 | if (prefix) { 39 | _keys = _keys.filter(function(key) { 40 | return key.indexOf(prefix) === 0; 41 | }); 42 | } 43 | } 44 | return _keys; 45 | } 46 | 47 | this.key = function(index) { 48 | return _getKeys()[index]; 49 | }; 50 | 51 | this.getItem = function(key) { 52 | key = prefix ? prefix + key : key; 53 | var value = obj[key]; 54 | _eventTarget.dispatchEvent({type: "_getItem", key: key, storage: obj}); 55 | return value; 56 | }; 57 | 58 | this.setItem = function(key, value) { 59 | key = prefix ? prefix + key : key; 60 | obj[key] = value; 61 | _keys = null; 62 | _eventTarget.dispatchEvent({type: "_setItem", key: key, value: value, storage: obj}); 63 | }; 64 | 65 | this.removeItem = function(key) { 66 | key = prefix ? prefix + key : key; 67 | delete obj[key]; 68 | _keys = null; 69 | _eventTarget.dispatchEvent({type: "_removeItem", key: key, storage: obj}); 70 | }; 71 | 72 | this.clear = function() { 73 | _getKeys().forEach(function(key) { 74 | this.removeItem(key); 75 | }.bind(this)); 76 | }; 77 | 78 | this._update = function(key, value, timeStamp) { 79 | if (prefix && key.indexOf(prefix) !== 0) { 80 | return; 81 | } 82 | var oldValue = obj[key]; 83 | obj[key] = value; 84 | key = key.substring(prefix.length); 85 | _eventTarget.dispatchEvent(new StorageEvent(key, oldValue, value, this, timeStamp)); 86 | }; 87 | 88 | this._dispatchUpdate = function(key, oldValue, newValue, timeStamp) { 89 | if (prefix && key.indexOf(prefix) !== 0) { 90 | return; 91 | } 92 | key = key.substring(prefix.length); 93 | _eventTarget.dispatchEvent(new StorageEvent(key, oldValue, newValue, this, timeStamp)); 94 | }; 95 | 96 | Object.defineProperty(this, "length", { 97 | get : function() { 98 | return _getKeys().length; 99 | } 100 | }); 101 | } 102 | return Storage; 103 | }); -------------------------------------------------------------------------------- /eclipse.core/org.eclipse.flight.core/src/org/eclipse/flux/core/ConnectedProject.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 java.io.IOException; 14 | import java.io.InputStream; 15 | import java.util.Map; 16 | import java.util.concurrent.ConcurrentHashMap; 17 | 18 | import org.apache.commons.codec.digest.DigestUtils; 19 | import org.eclipse.core.resources.IContainer; 20 | import org.eclipse.core.resources.IFile; 21 | import org.eclipse.core.resources.IFolder; 22 | import org.eclipse.core.resources.IProject; 23 | import org.eclipse.core.resources.IResource; 24 | import org.eclipse.core.resources.IResourceVisitor; 25 | import org.eclipse.core.runtime.CoreException; 26 | 27 | /** 28 | * @author Martin Lippert 29 | */ 30 | public class ConnectedProject { 31 | 32 | private IProject project; 33 | private Map resourceHash; 34 | private Map resourceTimestamp; 35 | 36 | public ConnectedProject(IProject project) { 37 | this.project = project; 38 | this.resourceHash = new ConcurrentHashMap(); 39 | this.resourceTimestamp = new ConcurrentHashMap(); 40 | 41 | try { 42 | project.accept(new IResourceVisitor() { 43 | @Override 44 | public boolean visit(IResource resource) throws CoreException { 45 | String path = resource.getProjectRelativePath().toString(); 46 | ConnectedProject.this.setTimestamp(path, resource.getLocalTimeStamp()); 47 | 48 | if (resource instanceof IFile) { 49 | try { 50 | IFile file = (IFile) resource; 51 | ConnectedProject.this.setHash(path, DigestUtils.shaHex(file.getContents())); 52 | } catch (IOException e) { 53 | e.printStackTrace(); 54 | } 55 | } 56 | else if (resource instanceof IFolder) { 57 | ConnectedProject.this.setHash(path, "0"); 58 | } 59 | 60 | return true; 61 | } 62 | }, IResource.DEPTH_INFINITE, IContainer.EXCLUDE_DERIVED); 63 | } catch (Exception e) { 64 | e.printStackTrace(); 65 | } 66 | 67 | } 68 | 69 | public IProject getProject() { 70 | return project; 71 | } 72 | 73 | public String getName() { 74 | return this.project.getName(); 75 | } 76 | 77 | public static ConnectedProject readFromJSON(InputStream inputStream, IProject project) { 78 | return new ConnectedProject(project); 79 | } 80 | 81 | public void setTimestamp(String resourcePath, long newTimestamp) { 82 | this.resourceTimestamp.put(resourcePath, newTimestamp); 83 | } 84 | 85 | public long getTimestamp(String resourcePath) { 86 | return this.resourceTimestamp.get(resourcePath); 87 | } 88 | 89 | public void setHash(String resourcePath, String hash) { 90 | this.resourceHash.put(resourcePath, hash); 91 | } 92 | 93 | public String getHash(String resourcePath) { 94 | return this.resourceHash.get(resourcePath); 95 | } 96 | 97 | public boolean containsResource(String resourcePath) { 98 | return this.resourceTimestamp.containsKey(resourcePath); 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/src/org/eclipse/flux/ui/integration/handlers/SyncConnectHandler.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 SyncConnectHandler extends AbstractHandler { 32 | 33 | public static final String ID = "org.springsource.ide.eclipse.ui.cloudsync.connect"; 34 | 35 | @Override 36 | public Object execute(ExecutionEvent event) throws ExecutionException { 37 | ISelection selection = HandlerUtil.getCurrentSelection(event); 38 | IProject[] selectedProjects = getSelectedProjects(selection); 39 | 40 | Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository(); 41 | 42 | for (IProject project : selectedProjects) { 43 | if (!repository.isConnected(project)) { 44 | repository.addProject(project); 45 | } 46 | } 47 | 48 | return null; 49 | } 50 | 51 | @Override 52 | public void setEnabled(Object evaluationContext) { 53 | if (evaluationContext instanceof IEvaluationContext) { 54 | IEvaluationContext evalContext = (IEvaluationContext) evaluationContext; 55 | Object selection = evalContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME); 56 | if (selection instanceof ISelection) { 57 | IProject[] selectedProjects = getSelectedProjects((ISelection) selection); 58 | 59 | Repository repository = org.eclipse.flux.core.Activator.getDefault().getRepository(); 60 | for (IProject project : selectedProjects) { 61 | if (!repository.isConnected(project)) { 62 | setBaseEnabled(true); 63 | return; 64 | } 65 | } 66 | } 67 | } 68 | 69 | setBaseEnabled(false); 70 | } 71 | 72 | protected IProject[] getSelectedProjects(ISelection selection) { 73 | ListselectedProjects = new ArrayList(); 74 | 75 | if (selection instanceof IStructuredSelection) { 76 | IStructuredSelection structuredSelection = (IStructuredSelection) selection; 77 | Object[] selectedObjects = structuredSelection.toArray(); 78 | for (int i = 0; i < selectedObjects.length; i++) { 79 | if (selectedObjects[i] instanceof IAdaptable) { 80 | IProject project = (IProject) ((IAdaptable)selectedObjects[i]).getAdapter(IProject.class); 81 | if (project != null) { 82 | selectedProjects.add(project); 83 | } 84 | } 85 | } 86 | } 87 | 88 | return (IProject[]) selectedProjects.toArray(new IProject[selectedProjects.size()]); 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /eclipse.services.java/org.eclipse.flight.jdt.service/src/org/eclipse/flux/jdt/services/LiveEditProblemRequestor.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 java.util.ArrayList; 14 | import java.util.List; 15 | 16 | import org.eclipse.flux.core.IMessagingConnector; 17 | import org.eclipse.jdt.core.IProblemRequestor; 18 | import org.eclipse.jdt.core.compiler.IProblem; 19 | import org.json.JSONArray; 20 | import org.json.JSONObject; 21 | 22 | /** 23 | * @author Martin Lippert 24 | */ 25 | public class LiveEditProblemRequestor implements IProblemRequestor { 26 | 27 | private IMessagingConnector messagingConnector; 28 | private String resourcePath; 29 | private List problems; 30 | private String username; 31 | private String projectName; 32 | 33 | public LiveEditProblemRequestor(IMessagingConnector messagingConnector, String username, String projectName, String resourcePath) { 34 | this.messagingConnector = messagingConnector; 35 | this.username = username; 36 | this.projectName = projectName; 37 | this.resourcePath = resourcePath; 38 | 39 | this.problems = new ArrayList(); 40 | } 41 | 42 | @Override 43 | public void acceptProblem(IProblem problem) { 44 | this.problems.add(problem); 45 | } 46 | 47 | @Override 48 | public void beginReporting() { 49 | this.problems.clear(); 50 | } 51 | 52 | @Override 53 | public void endReporting() { 54 | sendMarkers((IProblem[]) this.problems.toArray(new IProblem[this.problems.size()])); 55 | } 56 | 57 | @Override 58 | public boolean isActive() { 59 | return true; 60 | } 61 | 62 | private void sendMarkers(IProblem[] problems) { 63 | String problemsJSON = toJSON(problems); 64 | try { 65 | JSONArray array = new JSONArray(problemsJSON); 66 | JSONObject message = new JSONObject(); 67 | message.put("username", this.username); 68 | message.put("project", this.projectName); 69 | message.put("resource", this.resourcePath); 70 | message.put("problems", array); 71 | 72 | messagingConnector.send("liveMetadataChanged", message); 73 | System.out.println("livemetadata transmitted"); 74 | } catch (Exception e) { 75 | e.printStackTrace(); 76 | } 77 | } 78 | 79 | private String toJSON(IProblem[] problems) { 80 | StringBuilder result = new StringBuilder(); 81 | boolean flag = false; 82 | result.append("["); 83 | for (IProblem problem : problems) { 84 | if (flag) { 85 | result.append(","); 86 | } 87 | 88 | result.append("{"); 89 | result.append("\"description\":" + JSONObject.quote(problem.getMessage())); 90 | result.append(",\"line\":" + problem.getSourceLineNumber()); 91 | result.append(",\"severity\":\"" + (problem.isError() ? "error" : "warning") + "\""); 92 | result.append(",\"start\":" + problem.getSourceStart()); 93 | 94 | int end = problem.getSourceEnd() + 1; 95 | 96 | result.append(",\"end\":" + end); 97 | result.append("}"); 98 | 99 | flag = true; 100 | } 101 | result.append("]"); 102 | return result.toString(); 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /node.server/web-editor/js/editor/textview/demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Orion TextView Demo 9 | 10 | 11 | 12 | 24 | 25 | 26 | 27 |

Orion Text View Demo

28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 40 | 45 | 46 | 47 | 63 | 67 | 68 | 69 | 97 | 98 | 99 | 106 | 107 |
View
36 |
37 | Create the view by clicking one of the buttons at the bottom. 38 |
39 |
48 | Contents: 49 | JavaScript 50 | HTML 51 | Java 52 | Plain 53 | Bidi 54 | URL: 55 | Lang: 61 | Load 62 |
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 |
100 | Tests: 101 | Test 102 | Performance: 103 | 104 | Run 105 |
108 | 109 | 110 | -------------------------------------------------------------------------------- /eclipse.ui/org.eclipse.flight.ui.integration/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 10 | 13 | 16 | 18 | 20 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 35 | 37 | 40 | 42 | 43 | 44 | 45 | 46 | 47 | 50 | 51 | 52 | 53 | 54 | 55 | 57 | 61 | 62 | 63 | 64 | 66 | 70 | 71 | 72 | 73 | 75 | 79 | 80 | 81 | 82 | 83 | 90 | 91 | 92 | 93 | 94 | 95 | 97 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/EventTarget.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: 10 | * IBM Corporation - initial API and implementation 11 | *******************************************************************************/ 12 | /*global define console*/ 13 | 14 | define(function() { 15 | /** 16 | * Creates an Event Target 17 | * 18 | * @name orion.EventTarget 19 | * @class Base for creating an Orion event target 20 | */ 21 | function EventTarget() { 22 | this._namedListeners = {}; 23 | } 24 | 25 | EventTarget.prototype = /** @lends orion.EventTarget.prototype */ 26 | { 27 | /** 28 | * Dispatches a named event along with an arbitrary set of arguments. Any arguments after 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>>2]=q[b>>>2];else c.push.apply(c,q);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< 9 | 32-8*(c%4);a.length=e.ceil(c/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],b=0;b>>2]>>>24-8*(d%4)&255;b.push((f>>>4).toString(16));b.push((f&15).toString(16))}return b.join("")},parse:function(a){for(var c=a.length,b=[],d=0;d>>3]|=parseInt(a.substr(d, 10 | 2),16)<<24-4*(d%8);return new n.init(b,c/2)}},g=b.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],d=0;d>>2]>>>24-8*(d%4)&255));return b.join("")},parse:function(a){for(var c=a.length,b=[],d=0;d>>2]|=(a.charCodeAt(d)&255)<<24-8*(d%4);return new n.init(b,c)}},r=b.Utf8={stringify:function(a){try{return decodeURIComponent(escape(g.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return g.parse(unescape(encodeURIComponent(a)))}}, 11 | k=j.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new n.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=r.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,b=c.words,d=c.sigBytes,f=this.blockSize,h=d/(4*f),h=a?e.ceil(h):e.max((h|0)-this._minBufferSize,0);a=h*f;d=e.min(4*a,d);if(a){for(var g=0;ga;a++){if(16>a)l[a]=f[n+a]|0;else{var c=l[a-3]^l[a-8]^l[a-14]^l[a-16];l[a]=c<<1|c>>>31}c=(h<<5|h>>>27)+j+l[a];c=20>a?c+((g&e|~g&k)+1518500249):40>a?c+((g^e^k)+1859775393):60>a?c+((g&e|g&k|e&k)-1894007588):c+((g^e^ 15 | k)-899497514);j=k;k=e;e=g<<30|g>>>2;g=h;h=c}b[0]=b[0]+h|0;b[1]=b[1]+g|0;b[2]=b[2]+e|0;b[3]=b[3]+k|0;b[4]=b[4]+j|0},_doFinalize:function(){var f=this._data,e=f.words,b=8*this._nDataBytes,h=8*f.sigBytes;e[h>>>5]|=128<<24-h%32;e[(h+64>>>9<<4)+14]=Math.floor(b/4294967296);e[(h+64>>>9<<4)+15]=b;f.sigBytes=4*e.length;this._process();return this._hash},clone:function(){var e=j.clone.call(this);e._hash=this._hash.clone();return e}});e.SHA1=j._createHelper(m);e.HmacSHA1=j._createHmacHelper(m)})(); 16 | -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/shim.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/shim", [], function() { //$NON-NLS-0$ 15 | 16 | /** 17 | * Partial ECMAScript 5 shim. 18 | */ 19 | 20 | if (!Object.create) { 21 | /* This shim does not properly support the props paramenter. It only works for Deferred.js. */ 22 | Object.create = function(proto, props) { 23 | function N() {} 24 | N.prototype = proto; 25 | var result = new N(); 26 | if (props) { 27 | for (var p in props) { 28 | if (props.hasOwnProperty(p)) { 29 | if (props[p].hasOwnProperty("value")) { //$NON-NLS-0$ 30 | result[p] = props[p].value; 31 | } else { 32 | result[p] = function() { 33 | if (arguments.length > 0) { 34 | return props[p].get(); 35 | } else { 36 | props[p].set(arguments); 37 | } 38 | }; 39 | } 40 | } 41 | } 42 | } 43 | return result; 44 | }; 45 | } 46 | if (!Object.keys) { 47 | Object.keys = function(o) { 48 | var result = []; 49 | for (var p in o) { 50 | if (o.hasOwnProperty(p)) { 51 | result.push(p); 52 | } 53 | } 54 | return result; 55 | }; 56 | } 57 | 58 | if (!Function.prototype.bind) { 59 | Function.prototype.bind = function (context) { 60 | var fn = this, fixed = Array.prototype.slice.call(arguments, 1); 61 | if (fixed.length) { 62 | return function() { 63 | return arguments.length ? fn.apply(context, fixed.concat(Array.prototype.slice.call(arguments))) : fn.apply(context, fixed); 64 | }; 65 | } 66 | return function() { 67 | return arguments.length ? fn.apply(context, arguments) : fn.call(context); 68 | }; 69 | }; 70 | } 71 | 72 | 73 | if (!Array.isArray) { 74 | Array.isArray = function(obj) { 75 | return Object.prototype.toString.call(obj) === "[object Array]"; 76 | }; 77 | } 78 | if (!Array.prototype.indexOf) { 79 | Array.prototype.indexOf = function(c) { 80 | for (var i=0; i i; ++i) { 112 | if (set) { 113 | result = func(result, this[i], i, this); 114 | } else { 115 | result = this[i]; 116 | set = true; 117 | } 118 | } 119 | return result; 120 | }; 121 | } 122 | 123 | if (!String.prototype.trim) { 124 | String.prototype.trim = function(){ 125 | return this.replace(/^\s+|\s+$/g, ''); 126 | }; 127 | } 128 | if (!String.prototype.trimLeft) { 129 | String.prototype.trimLeft = function(){ 130 | return this.replace(/^\s+/g, ''); 131 | }; 132 | } 133 | if (!String.prototype.trimRight) { 134 | String.prototype.trimRight = function(){ 135 | return this.replace(/\s+$/g, ''); 136 | }; 137 | } 138 | 139 | return {}; 140 | }); -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/HTMLTemplates-shim.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: 10 | * IBM Corporation - initial API and implementation 11 | *******************************************************************************/ 12 | /*global window document addEventListener removeEventListener*/ 13 | // HTML Templates Shim -- see https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html 14 | 15 | (function() { 16 | function shim() { 17 | document.body.insertAdjacentHTML("beforeend", ""); 18 | var testTemplate = document.getElementById("__testTemplate__"); 19 | var supportsTemplate = !! testTemplate.content; 20 | document.body.removeChild(testTemplate); 21 | if (supportsTemplate) { 22 | return; 23 | } 24 | 25 | var templatesDoc = document.implementation.createHTMLDocument(""); 26 | 27 | function shimTemplate(template) { 28 | if (template.ownerDocument !== document || template.content) { 29 | return; 30 | } 31 | templatesDoc = templatesDoc || document.implementation.createHTMLDocument(""); 32 | Object.defineProperty(template, "content", { 33 | value: templatesDoc.createDocumentFragment(), 34 | enumerable: true 35 | }); 36 | Object.defineProperty(template, "innerHTML", { 37 | set: function(text) { 38 | while (this.content.firstChild) { 39 | this.content.removeChild(this.content.firstChild); 40 | } 41 | var template = templatesDoc.createElement("template"); 42 | template.innerHTML = text; 43 | while (template.firstChild) { 44 | this.content.appendChild(template.firstChild); 45 | } 46 | }, 47 | get: function() { 48 | var template = templatesDoc.createElement("template"); 49 | template.appendChild(this.content.cloneNode(true)); 50 | return template.innerHTML; 51 | } 52 | }); 53 | while (template.firstChild) { 54 | template.content.appendChild(template.firstChild); 55 | } 56 | } 57 | 58 | var templateStyle = document.createElement("style"); 59 | templateStyle.textContent = "template{display:none;}"; 60 | document.head.appendChild(templateStyle); 61 | 62 | Array.prototype.forEach.call(document.querySelectorAll("template"), function(template) { 63 | if (!template.content) { 64 | shimTemplate(template); 65 | } 66 | }); 67 | 68 | var documentCreateElement = document.createElement; 69 | document.createElement = function(tagName) { 70 | var el = documentCreateElement.apply(document, arguments); 71 | if (tagName === "template") { 72 | shimTemplate(el); 73 | } 74 | return el; 75 | }; 76 | 77 | var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; 78 | if (MutationObserver) { 79 | var observer = new MutationObserver(function(mutations) { 80 | mutations.forEach(function(mutation) { 81 | Array.prototype.forEach.call(mutation.addedNodes, function(node) { 82 | if (node.nodeType === 1 && node.localName === "template") { 83 | shimTemplate(node); 84 | } 85 | }); 86 | }); 87 | }); 88 | observer.observe(document.documentElement, { 89 | childList: true, 90 | subtree: true 91 | }); 92 | } else { 93 | addEventListener("DOMNodeInserted", function(mutationEvent) { 94 | var node = mutationEvent.target; 95 | if (node.nodeType === 1 && node.localName === "template") { 96 | shimTemplate(node); 97 | } 98 | }); 99 | } 100 | } 101 | 102 | if (document.readyState === "complete") { 103 | shim(); 104 | } else { 105 | var once = function() { 106 | document.removeEventListener("DOMContentLoaded", once, false); 107 | removeEventListener("load", once, false); 108 | shim(); 109 | }; 110 | document.addEventListener("DOMContentLoaded", once, false); 111 | addEventListener("load", once, false); 112 | } 113 | }()); -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/editor/factories.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: 10 | * IBM Corporation - initial API and implementation 11 | *******************************************************************************/ 12 | /*global define */ 13 | 14 | define("orion/editor/factories", [ //$NON-NLS-0$ 15 | 'orion/editor/actions', //$NON-NLS-0$ 16 | 'orion/editor/undoStack', //$NON-NLS-0$ 17 | 'orion/editor/rulers', //$NON-NLS-0$ 18 | 'orion/editor/annotations', //$NON-NLS-0$ 19 | 'orion/editor/textDND', //$NON-NLS-0$ 20 | 'orion/editor/linkedMode' //$NON-NLS-0$ 21 | ], function(mActions, mUndoStack, mRulers, mAnnotations, mTextDND, mLinkedMode) { 22 | 23 | var exports = {}; 24 | 25 | function KeyBindingsFactory() { 26 | } 27 | KeyBindingsFactory.prototype = { 28 | createKeyBindings: function(editor, undoStack, contentAssist, searcher) { 29 | // Create keybindings for generic editing, no dependency on the service model 30 | var textActions = new mActions.TextActions(editor, undoStack , searcher); 31 | // Linked Mode 32 | var linkedMode = new mLinkedMode.LinkedMode(editor, undoStack, contentAssist); 33 | // create keybindings for source editing 34 | // TODO this should probably be something that happens more dynamically, when the editor changes input 35 | var sourceCodeActions = new mActions.SourceCodeActions(editor, undoStack, contentAssist, linkedMode); 36 | return { 37 | textActions: textActions, 38 | linkedMode: linkedMode, 39 | sourceCodeActions: sourceCodeActions 40 | }; 41 | } 42 | }; 43 | exports.KeyBindingsFactory = KeyBindingsFactory; 44 | 45 | function UndoFactory() { 46 | } 47 | UndoFactory.prototype = { 48 | createUndoStack: function(editor) { 49 | var textView = editor.getTextView(); 50 | return new mUndoStack.UndoStack(textView, 200); 51 | } 52 | }; 53 | exports.UndoFactory = UndoFactory; 54 | 55 | function LineNumberRulerFactory() { 56 | } 57 | LineNumberRulerFactory.prototype = { 58 | createLineNumberRuler: function(annotationModel) { 59 | return new mRulers.LineNumberRuler(annotationModel, "left", {styleClass: "ruler lines"}, {styleClass: "rulerLines odd"}, {styleClass: "rulerLines even"}); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ 60 | } 61 | }; 62 | exports.LineNumberRulerFactory = LineNumberRulerFactory; 63 | 64 | function FoldingRulerFactory() { 65 | } 66 | FoldingRulerFactory.prototype = { 67 | createFoldingRuler: function(annotationModel) { 68 | return new mRulers.FoldingRuler(annotationModel, "left", {styleClass: "ruler folding"}); //$NON-NLS-1$ //$NON-NLS-0$ 69 | } 70 | }; 71 | exports.FoldingRulerFactory = FoldingRulerFactory; 72 | 73 | function AnnotationFactory() { 74 | } 75 | AnnotationFactory.prototype = { 76 | createAnnotationModel: function(model) { 77 | return new mAnnotations.AnnotationModel(model); 78 | }, 79 | createAnnotationStyler: function(annotationModel, view) { 80 | return new mAnnotations.AnnotationStyler(annotationModel, view); 81 | }, 82 | createAnnotationRulers: function(annotationModel) { 83 | var annotationRuler = new mRulers.AnnotationRuler(annotationModel, "left", {styleClass: "ruler annotations"}); //$NON-NLS-1$ //$NON-NLS-0$ 84 | var overviewRuler = new mRulers.OverviewRuler(annotationModel, "right", {styleClass: "ruler overview"}); //$NON-NLS-1$ //$NON-NLS-0$ 85 | return {annotationRuler: annotationRuler, overviewRuler: overviewRuler}; 86 | } 87 | }; 88 | exports.AnnotationFactory = AnnotationFactory; 89 | 90 | function TextDNDFactory() { 91 | } 92 | TextDNDFactory.prototype = { 93 | createTextDND: function(editor, undoStack) { 94 | return new mTextDND.TextDND(editor.getTextView(), undoStack); 95 | } 96 | }; 97 | exports.TextDNDFactory = TextDNDFactory; 98 | 99 | return exports; 100 | }); -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/operation.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: 10 | * IBM Corporation - initial API and implementation 11 | *******************************************************************************/ 12 | /*global console define setTimeout XMLHttpRequest*/ 13 | 14 | /** 15 | * @name orion.operation 16 | * @namespace Provides an API for handling long running operations as promises. 17 | */ 18 | define(["orion/xhr", "orion/Deferred"], function(xhr, Deferred) { 19 | 20 | function _isRunning(operationType) { 21 | if (!operationType) { 22 | return true; 23 | } 24 | if (operationType === "loadstart" || operationType === "progress") { 25 | return true; 26 | } 27 | return false; 28 | } 29 | 30 | function _deleteTempOperation(operationLocation) { 31 | xhr("DELETE", operationLocation, { 32 | headers: { 33 | "Orion-Version": "1" 34 | }, 35 | timeout: 15000 36 | }); 37 | } 38 | 39 | function _cancelOperation(operationLocation) { 40 | xhr("PUT", operationLocation, { 41 | headers: { 42 | "Orion-Version": "1" 43 | }, 44 | data: JSON.stringify({ 45 | abort: true 46 | }), 47 | timeout: 15000 48 | }); 49 | } 50 | 51 | function _getOperation(operationLocation, deferred, onResolve, onReject) { 52 | xhr("GET", operationLocation, { 53 | headers: { 54 | "Orion-Version": "1" 55 | }, 56 | timeout: 15000 57 | }).then(function(result) { 58 | var operationJson = result.response ? JSON.parse(result.response) : null; 59 | deferred.progress(operationJson); 60 | if (_isRunning(operationJson.type)) { 61 | setTimeout(function() { 62 | _getOperation(operationLocation, deferred, onResolve, onReject); 63 | }, 2000); 64 | return; 65 | } 66 | if (operationJson.type === "error" || operationJson.type === "abort") { 67 | deferred.reject(onReject ? onReject(operationJson) : operationJson.Result); 68 | } else { 69 | deferred.resolve(onResolve ? onResolve(operationJson) : operationJson.Result.JsonData); 70 | } 71 | if (!operationJson.Location) { 72 | _deleteTempOperation(operationLocation); //This operation should not be kept 73 | } 74 | }, function(error) { 75 | var errorMessage = error; 76 | if (error.responseText !== undefined) { 77 | errorMessage = error.responseText; 78 | try { 79 | errorMessage = JSON.parse(error.responseText); 80 | } catch (e) { 81 | //ignore 82 | } 83 | } 84 | if (errorMessage.Message !== undefined) { 85 | errorMessage.HttpCode = errorMessage.HttpCode === undefined ? error.status : errorMessage.HttpCode; 86 | errorMessage.Severity = errorMessage.Severity === undefined ? "Error" : errorMessage.Severity; 87 | deferred.reject(errorMessage); 88 | } else { 89 | deferred.reject({ 90 | Severity: "Error", 91 | Message: errorMessage, 92 | HttpCode: error.status 93 | }); 94 | } 95 | }); 96 | } 97 | 98 | function _trackCancel(operationLocation, deferred) { 99 | deferred.then(null, function(error) { 100 | if (error instanceof Error && error.name === "Cancel") { 101 | _cancelOperation(operationLocation); 102 | } 103 | }); 104 | } 105 | 106 | /** 107 | * Handles a long-running operation as a promise. 108 | * @name orion.operation.handle 109 | * @function 110 | * @param {String} operationLocation 111 | * @param {Function} [onSuccess] If provided, will be called to transform a successful operation into the resolve value of the 112 | * returned promise. 113 | * @param {Function} [onError] If provided, will be called to trasnform a failed operation into the reject value of the 114 | * returned promise. 115 | * @returns {orion.Promise} 116 | */ 117 | function handle(operationLocation, onSuccess, onError) { 118 | var def = new Deferred(); 119 | _trackCancel(operationLocation, def); 120 | _getOperation(operationLocation, def, onSuccess, onError); 121 | return def; 122 | } 123 | 124 | return { 125 | handle: handle 126 | }; 127 | }); -------------------------------------------------------------------------------- /node.server/web-editor/js/orion/i18n.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*/ 13 | define(function() { 14 | return { 15 | load: function(name, parentRequire, onLoad, config) { 16 | config = config || {}; 17 | 18 | // as per requirejs i18n definition ignoring irrelevant matching groups 19 | // [0] is complete match 20 | // [1] is the message bundle prefix 21 | // [2] is the locale or suffix for the master bundle 22 | // [3] is the message file suffix or empty string for the master bundle 23 | var NLS_REG_EXP = /(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/; 24 | var match = NLS_REG_EXP.exec(name); 25 | if (!match) { 26 | onLoad(null); 27 | return; 28 | } 29 | 30 | if (!parentRequire.defined || parentRequire.defined(name)) { 31 | try { 32 | onLoad(parentRequire(name)); 33 | return; 34 | } catch (e) { 35 | // not defined so need to load it 36 | } 37 | } 38 | 39 | if (config.isBuild || config.isTest) { 40 | onLoad({}); 41 | return; 42 | } 43 | 44 | var prefix = match[1], 45 | locale = match[3] ? match[2] : "", 46 | suffix = match[3] || match[2]; 47 | parentRequire(['orion/bootstrap'], function(bootstrap) { //$NON-NLS-0$ 48 | bootstrap.startup().then(function(core) { 49 | var serviceRegistry = core.serviceRegistry; 50 | var nlsReferences = serviceRegistry.getServiceReferences("orion.i18n.message"); //$NON-NLS-0$ 51 | 52 | if (!locale) { 53 | // create master language entries 54 | var master = {}; 55 | var masterReference; 56 | nlsReferences.forEach(function(reference) { 57 | var name = reference.getProperty("name"); //$NON-NLS-0$ 58 | if ((match = NLS_REG_EXP.exec(name)) && prefix === match[1] && suffix === (match[3] || match[2])) { 59 | locale = match[3] ? match[2] : ""; 60 | if (locale) { 61 | // see Bug 381042 - [Globalization] Messages are loaded even if their language is not used 62 | var userLocale = config.locale || (typeof navigator !== "undefined" ? (navigator.language || navigator.userLanguage) : null); 63 | if (!userLocale || userLocale.toLowerCase().indexOf(locale.toLowerCase()) !== 0) { 64 | return; 65 | } 66 | // end 67 | master[locale] = true; 68 | if (!parentRequire.specified || !parentRequire.specified(name)) { 69 | define(name, ['orion/i18n!' + name], function(bundle) { //$NON-NLS-0$ 70 | return bundle; 71 | }); 72 | } 73 | } else { 74 | masterReference = reference; 75 | } 76 | } 77 | }); 78 | if (!parentRequire.specified || !parentRequire.specified(name)) { 79 | if (masterReference) { 80 | serviceRegistry.getService(masterReference).getMessageBundle().then(function(bundle) { 81 | Object.keys(master).forEach(function(key) { 82 | if (typeof bundle[key] === 'undefined') { //$NON-NLS-0$ 83 | bundle[key] = master[key]; 84 | } 85 | }); 86 | define(name, [], bundle); 87 | onLoad(bundle); 88 | }, function() { 89 | define(name, [], master); 90 | onLoad(master); 91 | }); 92 | } else { 93 | define(name, [], master); 94 | onLoad(master); 95 | } 96 | } else { 97 | onLoad(master); 98 | } 99 | } else { 100 | var found = nlsReferences.some(function(reference) { 101 | if (name === reference.getProperty("name")) { //$NON-NLS-0$ 102 | serviceRegistry.getService(reference).getMessageBundle().then(function(bundle) { 103 | onLoad(bundle); 104 | }, function() { 105 | onLoad({}); 106 | }); 107 | return true; 108 | } 109 | return false; 110 | }); 111 | if (!found) { 112 | onLoad({}); 113 | } 114 | } 115 | }); 116 | }); 117 | } 118 | }; 119 | }); -------------------------------------------------------------------------------- /node.server/web-editor/js/requirejs/domReady.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @license RequireJS domReady 2.0.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. 3 | * Available via the MIT or new BSD license. 4 | * see: https://github.com/requirejs/domReady for details 5 | */ 6 | /*jslint */ 7 | /*global require: false, define: false, requirejs: false, 8 | window: false, clearInterval: false, document: false, 9 | self: false, setInterval: false */ 10 | 11 | 12 | define(function () { 13 | 'use strict'; 14 | 15 | var isTop, testDiv, scrollIntervalId, 16 | isBrowser = typeof window !== "undefined" && window.document, 17 | isPageLoaded = !isBrowser, 18 | doc = isBrowser ? document : null, 19 | readyCalls = []; 20 | 21 | function runCallbacks(callbacks) { 22 | var i; 23 | for (i = 0; i < callbacks.length; i += 1) { 24 | callbacks[i](doc); 25 | } 26 | } 27 | 28 | function callReady() { 29 | var callbacks = readyCalls; 30 | 31 | if (isPageLoaded) { 32 | //Call the DOM ready callbacks 33 | if (callbacks.length) { 34 | readyCalls = []; 35 | runCallbacks(callbacks); 36 | } 37 | } 38 | } 39 | 40 | /** 41 | * Sets the page as loaded. 42 | */ 43 | function pageLoaded() { 44 | if (!isPageLoaded) { 45 | isPageLoaded = true; 46 | if (scrollIntervalId) { 47 | clearInterval(scrollIntervalId); 48 | } 49 | 50 | callReady(); 51 | } 52 | } 53 | 54 | if (isBrowser) { 55 | if (document.addEventListener) { 56 | //Standards. Hooray! Assumption here that if standards based, 57 | //it knows about DOMContentLoaded. 58 | document.addEventListener("DOMContentLoaded", pageLoaded, false); 59 | window.addEventListener("load", pageLoaded, false); 60 | } else if (window.attachEvent) { 61 | window.attachEvent("onload", pageLoaded); 62 | 63 | testDiv = document.createElement('div'); 64 | try { 65 | isTop = window.frameElement === null; 66 | } catch (e) {} 67 | 68 | //DOMContentLoaded approximation that uses a doScroll, as found by 69 | //Diego Perini: http://javascript.nwbox.com/IEContentLoaded/, 70 | //but modified by other contributors, including jdalton 71 | if (testDiv.doScroll && isTop && window.external) { 72 | scrollIntervalId = setInterval(function () { 73 | try { 74 | testDiv.doScroll(); 75 | pageLoaded(); 76 | } catch (e) {} 77 | }, 30); 78 | } 79 | } 80 | 81 | //Check if document already complete, and if so, just trigger page load 82 | //listeners. Latest webkit browsers also use "interactive", and 83 | //will fire the onDOMContentLoaded before "interactive" but not after 84 | //entering "interactive" or "complete". More details: 85 | //https://dev.w3.org/html5/spec/the-end.html#the-end 86 | //https://stackoverflow.com/questions/3665561/document-readystate-of-interactive-vs-ondomcontentloaded 87 | //Hmm, this is more complicated on further use, see "firing too early" 88 | //bug: https://github.com/requirejs/domReady/issues/1 89 | //so removing the || document.readyState === "interactive" test. 90 | //There is still a window.onload binding that should get fired if 91 | //DOMContentLoaded is missed. 92 | if (document.readyState === "complete") { 93 | pageLoaded(); 94 | } 95 | } 96 | 97 | /** START OF PUBLIC API **/ 98 | 99 | /** 100 | * Registers a callback for DOM ready. If DOM is already ready, the 101 | * callback is called immediately. 102 | * @param {Function} callback 103 | */ 104 | function domReady(callback) { 105 | if (isPageLoaded) { 106 | callback(doc); 107 | } else { 108 | readyCalls.push(callback); 109 | } 110 | return domReady; 111 | } 112 | 113 | domReady.version = '2.0.1'; 114 | 115 | /** 116 | * Loader Plugin API method 117 | */ 118 | domReady.load = function (name, req, onLoad, config) { 119 | if (config.isBuild) { 120 | onLoad(null); 121 | } else { 122 | domReady(onLoad); 123 | } 124 | }; 125 | 126 | /** END OF PUBLIC API **/ 127 | 128 | return domReady; 129 | }); 130 | -------------------------------------------------------------------------------- /node.server/repository-rest-api.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*/ 13 | 14 | var RestRepository = function(expressapp, repository) { 15 | this.repository = repository; 16 | 17 | expressapp.get('/api/:username', this.getProjects.bind(this)); 18 | 19 | expressapp.get('/api/:username/:project', this.getProject.bind(this)); 20 | expressapp.post('/api/:username/:project', this.createProject.bind(this)); 21 | 22 | expressapp.get('/api/:username/:project/:resource(*)', this.getResource.bind(this)); 23 | expressapp.put('/api/:username/:project/:resource(*)', this.putResource.bind(this)); 24 | expressapp.post('/api/:username/:project/:resource(*)', this.postResource.bind(this)); 25 | }; 26 | 27 | exports.RestRepository = RestRepository; 28 | 29 | RestRepository.prototype.getProjects = function(req, res) { 30 | this.repository.getProjects(req.params.username, function(error, result) { 31 | res.send(JSON.stringify(result), { 'Content-Type': 'application/json' }, 200); 32 | }); 33 | }; 34 | 35 | RestRepository.prototype.getProject = function(req, res) { 36 | var includeDeleted = req.query.includeDeleted; 37 | 38 | this.repository.getProject(req.params.username, req.params.project, includeDeleted, function(error, content, deleted) { 39 | if (error === null) { 40 | if (includeDeleted) { 41 | res.send(JSON.stringify({ 42 | 'content' : content, 43 | 'deleted' : deleted 44 | }), { 'Content-Type': 'application/json' }, 200); 45 | } 46 | else { 47 | res.send(JSON.stringify({ 48 | 'content' : content 49 | }), { 'Content-Type': 'application/json' }, 200); 50 | } 51 | } 52 | else { 53 | res.send(error); 54 | } 55 | }); 56 | }; 57 | 58 | RestRepository.prototype.createProject = function(req, res) { 59 | this.repository.createProject(req.params.username, req.params.project, function(error, result) { 60 | if (error === null) { 61 | res.send(JSON.stringify(result), { 'Content-Type': 'application/json' }, 200); 62 | } 63 | else { 64 | res.send(error); 65 | } 66 | }); 67 | }; 68 | 69 | RestRepository.prototype.postResource = function(req, res) { 70 | var body = ''; 71 | req.on('data', function(buffer) { 72 | console.log("Chunk:", buffer.length ); 73 | body += buffer; 74 | }); 75 | 76 | req.on('end', function() { 77 | this.repository.createResource(req.params.username, req.params.project, req.params.resource, body, req.headers['resource-sha1'], 78 | req.headers['resource-timestamp'], req.headers['resource-type'], function(error, result) { 79 | 80 | if (error === null) { 81 | res.send(JSON.stringify(result), { 'Content-Type': 'application/json' }, 200); 82 | } 83 | else { 84 | res.send(error); 85 | } 86 | }); 87 | }.bind(this)); 88 | }; 89 | 90 | RestRepository.prototype.putResource = function(req, res) { 91 | var body = ''; 92 | req.on('data', function(buffer) { 93 | console.log("Chunk:", buffer.length ); 94 | body += buffer; 95 | }); 96 | 97 | req.on('end', function() { 98 | if (req.param('meta') !== undefined) { 99 | var metadata = JSON.parse(body); 100 | var type = req.param('meta'); 101 | this.repository.updateMetadata(req.params.username, req.params.project, req.params.resource, metadata, type, function(error, result) { 102 | if (error === null) { 103 | res.send(JSON.stringify(result), { 'Content-Type': 'application/json' }, 200); 104 | } 105 | else { 106 | res.send(error); 107 | } 108 | }); 109 | } 110 | else { 111 | this.repository.updateResource(req.params.username, req.params.project, req.params.resource, body, req.headers['resource-sha1'], 112 | req.headers['resource-timestamp'], function(error, result) { 113 | if (error === null) { 114 | res.send(JSON.stringify(result), { 'Content-Type': 'application/json' }, 200); 115 | } 116 | else { 117 | res.send(error); 118 | } 119 | }); 120 | } 121 | 122 | }.bind(this)); 123 | 124 | req.on('error', function(error) { 125 | console.log('Error: ' + error); 126 | }); 127 | }; 128 | 129 | RestRepository.prototype.getResource = function(req, res) { 130 | this.repository.getResource(req.params.username, req.params.project, req.params.resource, undefined, undefined, function(error, result) { 131 | if (error === null) { 132 | res.send(result, 200); 133 | } 134 | else { 135 | res.send(error); 136 | } 137 | }); 138 | }; 139 | -------------------------------------------------------------------------------- /eclipse.services.java/org.eclipse.flight.jdt.service/src/org/eclipse/flux/jdt/services/RenameService.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 java.util.ArrayList; 14 | import java.util.List; 15 | 16 | import org.eclipse.flux.core.AbstractMessageHandler; 17 | import org.eclipse.flux.core.IMessageHandler; 18 | import org.eclipse.flux.core.IMessagingConnector; 19 | import org.eclipse.jdt.core.ICompilationUnit; 20 | import org.eclipse.jdt.core.dom.AST; 21 | import org.eclipse.jdt.core.dom.ASTNode; 22 | import org.eclipse.jdt.core.dom.ASTParser; 23 | import org.eclipse.jdt.core.dom.ASTVisitor; 24 | import org.eclipse.jdt.core.dom.NodeFinder; 25 | import org.eclipse.jdt.core.dom.SimpleName; 26 | import org.json.JSONArray; 27 | import org.json.JSONException; 28 | import org.json.JSONObject; 29 | 30 | /** 31 | * @author Martin Lippert 32 | */ 33 | public class RenameService { 34 | 35 | private LiveEditUnits liveEditUnits; 36 | private IMessagingConnector messagingConnector; 37 | 38 | public RenameService(IMessagingConnector messagingConnector, LiveEditUnits liveEditUnits) { 39 | this.messagingConnector = messagingConnector; 40 | this.liveEditUnits = liveEditUnits; 41 | 42 | IMessageHandler contentAssistRequestHandler = new AbstractMessageHandler("renameinfilerequest") { 43 | @Override 44 | public void handleMessage(String messageType, JSONObject message) { 45 | handleRenameInFileRequest(message); 46 | } 47 | }; 48 | messagingConnector.addMessageHandler(contentAssistRequestHandler); 49 | } 50 | 51 | protected void handleRenameInFileRequest(JSONObject message) { 52 | try { 53 | String username = message.getString("username"); 54 | String projectName = message.getString("project"); 55 | String resourcePath = message.getString("resource"); 56 | int callbackID = message.getInt("callback_id"); 57 | 58 | String liveEditID = projectName + "/" + resourcePath; 59 | if (liveEditUnits.isLiveEditResource(username, liveEditID)) { 60 | 61 | int offset = message.getInt("offset"); 62 | int length = message.getInt("length"); 63 | String sender = message.getString("requestSenderID"); 64 | 65 | JSONArray references = computeReferences(username, liveEditID, offset, length); 66 | 67 | if (references != null) { 68 | JSONObject responseMessage = new JSONObject(); 69 | responseMessage.put("username", username); 70 | responseMessage.put("project", projectName); 71 | responseMessage.put("resource", resourcePath); 72 | responseMessage.put("callback_id", callbackID); 73 | responseMessage.put("requestSenderID", sender); 74 | responseMessage.put("references", references); 75 | 76 | messagingConnector.send("renameinfileresponse", responseMessage); 77 | } 78 | } 79 | } catch (JSONException e) { 80 | e.printStackTrace(); 81 | } 82 | } 83 | 84 | public JSONArray computeReferences(String username, String resourcePath, int offset, int length) { 85 | try { 86 | ICompilationUnit unit = liveEditUnits.getLiveEditUnit(username, resourcePath); 87 | if (unit != null) { 88 | final ASTParser parser = ASTParser.newParser(AST.JLS4); 89 | 90 | // Parse the class as a compilation unit. 91 | parser.setKind(ASTParser.K_COMPILATION_UNIT); 92 | parser.setSource(unit); 93 | parser.setResolveBindings(true); 94 | 95 | // Return the compiled class as a compilation unit 96 | final ASTNode compilationUnit = parser.createAST(null); 97 | final ASTNode nameNode= NodeFinder.perform(compilationUnit, offset, length); 98 | 99 | final List nodes = new ArrayList(); 100 | 101 | if (nameNode instanceof SimpleName) { 102 | compilationUnit.accept(new ASTVisitor() { 103 | @Override 104 | public boolean visit(SimpleName node) { 105 | if (node.getIdentifier().equals(((SimpleName) nameNode).getIdentifier())) { 106 | nodes.add(node); 107 | } 108 | return super.visit(node); 109 | } 110 | }); 111 | } 112 | 113 | JSONArray references = new JSONArray(); 114 | for (ASTNode astNode : nodes) { 115 | JSONObject nodeObject = new JSONObject(); 116 | nodeObject.put("offset", astNode.getStartPosition()); 117 | nodeObject.put("length", astNode.getLength()); 118 | 119 | references.put(nodeObject); 120 | } 121 | 122 | return references; 123 | } 124 | } catch (JSONException e) { 125 | e.printStackTrace(); 126 | } 127 | return null; 128 | } 129 | 130 | } 131 | --------------------------------------------------------------------------------