├── LICENSE ├── README.md ├── client ├── .dockerignore ├── .editorconfig ├── .gitignore ├── .vscode │ ├── extensions.json │ ├── launch.json │ ├── settings.json │ └── tasks.json ├── Dockerfile ├── README.md ├── browser-app │ └── package.json ├── configs │ ├── base.eslintrc.json │ ├── base.tsconfig.json │ ├── errors.eslintrc.json │ └── warnings.eslintrc.json ├── lerna.json ├── package.json ├── packages │ ├── common │ │ ├── .eslintrc.js │ │ ├── package.json │ │ ├── resources │ │ │ └── icons │ │ │ │ ├── UMLModelFile.gif │ │ │ │ ├── dark │ │ │ │ ├── Association.gif │ │ │ │ ├── Class.gif │ │ │ │ └── Property.gif │ │ │ │ ├── icon-source.txt │ │ │ │ └── light │ │ │ │ ├── Association.gif │ │ │ │ ├── Class.gif │ │ │ │ └── Property.gif │ │ ├── src │ │ │ └── browser │ │ │ │ ├── common-frontend-module.ts │ │ │ │ ├── frontend-contribution.ts │ │ │ │ ├── label-provider.ts │ │ │ │ ├── style │ │ │ │ ├── common.css │ │ │ │ ├── icons-dark.useable.css │ │ │ │ ├── icons-light.useable.css │ │ │ │ ├── uml-colors-dark.useable.css │ │ │ │ ├── uml-colors-light.useable.css │ │ │ │ └── uml-colors.css │ │ │ │ └── util.ts │ │ └── tsconfig.json │ ├── uml-sprotty │ │ ├── .eslintrc.js │ │ ├── LICENSE │ │ ├── css │ │ │ ├── diagram.css │ │ │ ├── edit-label.css │ │ │ └── tool-palette.css │ │ ├── images │ │ │ ├── Class.svg │ │ │ └── Property.svg │ │ ├── package.json │ │ ├── src │ │ │ ├── di.config.ts │ │ │ ├── features │ │ │ │ ├── edit-label │ │ │ │ │ ├── action-definitions.ts │ │ │ │ │ ├── edit-label-autocomplete.ts │ │ │ │ │ └── index.ts │ │ │ │ └── tool-palette │ │ │ │ │ ├── di.config.ts │ │ │ │ │ └── tool-palette.ts │ │ │ ├── feedback.tsx │ │ │ ├── index.ts │ │ │ ├── model.ts │ │ │ ├── utils │ │ │ │ ├── index.ts │ │ │ │ └── uml-types.ts │ │ │ └── views.tsx │ │ └── tsconfig.json │ └── uml-theia-integration │ │ ├── .eslintrc.js │ │ ├── LICENSE │ │ ├── package.json │ │ ├── src │ │ ├── browser │ │ │ ├── command-contribution.ts │ │ │ ├── diagram │ │ │ │ ├── diagram-configuration.ts │ │ │ │ ├── diagram-manager.ts │ │ │ │ ├── diagram-server.ts │ │ │ │ └── theia-glsp-connector.ts │ │ │ ├── frontend-extension.ts │ │ │ └── glsp-client-contribution.ts │ │ ├── common │ │ │ ├── uml-language.ts │ │ │ └── uml-model-server-client.ts │ │ └── node │ │ │ ├── backend-extension.ts │ │ │ ├── equinox.ts │ │ │ ├── model-server-client.ts │ │ │ └── uml-glsp-server-contribution.ts │ │ └── tsconfig.json ├── tsconfig.json ├── workspace │ └── course │ │ └── model │ │ ├── course.uml │ │ └── course.unotation └── yarn.lock ├── documentation └── uml-glsp-animated-classdiagram.gif └── server ├── .project ├── .settings ├── org.eclipse.core.resources.prefs └── org.eclipse.m2e.core.prefs ├── README.md ├── com.eclipsesource.uml.glsp-app ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.m2e.core.prefs ├── com.eclipsesource.uml.glsp.app │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ ├── org.eclipse.jdt.core.prefs │ │ └── org.eclipse.m2e.core.prefs │ ├── META-INF │ │ └── MANIFEST.MF │ ├── build.properties │ ├── plugin.properties │ ├── plugin.xml │ ├── pom.xml │ └── src │ │ └── com │ │ └── eclipsesource │ │ └── uml │ │ └── glsp │ │ └── app │ │ └── ServerApplication.java ├── com.eclipsesource.uml.glsp.feature │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ └── org.eclipse.m2e.core.prefs │ ├── build.properties │ ├── feature.xml │ └── pom.xml ├── com.eclipsesource.uml.glsp.product │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ └── org.eclipse.m2e.core.prefs │ ├── com.eclipsesource.uml.glsp.product │ ├── com.eclipsesource.uml.glsp.product.launch │ └── pom.xml └── pom.xml ├── com.eclipsesource.uml.glsp ├── .classpath ├── .gitignore ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.jdt.launching.prefs │ ├── org.eclipse.jdt.ui.prefs │ └── org.eclipse.m2e.core.prefs ├── META-INF │ └── MANIFEST.MF ├── build.properties ├── plugin.properties ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── eclipsesource │ └── uml │ └── glsp │ ├── UmlDIOperationHandlerRegistry.java │ ├── UmlGLSPModule.java │ ├── UmlGLSPServer.java │ ├── UmlGLSPServerLauncher.java │ ├── UmlServerModule.java │ ├── actions │ ├── ActionKind.java │ ├── GetTypesAction.java │ ├── ReturnTypesAction.java │ └── UmlGetTypesActionHandler.java │ ├── diagram │ └── UmlDiagramConfiguration.java │ ├── gmodel │ ├── AbstractGModelFactory.java │ ├── ClassifierNodeFactory.java │ ├── CompartmentLabelFactory.java │ ├── DiagramFactory.java │ ├── DiagramFactoryProvider.java │ ├── RelationshipEdgeFactory.java │ └── UmlClassDiagramModelFactory.java │ ├── layout │ └── UmlLayoutEngine.java │ ├── model │ ├── UmlModelFactory.java │ ├── UmlModelIndex.java │ ├── UmlModelSourceLoader.java │ └── UmlModelState.java │ ├── modelserver │ └── UmlModelServerAccess.java │ ├── operations │ ├── CreateClassifierChildNodeOperationHandler.java │ ├── CreateClassifierNodeOperationHandler.java │ ├── CreateEdgeOperationHandler.java │ ├── UmlChangeBoundsOperationHandler.java │ ├── UmlChangeRoutingPointsOperationHandler.java │ ├── UmlCompoundOperationHandler.java │ ├── UmlDeleteOperationHandler.java │ └── UmlLabelEditOperationHandler.java │ ├── palette │ └── UmlToolPaletteItemProvider.java │ └── util │ ├── UmlConfig.java │ ├── UmlEdgeUtil.java │ ├── UmlIDUtil.java │ └── UmlLabelUtil.java ├── com.eclipsesource.uml.modelserver-app ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.m2e.core.prefs ├── com.eclipsesource.uml.modelserver.app │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ ├── org.eclipse.jdt.core.prefs │ │ └── org.eclipse.m2e.core.prefs │ ├── META-INF │ │ └── MANIFEST.MF │ ├── build.properties │ ├── plugin.properties │ ├── plugin.xml │ ├── pom.xml │ ├── resources │ │ └── log4j2.xml │ └── src │ │ └── com │ │ └── eclipsesource │ │ └── uml │ │ └── modelserver │ │ └── app │ │ └── ServerApplication.java ├── com.eclipsesource.uml.modelserver.feature │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ └── org.eclipse.m2e.core.prefs │ ├── build.properties │ ├── feature.xml │ └── pom.xml ├── com.eclipsesource.uml.modelserver.product │ ├── .gitignore │ ├── .project │ ├── .settings │ │ ├── org.eclipse.core.resources.prefs │ │ └── org.eclipse.m2e.core.prefs │ ├── UML-GLSP App.launch │ ├── com.eclipsesource.uml.modelserver.product │ ├── com.eclipsesource.uml.modelserver.product.launch │ └── pom.xml └── pom.xml ├── com.eclipsesource.uml.modelserver ├── .classpath ├── .gitignore ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.jdt.launching.prefs │ ├── org.eclipse.jdt.ui.prefs │ └── org.eclipse.m2e.core.prefs ├── META-INF │ └── MANIFEST.MF ├── build.properties ├── plugin.properties ├── plugin.xml ├── pom.xml ├── resources │ ├── unotation.aird │ ├── unotation.ecore │ └── unotation.genmodel └── src │ └── main │ ├── java-gen │ └── com │ │ └── eclipsesource │ │ └── uml │ │ └── modelserver │ │ └── unotation │ │ ├── Diagram.java │ │ ├── Edge.java │ │ ├── NotationElement.java │ │ ├── Representation.java │ │ ├── SemanticProxy.java │ │ ├── Shape.java │ │ ├── UnotationFactory.java │ │ ├── UnotationPackage.java │ │ ├── impl │ │ ├── DiagramImpl.java │ │ ├── EdgeImpl.java │ │ ├── NotationElementImpl.java │ │ ├── SemanticProxyImpl.java │ │ ├── ShapeImpl.java │ │ ├── UnotationFactoryImpl.java │ │ └── UnotationPackageImpl.java │ │ └── util │ │ ├── UnotationAdapterFactory.java │ │ └── UnotationSwitch.java │ └── java │ └── com │ └── eclipsesource │ └── uml │ └── modelserver │ ├── UmlCodec.java │ ├── UmlModelResourceManager.java │ ├── UmlModelServerClient.java │ ├── UmlModelServerLauncher.java │ ├── UmlModelServerModule.java │ ├── UmlModelServerPaths.java │ ├── UmlModelServerPathsParameters.java │ ├── UmlModelServerRouting.java │ ├── UmlNotationUtil.java │ ├── UmlPackageConfiguration.java │ ├── UmlResourceSetFactory.java │ ├── UnotationPackageConfiguration.java │ └── commands │ ├── compound │ ├── AddAssociationCompoundCommand.java │ ├── AddClassCompoundCommand.java │ ├── RemoveAssociationCompoundCommand.java │ └── RemoveClassCompoundCommand.java │ ├── contributions │ ├── AddAssociationCommandContribution.java │ ├── AddClassCommandContribution.java │ ├── AddPropertyCommandContribution.java │ ├── ChangeBoundsCommandContribution.java │ ├── ChangeRoutingPointsCommandContribution.java │ ├── RemoveAssociationCommandContribution.java │ ├── RemoveClassCommandContribution.java │ ├── RemovePropertyCommandContribution.java │ ├── SetAssociationEndMultiplicityCommandContribution.java │ ├── SetAssociationEndNameCommandContribution.java │ ├── SetClassNameCommandContribution.java │ ├── SetPropertyBoundsCommandContribution.java │ ├── SetPropertyNameCommandContribution.java │ ├── SetPropertyTypeCommandContribution.java │ ├── UmlCompoundCommandContribution.java │ ├── UmlNotationCommandContribution.java │ └── UmlSemanticCommandContribution.java │ ├── notation │ ├── AddAssociationEdgeCommand.java │ ├── AddClassShapeCommand.java │ ├── ChangeBoundsCommand.java │ ├── ChangeRoutingPointsCommand.java │ ├── RemoveAssociationEdgeCommand.java │ ├── RemoveClassShapeCommand.java │ └── UmlNotationElementCommand.java │ ├── semantic │ ├── AddAssociationCommand.java │ ├── AddClassCommand.java │ ├── AddPropertyCommand.java │ ├── RemoveAssociationCommand.java │ ├── RemoveClassCommand.java │ ├── RemovePropertyCommand.java │ ├── SetAssociationEndMultiplicityCommand.java │ ├── SetAssociationEndNameCommand.java │ ├── SetClassNameCommand.java │ ├── SetPropertyBoundsCommand.java │ ├── SetPropertyNameCommand.java │ ├── SetPropertyTypeCommand.java │ └── UmlSemanticElementCommand.java │ └── util │ ├── UmlNotationCommandUtil.java │ └── UmlSemanticCommandUtil.java ├── pom.xml └── targetplatform ├── .project ├── .settings ├── org.eclipse.core.resources.prefs └── org.eclipse.m2e.core.prefs ├── pom.xml ├── targetplatform.target └── targetplatform.tpd /client/.dockerignore: -------------------------------------------------------------------------------- 1 | dockerfiles 2 | .git 3 | .travis.yaml 4 | .gitignore 5 | .vscode/ 6 | 7 | **/node_modules 8 | **/lib 9 | **/src-gen 10 | 11 | Dockerfile 12 | .dockerignore -------------------------------------------------------------------------------- /client/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | insert_final_newline = true 5 | end_of_line = lf 6 | indent_style = space 7 | 8 | [*.{js,ts,tsx,md}] 9 | indent_size = 4 10 | 11 | [*.{json,yml}] 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /client/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .browser_modules 3 | lib 4 | *.log 5 | *-app/* 6 | !*-app/package.json 7 | build/ 8 | -------------------------------------------------------------------------------- /client/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. 3 | // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp 4 | // List of extensions which should be recommended for users of this workspace. 5 | "recommendations": [ 6 | "editorconfig.editorconfig", 7 | "dbaeumer.vscode-eslint", 8 | "rbbit.typescript-hero", 9 | "aeschli.vscode-css-formatter", 10 | "msjsdiag.debugger-for-chrome" 11 | ], 12 | // List of extensions recommended by VS Code that should not be recommended for users of this workspace. 13 | "unwantedRecommendations": [] 14 | } 15 | -------------------------------------------------------------------------------- /client/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible Node.js debug attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Start Browser Backend (expects running GLSP Server instance)", 11 | "program": "${workspaceRoot}/browser-app/src-gen/backend/main.js", 12 | "args": [ 13 | "--UML_GLSP=5007", 14 | "--port=3000", 15 | "--no-cluster", 16 | "--root-dir=${workspaceRoot}/workspace", 17 | "--app-project-path=${workspaceRoot}/browser-app", 18 | "--loglevel=debug", 19 | ], 20 | "env": { 21 | "NODE_ENV": "development" 22 | }, 23 | "sourceMaps": true, 24 | "outFiles": [ 25 | "${workspaceRoot}/node_modules/@theia/*/lib/**/*.js", 26 | "${workspaceRoot}/browser-app/lib/**/*.js", 27 | "${workspaceRoot}/browser-app/src-gen/**/*.js", 28 | "${workspaceRoot}/packages/**/lib/**/*.js" 29 | ], 30 | "smartStep": true, 31 | "internalConsoleOptions": "openOnSessionStart", 32 | "outputCapture": "std" 33 | }, 34 | { 35 | "name": "Launch Browser Frontend", 36 | "type": "chrome", 37 | "request": "launch", 38 | "url": "http://localhost:3000/", 39 | "sourceMaps": true, 40 | "webRoot": "${workspaceRoot}", 41 | "sourceMapPathOverrides": { 42 | "./src/*": "${workspaceFolder}/src/*" 43 | } 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /client/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // If one would like to add/remove/modify user preferences without modifying the content of the 2 | // workspace settings file, then one would need to modify the `settings.json` under here: 3 | // - Windows: %APPDATA%\Code\User\settings.json 4 | // - Linux: $HOME/.config/Code/User/settings.json 5 | // - Mac: $HOME/Library/Application Support/Code/User/settings.json 6 | { 7 | "typescriptHero.imports.organizeOnSave": true, 8 | "typescriptHero.imports.disableImportsSorting": false, 9 | "typescriptHero.imports.stringQuoteStyle": "\"", 10 | "typescriptHero.imports.insertSemicolons": true, 11 | "typescriptHero.imports.multiLineTrailingComma": false, 12 | "typescriptHero.imports.ignoredFromRemoval": [ 13 | "react" 14 | ], 15 | "editor.formatOnSave": true, 16 | "editor.codeActionsOnSave": { 17 | "source.fixAll.eslint": true 18 | }, 19 | "search.exclude": { 20 | "**/node_modules": true, 21 | "**/lib": true 22 | }, 23 | "editor.insertSpaces": true, 24 | "[typescript]": { 25 | "editor.tabSize": 4 26 | }, 27 | "[json]": { 28 | "editor.tabSize": 2 29 | }, 30 | "typescript.tsdk": "node_modules/typescript/lib", 31 | "eslint.validate": [ 32 | "javascript", 33 | "javascriptreact", 34 | "html", 35 | "typescript", 36 | "typescriptreact" 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /client/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "label": "Build all packages", 8 | "type": "shell", 9 | "group": { 10 | "kind": "build", 11 | "isDefault": true 12 | }, 13 | "command": "yarn", 14 | "presentation": { 15 | "reveal": "always", 16 | "panel": "new" 17 | }, 18 | "problemMatcher": [] 19 | }, 20 | { 21 | "label": "Start Browser Backend and Server Jars", 22 | "type": "shell", 23 | "command": "yarn start", 24 | "presentation": { 25 | "reveal": "always", 26 | "panel": "new" 27 | }, 28 | "problemMatcher": [] 29 | }, 30 | { 31 | "label": "Start Browser Backend in Debug Mode (expects running Server instances)", 32 | "type": "shell", 33 | "command": "yarn start:debug", 34 | "presentation": { 35 | "reveal": "always", 36 | "panel": "new" 37 | }, 38 | "problemMatcher": [] 39 | }, 40 | { 41 | "label": "Watch all packages", 42 | "type": "shell", 43 | "group": "build", 44 | "command": "yarn watch", 45 | "presentation": { 46 | "reveal": "always", 47 | "panel": "new" 48 | }, 49 | "problemMatcher": [] 50 | }, 51 | { 52 | "label": "Open Example in Browser", 53 | "type": "shell", 54 | "group": "test", 55 | "command": "google-chrome 127.0.0.1:3000", 56 | "presentation": { 57 | "reveal": "always", 58 | "panel": "new" 59 | }, 60 | "problemMatcher": [] 61 | } 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /client/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:10.18.0-alpine3.10 2 | 3 | RUN mkdir /usr/src/client -p 4 | 5 | WORKDIR /usr/src/client 6 | 7 | RUN apk add --update python && \ 8 | apk add --update make && \ 9 | apk add --update g++ && \ 10 | apk add --update openjdk11-jre 11 | 12 | # Have to copy everything because the build statement in uml-theia-integration starts linting, which requires all files. 13 | # "build": "tsc && yarn run lint" 14 | COPY . . 15 | 16 | RUN yarn install 17 | 18 | RUN yarn rebuild:browser 19 | 20 | WORKDIR ./browser-app 21 | 22 | EXPOSE 3000 23 | 24 | CMD yarn start --hostname 0.0.0.0 25 | -------------------------------------------------------------------------------- /client/browser-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "browser-app", 4 | "version": "0.1.0", 5 | "dependencies": { 6 | "@eclipsesource/uml-theia": "0.1.0", 7 | "@theia/core": "^1.0.0", 8 | "@theia/editor": "^1.0.0", 9 | "@theia/file-search": "^1.0.0", 10 | "@theia/filesystem": "^1.0.0", 11 | "@theia/keymaps": "^1.0.0", 12 | "@theia/markers": "^1.0.0", 13 | "@theia/messages": "^1.0.0", 14 | "@theia/monaco": "^1.0.0", 15 | "@theia/navigator": "^1.0.0", 16 | "@theia/output": "^1.0.0", 17 | "@theia/plugin-ext": "^1.0.0", 18 | "@theia/plugin-ext-vscode": "^1.0.0", 19 | "@theia/plugin-metrics": "^1.0.0", 20 | "@theia/preferences": "^1.0.0", 21 | "@theia/process": "^1.0.0", 22 | "@theia/search-in-workspace": "^1.0.0", 23 | "@theia/task": "^1.0.0", 24 | "@theia/terminal": "^1.0.0", 25 | "@theia/userstorage": "^1.0.0", 26 | "@theia/variable-resolver": "^1.0.0", 27 | "@theia/vsx-registry": "^1.0.0", 28 | "@theia/workspace": "^1.0.0" 29 | }, 30 | "devDependencies": { 31 | "@theia/cli": "^1.0.0" 32 | }, 33 | "scripts": { 34 | "prepare": "theia build --mode development && yarn download:plugins", 35 | "start": "theia start --UML_GLSP=5007 --hostname=0.0.0.0 --root-dir=../workspace --plugins=local-dir:./plugins", 36 | "start:debug": "theia start --UML_GLSP=5007 --hostname=0.0.0.0 --loglevel=debug --root-dir=../workspace --plugins=local-dir:./plugins --debug", 37 | "watch": "theia build --watch --mode development", 38 | "download:plugins": "theia download:plugins" 39 | }, 40 | "theia": { 41 | "target": "browser" 42 | }, 43 | "theiaPluginsDir": "plugins", 44 | "theiaPlugins": { 45 | "vscode-builtin-json": "https://open-vsx.org/api/vscode/json/1.46.1/file/vscode.json-1.46.1.vsix", 46 | "vscode-builtin-json-language-features": "https://open-vsx.org/api/vscode/json-language-features/1.46.1/file/vscode.json-language-features-1.46.1.vsix" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /client/configs/base.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "parserOptions": { 4 | "sourceType": "module", 5 | "ecmaVersion": 8, 6 | "ecmaFeatures": { 7 | "jsx": true 8 | } 9 | }, 10 | "plugins": [ 11 | "@typescript-eslint", 12 | "header", 13 | "import", 14 | "no-null", 15 | "react" 16 | ], 17 | "extends": [ 18 | "eslint:recommended", 19 | "plugin:@typescript-eslint/eslint-recommended", 20 | "plugin:@typescript-eslint/recommended", 21 | "plugin:import/errors", 22 | "plugin:import/warnings", 23 | "plugin:import/typescript", 24 | "plugin:react/recommended" 25 | ], 26 | "settings": { 27 | "react": { 28 | "createClass": "createReactClass", 29 | "pragma": "React", 30 | "version": "detect", 31 | "flowVersion": "0.53" 32 | } 33 | }, 34 | "env": { 35 | "browser": true, 36 | "mocha": true, 37 | "es2017": true 38 | }, 39 | "ignorePatterns": [ 40 | "node_modules", 41 | "*.d.ts" 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /client/configs/base.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "skipLibCheck": true, 4 | "declaration": true, 5 | "declarationMap": true, 6 | "noImplicitAny": true, 7 | "noEmitOnError": false, 8 | "noImplicitThis": true, 9 | "noUnusedLocals": true, 10 | "noImplicitReturns": true, 11 | "strictNullChecks": true, 12 | "experimentalDecorators": true, 13 | "emitDecoratorMetadata": true, 14 | "downlevelIteration": true, 15 | "module": "commonjs", 16 | "moduleResolution": "node", 17 | "target": "ES2017", 18 | "jsx": "react", 19 | "lib": [ 20 | "ES2017", 21 | "dom" 22 | ], 23 | "sourceMap": true 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /client/configs/warnings.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | // https://eslint.org/docs/rules/ 4 | "brace-style": [ 5 | "warn", 6 | "1tbs" 7 | ], 8 | "comma-dangle": "warn", 9 | "indent": [ 10 | "warn", 11 | 4, 12 | { 13 | "SwitchCase": 1 14 | } 15 | ], 16 | "no-invalid-this": "warn", 17 | "no-new-wrappers": "warn", 18 | "no-return-await": "warn", 19 | "no-shadow": [ 20 | "warn", 21 | { 22 | "hoist": "all" 23 | } 24 | ], 25 | "no-trailing-spaces": "warn", 26 | "no-void": "warn", 27 | "prefer-const": [ 28 | "warn", 29 | { 30 | "destructuring": "all" 31 | } 32 | ], 33 | "prefer-object-spread": "warn", 34 | "radix": "warn", 35 | "spaced-comment": [ 36 | "warn", 37 | "always", 38 | { 39 | "exceptions": [ 40 | "*", 41 | "+", 42 | "-", 43 | "/", 44 | "!" 45 | ] 46 | } 47 | ], 48 | "use-isnan": "warn", 49 | // @typescript-eslint/eslint-plugin 50 | "@typescript-eslint/explicit-function-return-type": [ 51 | "warn", 52 | { 53 | "allowExpressions": true 54 | } 55 | ], 56 | "@typescript-eslint/no-non-null-assertion": "off", 57 | "@typescript-eslint/type-annotation-spacing": "warn" 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /client/lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "2.11.0", 3 | "version": "0.1.0", 4 | "useWorkspaces": true, 5 | "npmClient": "yarn", 6 | "command": { 7 | "run": { 8 | "stream": true 9 | } 10 | }, 11 | "publish": { 12 | "forcePublish": true, 13 | "skipGit": true, 14 | "registry": "https://registry.npmjs.org/" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "engines": { 4 | "yarn": "1.0.x || >=1.2.1", 5 | "node": ">=12.14.1" 6 | }, 7 | "scripts": { 8 | "prepare": "lerna run prepare", 9 | "watch": "lerna run --parallel watch", 10 | "start": "cd browser-app && yarn start", 11 | "start:debug": "cd browser-app && yarn start:debug" 12 | }, 13 | "devDependencies": { 14 | "@typescript-eslint/eslint-plugin": "^4.8.1", 15 | "@typescript-eslint/parser": "^4.8.1", 16 | "babel-loader": "8.0.6", 17 | "eslint": "^7.0.0", 18 | "eslint-plugin-header": "^3.1.1", 19 | "eslint-plugin-import": "^2.25.4", 20 | "eslint-plugin-no-null": "^1.0.2", 21 | "eslint-plugin-react": "^7.29.3", 22 | "lerna": "^2.11.0" 23 | }, 24 | "resolutions": { 25 | "**/@theia/application-manager": "1.23.0", 26 | "**/@theia/application-package": "1.23.0", 27 | "**/@theia/cli": "1.23.0", 28 | "**/@theia/core": "1.23.0", 29 | "**/@theia/editor": "1.23.0", 30 | "**/@theia/filesystem": "1.23.0", 31 | "**/@theia/file-search": "1.23.0", 32 | "**/@theia/keymaps": "1.23.0", 33 | "**/@theia/markers": "1.23.0", 34 | "**/@theia/messages": "1.23.0", 35 | "**/@theia/monaco": "1.23.0", 36 | "**/@theia/navigator": "1.23.0", 37 | "**/@theia/outline-view": "1.23.0", 38 | "**/@theia/output": "1.23.0", 39 | "**/@theia/plugin-dev": "1.23.0", 40 | "**/@theia/plugin-ext": "1.23.0", 41 | "**/@theia/plugin-ext-vscode": "1.23.0", 42 | "**/@theia/plugin-metrics": "1.23.0", 43 | "**/@theia/preferences": "1.23.0", 44 | "**/@theia/process": "1.23.0", 45 | "**/@theia/search-in-workspace": "1.23.0", 46 | "**/@theia/task": "1.23.0", 47 | "**/@theia/terminal": "1.23.0", 48 | "**/@theia/typehierarchy": "1.23.0", 49 | "**/@theia/userstorage": "1.23.0", 50 | "**/@theia/variable-resolver": "1.23.0", 51 | "**/@theia/vsx-registry": "1.23.0", 52 | "**/@theia/workspace": "1.23.0", 53 | "**/@eclipse-glsp/client": "0.10.0-next.4ce46ea.160", 54 | "**/@eclipse-glsp/protocol": "0.10.0-next.4ce46ea.160", 55 | "**/@eclipse-glsp/theia-integration": "0.10.0-next.3655cc2.121", 56 | "**/@eclipse-emfcloud/modelserver-theia": "0.8.0-next.bfd82e29", 57 | "**/@vscode/codicons": "0.0.28", 58 | "**/inversify": "5.1.1", 59 | "**/snabbdom": "3.0.3", 60 | "**/snabbdom-jsx": "^0.4.2", 61 | "**/sprotty": "0.10.0", 62 | "**/sprotty-theia": "0.10.0" 63 | }, 64 | "workspaces": [ 65 | "browser-app", 66 | "configs", 67 | "packages/*/" 68 | ] 69 | } 70 | -------------------------------------------------------------------------------- /client/packages/common/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** @type {import('eslint').Linter.Config} */ 2 | module.exports = { 3 | extends: [ 4 | '../../configs/base.eslintrc.json', 5 | '../../configs/warnings.eslintrc.json', 6 | '../../configs/errors.eslintrc.json' 7 | ], 8 | ignorePatterns: [ 9 | '**/{node_modules,lib}' 10 | ], 11 | parserOptions: { 12 | tsconfigRootDir: __dirname, 13 | project: 'tsconfig.json' 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /client/packages/common/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "name": "@eclipsesource/uml-glsp-common", 4 | "version": "0.1.0", 5 | "description": "Common utilities", 6 | "keywords": [ 7 | "theia-extension" 8 | ], 9 | "dependencies": { 10 | "@theia/core": "^1.0.0" 11 | }, 12 | "devDependencies": { 13 | "rimraf": "^2.6.1", 14 | "typescript": "~4.5.5" 15 | }, 16 | "scripts": { 17 | "prepare": "yarn run clean && yarn run build", 18 | "clean": "rimraf lib", 19 | "build": "tsc && yarn run lint", 20 | "lint": "eslint -c ./.eslintrc.js --ext .ts ./src", 21 | "watch": "tsc -w" 22 | }, 23 | "files": [ 24 | "lib", 25 | "src" 26 | ], 27 | "theiaExtensions": [ 28 | { 29 | "frontend": "lib/browser/common-frontend-module" 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /client/packages/common/resources/icons/UMLModelFile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eclipsesource/uml-glsp/8640b88525297ea7edd6efa98571a630352daf83/client/packages/common/resources/icons/UMLModelFile.gif -------------------------------------------------------------------------------- /client/packages/common/resources/icons/dark/Association.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eclipsesource/uml-glsp/8640b88525297ea7edd6efa98571a630352daf83/client/packages/common/resources/icons/dark/Association.gif -------------------------------------------------------------------------------- /client/packages/common/resources/icons/dark/Class.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eclipsesource/uml-glsp/8640b88525297ea7edd6efa98571a630352daf83/client/packages/common/resources/icons/dark/Class.gif -------------------------------------------------------------------------------- /client/packages/common/resources/icons/dark/Property.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eclipsesource/uml-glsp/8640b88525297ea7edd6efa98571a630352daf83/client/packages/common/resources/icons/dark/Property.gif -------------------------------------------------------------------------------- /client/packages/common/resources/icons/icon-source.txt: -------------------------------------------------------------------------------- 1 | Our icon source is the papyrus git repository: 2 | https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/tree/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/icons 3 | (For the dark icons, we use GIMP to edit copies of the original icons) 4 | -------------------------------------------------------------------------------- /client/packages/common/resources/icons/light/Association.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eclipsesource/uml-glsp/8640b88525297ea7edd6efa98571a630352daf83/client/packages/common/resources/icons/light/Association.gif -------------------------------------------------------------------------------- /client/packages/common/resources/icons/light/Class.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eclipsesource/uml-glsp/8640b88525297ea7edd6efa98571a630352daf83/client/packages/common/resources/icons/light/Class.gif -------------------------------------------------------------------------------- /client/packages/common/resources/icons/light/Property.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eclipsesource/uml-glsp/8640b88525297ea7edd6efa98571a630352daf83/client/packages/common/resources/icons/light/Property.gif -------------------------------------------------------------------------------- /client/packages/common/src/browser/common-frontend-module.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import "../../src/browser/style/common.css"; 12 | import "../../src/browser/style/uml-colors.css"; 13 | 14 | import { FrontendApplicationContribution, LabelProviderContribution } from "@theia/core/lib/browser"; 15 | import { ContainerModule } from "inversify"; 16 | 17 | import { UmlFrontendContribution } from "./frontend-contribution"; 18 | import { UmlTreeLabelProviderContribution } from "./label-provider"; 19 | 20 | export default new ContainerModule(bind => { 21 | bind(FrontendApplicationContribution).to(UmlFrontendContribution).inSingletonScope(); 22 | bind(LabelProviderContribution).to(UmlTreeLabelProviderContribution).inSingletonScope(); 23 | }); 24 | -------------------------------------------------------------------------------- /client/packages/common/src/browser/frontend-contribution.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { FrontendApplicationContribution } from "@theia/core/lib/browser/frontend-application"; 12 | import { ThemeService, ThemeType } from "@theia/core/lib/browser/theming"; 13 | import { inject, injectable } from "inversify"; 14 | 15 | @injectable() 16 | export class UmlFrontendContribution implements FrontendApplicationContribution { 17 | 18 | @inject(ThemeService) protected readonly themeService: ThemeService; 19 | 20 | static readonly darkColorsCss = require("../../src/browser/style/uml-colors-dark.useable.css"); 21 | static readonly darkIconsCss = require("../../src/browser/style/icons-dark.useable.css"); 22 | 23 | static readonly lightColorsCss = require("../../src/browser/style/uml-colors-light.useable.css"); 24 | static readonly lightIconsCss = require("../../src/browser/style/icons-light.useable.css"); 25 | 26 | onStart(): void { 27 | this.updateTheme(); 28 | this.themeService.onDidColorThemeChange(() => this.updateTheme()); 29 | } 30 | 31 | protected updateTheme(): void { 32 | const themeType: ThemeType = this.themeService.getCurrentTheme().type; 33 | if (themeType === "dark" || themeType === "hc") { 34 | // unload light 35 | UmlFrontendContribution.lightColorsCss.unuse(); 36 | UmlFrontendContribution.lightIconsCss.unuse(); 37 | // load dark 38 | UmlFrontendContribution.darkColorsCss.use(); 39 | UmlFrontendContribution.darkIconsCss.use(); 40 | } else if (themeType === "light") { 41 | // unload dark 42 | UmlFrontendContribution.darkColorsCss.unuse(); 43 | UmlFrontendContribution.darkIconsCss.unuse(); 44 | // load light 45 | UmlFrontendContribution.lightColorsCss.use(); 46 | UmlFrontendContribution.lightIconsCss.use(); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /client/packages/common/src/browser/label-provider.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { UriSelection } from "@theia/core"; 12 | import { LabelProviderContribution } from "@theia/core/lib/browser"; 13 | import URI from "@theia/core/lib/common/uri"; 14 | import { FileStat } from "@theia/filesystem/lib/common"; 15 | import { injectable } from "inversify"; 16 | 17 | import { AnyObject } from "./util"; 18 | 19 | @injectable() 20 | export class UmlTreeLabelProviderContribution implements LabelProviderContribution { 21 | canHandle(uri: AnyObject): number { 22 | let toCheck: any = uri; 23 | if (FileStat.is(toCheck)) { 24 | toCheck = new URI(toCheck.uri); 25 | } else if (UriSelection.is(uri)) { 26 | toCheck = UriSelection.getUri(uri); 27 | } 28 | if (toCheck instanceof URI) { 29 | if (toCheck.path.ext === ".uml") { 30 | return 1000; 31 | } 32 | } 33 | return 0; 34 | } 35 | 36 | getIcon(): string { 37 | return "umlmodelfile"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /client/packages/common/src/browser/style/common.css: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | 12 | .umlmodelfile { 13 | background-image: url(../../../resources/icons/UMLModelFile.gif); 14 | height: 16px; 15 | width: 16px; 16 | padding-right: 6px; 17 | background-repeat: no-repeat; 18 | } 19 | 20 | .p-TabBar.theia-app-centers .p-TabBar-tabIcon.umlmodelfileTabIcon { 21 | background-image: url(../../../resources/icons/UMLModelFile.gif); 22 | height: 16px; 23 | width: 16px; 24 | background-color: transparent; 25 | background-repeat: no-repeat; 26 | } 27 | 28 | .p-Menu-itemIcon.umlmodelfile { 29 | background-repeat: no-repeat; 30 | background-position: center; 31 | } 32 | 33 | .umlimg { 34 | background-size: 16px 16px; 35 | height: 16px; 36 | width: 16px; 37 | margin-right: 6px; 38 | } 39 | 40 | .umlclass { 41 | background-image: var(--uml-icon-class); 42 | } 43 | 44 | .umlassociation { 45 | background-image: var(--uml-icon-association); 46 | } 47 | 48 | .umlproperty { 49 | background-image: var(--uml-icon-property); 50 | } 51 | -------------------------------------------------------------------------------- /client/packages/common/src/browser/style/icons-dark.useable.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --uml-icon-class: url(../../../resources/icons/dark/Class.gif); 3 | --uml-icon-association: url(../../../resources/icons/dark/Association.gif); 4 | --uml-icon-property: url(../../../resources/icons/dark/Property.gif); 5 | } 6 | -------------------------------------------------------------------------------- /client/packages/common/src/browser/style/icons-light.useable.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --uml-icon-class: url(../../../resources/icons/light/Class.gif); 3 | --uml-icon-association: url(../../../resources/icons/light/Association.gif); 4 | --uml-icon-property: url(../../../resources/icons/light/Property.gif); 5 | } 6 | -------------------------------------------------------------------------------- /client/packages/common/src/browser/style/uml-colors-dark.useable.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --uml-border: var(--uml-light-blue); 3 | --uml-diagram-background: var(--theia-editor-background); 4 | --uml-drop-shadow: lightgrey; 5 | --uml-edge: var(--uml-light-blue); 6 | --uml-label: var(--theia-editor-foreground); 7 | --uml-node: var(--uml-dark-blue); 8 | } 9 | -------------------------------------------------------------------------------- /client/packages/common/src/browser/style/uml-colors-light.useable.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --uml-border: var(--uml-medium-blue); 3 | --uml-diagram-background: var(--theia-editor-background); 4 | --uml-drop-shadow: lightgrey; 5 | --uml-edge: var(--uml-medium-blue); 6 | --uml-label: var(--theia-editor-foreground); 7 | --uml-node: var(--uml-light-blue); 8 | } 9 | -------------------------------------------------------------------------------- /client/packages/common/src/browser/style/uml-colors.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --uml-light-blue: #eaf0f8; 3 | --uml-medium-blue: #4b82b2; 4 | --uml-dark-blue: #294762; 5 | --uml-error: #f00; 6 | } 7 | -------------------------------------------------------------------------------- /client/packages/common/src/browser/util.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | /** 12 | * The built-in 'object' & 'Object' types are currently hard to use 13 | * an should be avoided. It's recommended to use Record instead to describe the 14 | * type meaning of "any object"; 15 | */ 16 | export type AnyObject = Record; 17 | 18 | export namespace AnyObject { 19 | /** 20 | * Type guard to check wether a given object is of type {@link AnyObject}. 21 | * @param object The object to check. 22 | * @returns The given object as {@link AnyObject} or `false`. 23 | */ 24 | export function is(object: unknown): object is AnyObject { 25 | // eslint-disable-next-line no-null/no-null 26 | return object !== null && typeof object === "object"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /client/packages/common/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../configs/base.tsconfig", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "lib" 6 | }, 7 | "include": [ 8 | "src", 9 | "resources" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** @type {import('eslint').Linter.Config} */ 2 | module.exports = { 3 | extends: [ 4 | '../../configs/base.eslintrc.json', 5 | '../../configs/warnings.eslintrc.json', 6 | '../../configs/errors.eslintrc.json' 7 | ], 8 | ignorePatterns: [ 9 | '**/{configs,css,images,node_modules,lib}' 10 | ], 11 | parserOptions: { 12 | tsconfigRootDir: __dirname, 13 | project: 'tsconfig.json' 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/css/diagram.css: -------------------------------------------------------------------------------- 1 | .sprotty { 2 | height: 100%; 3 | display: flex; 4 | } 5 | 6 | svg { 7 | border-style: solid; 8 | border-width: 1px; 9 | border-color: var(--uml-edge); 10 | height: 100%; 11 | width: 100%; 12 | } 13 | 14 | .sprotty-graph { 15 | background: var(--uml-diagram-background); 16 | font-size: 15pt; 17 | height: 100%; 18 | width: 100%; 19 | } 20 | 21 | .uml-node { 22 | fill: var(--uml-node); 23 | filter: url(#dropShadow); 24 | stroke-width: 1; 25 | stroke: var(--uml-border); 26 | } 27 | 28 | .uml-node.mouseover:not(.selected) { 29 | stroke-width: 2; 30 | } 31 | 32 | .uml-node.selected { 33 | stroke-width: 3; 34 | } 35 | 36 | .uml-node .sprotty-node { 37 | fill: inherit; 38 | stroke: var(--uml-border); 39 | } 40 | 41 | .sprotty-label { 42 | fill: var(--uml-label); 43 | font-weight: inherit; 44 | font-size: 100%; 45 | } 46 | 47 | .selection-feedback { 48 | fill: none; 49 | } 50 | 51 | .selection-feedback.hover { 52 | stroke-width: 0.75; 53 | } 54 | 55 | .selection-feedback.selected { 56 | stroke-width: 1.5; 57 | } 58 | 59 | .uml-comp-separator { 60 | stroke-width: 1; 61 | stroke: var(--uml-edge); 62 | } 63 | 64 | .uml-edge { 65 | fill: none; 66 | stroke-width: 1; 67 | stroke: var(--uml-edge) !important; 68 | } 69 | 70 | .uml-edge.mouseover:not(.selected) { 71 | stroke-width: 2; 72 | opacity: 1; 73 | } 74 | 75 | .uml-edge.selected { 76 | stroke-width: 3; 77 | stroke-dasharray: none; 78 | } 79 | 80 | .uml-edge>.sprotty-routing-handle { 81 | r: 4; 82 | fill: var(--uml-edge); 83 | stroke: var(--uml-edge); 84 | stroke-width: 2; 85 | z-index: 1000; 86 | } 87 | 88 | .uml-edge>.sprotty-routing-handle.mouseover { 89 | stroke-width: 3; 90 | } 91 | 92 | .sprotty-missing { 93 | stroke-width: 1; 94 | stroke: var(--uml-error); 95 | fill: var(--uml-error); 96 | font-size: 14pt; 97 | text-anchor: middle; 98 | } 99 | 100 | .sprotty-popup-title { 101 | font-weight: bold; 102 | margin-bottom: 10px; 103 | } 104 | 105 | .sprotty-popup-body>p { 106 | margin-bottom: 2px; 107 | } 108 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/css/edit-label.css: -------------------------------------------------------------------------------- 1 | .label-edit input { 2 | background: rgba(255, 255, 255, 0.5); 3 | color: var(--uml-label); 4 | } 5 | 6 | .autocomplete { 7 | position: relative; 8 | display: inline-block; 9 | } 10 | 11 | .autocomplete-items { 12 | position: absolute; 13 | border: 1px solid #d4d4d4; 14 | color: black; 15 | border-bottom: none; 16 | border-top: none; 17 | z-index: 99; 18 | top: 100%; 19 | left: 0; 20 | right: 0; 21 | overflow: auto; 22 | } 23 | 24 | .autocomplete-item { 25 | padding: 6px; 26 | cursor: pointer; 27 | background-color: #fff; 28 | border-bottom: 1px solid #d4d4d4; 29 | } 30 | 31 | .autocomplete-item:hover { 32 | background-color: #e9e9e9; 33 | } 34 | 35 | .autocomplete-active { 36 | background-color: DodgerBlue !important; 37 | color: #ffffff; 38 | } 39 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/css/tool-palette.css: -------------------------------------------------------------------------------- 1 | .tool-palette { 2 | width: 200px !important; 3 | } 4 | 5 | .uml-tool-button { 6 | display: flex; 7 | } 8 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@eclipsesource/uml-sprotty", 3 | "version": "0.1.0", 4 | "description": "Sprotty diagrams for UML", 5 | "author": { 6 | "name": "EclipseSource" 7 | }, 8 | "license": "(EPL-2.0 OR MIT)", 9 | "keywords": [ 10 | "sprotty", 11 | "workflow", 12 | "diagram" 13 | ], 14 | "homepage": "https://github.com/eclipsesource/uml-glsp", 15 | "bugs": "https://github.com/eclipsesource/uml-glsp/issues", 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/eclipsesource/uml-glsp.git" 19 | }, 20 | "dependencies": { 21 | "@eclipsesource/uml-glsp-common": "0.1.0", 22 | "@eclipse-glsp/client": "next", 23 | "reflect-metadata": "^0.1.10" 24 | }, 25 | "devDependencies": { 26 | "rimraf": "^2.6.1", 27 | "typescript": "~4.5.5" 28 | }, 29 | "scripts": { 30 | "prepare": "yarn run clean && yarn run build", 31 | "clean": "rimraf lib", 32 | "build": "tsc && yarn run lint", 33 | "lint": "eslint -c ./.eslintrc.js --ext .ts,.tsx ./src", 34 | "watch": "tsc -w" 35 | }, 36 | "files": [ 37 | "lib", 38 | "src", 39 | "css", 40 | "images" 41 | ] 42 | } 43 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/src/features/edit-label/action-definitions.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { generateRequestId, RequestAction, ResponseAction } from "@eclipse-glsp/client"; 12 | 13 | export class GetTypesAction implements RequestAction { 14 | static readonly KIND = "getTypes"; 15 | kind = GetTypesAction.KIND; 16 | constructor(public readonly requestId: string = generateRequestId()) { } 17 | } 18 | 19 | export class ReturnTypesAction implements ResponseAction { 20 | static readonly KIND = "returnTypes"; 21 | kind = ReturnTypesAction.KIND; 22 | types: string[]; 23 | constructor(public readonly actions: string[], public readonly responseId: string = "") { 24 | this.types = actions; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/src/features/edit-label/index.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | export * from "./action-definitions"; 12 | export * from "./edit-label-autocomplete"; 13 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/src/features/tool-palette/di.config.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * http://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the Eclipse 10 | * Public License v. 2.0 are satisfied: GNU General Public License, version 2 11 | * with the GNU Classpath Exception which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | ********************************************************************************/ 16 | import "@eclipse-glsp/client/css/tool-palette.css"; 17 | 18 | import { EnableToolPaletteAction } from "@eclipse-glsp/client"; 19 | import { ContainerModule } from "inversify"; 20 | import { configureActionHandler, EnableDefaultToolsAction, TYPES } from "sprotty"; 21 | 22 | import { UmlToolPalette } from "./tool-palette"; 23 | 24 | const umlToolPaletteModule = new ContainerModule((bind, _unbind, isBound) => { 25 | bind(UmlToolPalette).toSelf().inSingletonScope(); 26 | bind(TYPES.IUIExtension).toService(UmlToolPalette); 27 | configureActionHandler({ bind, isBound }, EnableToolPaletteAction.KIND, UmlToolPalette); 28 | configureActionHandler({ bind, isBound }, EnableDefaultToolsAction.KIND, UmlToolPalette); 29 | }); 30 | 31 | export default umlToolPaletteModule; 32 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/src/index.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import "../css/diagram.css"; 12 | import "../css/edit-label.css"; 13 | import "../css/tool-palette.css"; 14 | import "reflect-metadata"; 15 | 16 | import createUmlDiagramContainer from "./di.config"; 17 | 18 | export * from "./model"; 19 | export * from "./views"; 20 | export * from "./features/edit-label"; 21 | export { createUmlDiagramContainer }; 22 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | export * from "./uml-types"; 12 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/src/utils/uml-types.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { DefaultTypes } from "@eclipse-glsp/protocol"; 12 | 13 | export namespace UmlTypes { 14 | 15 | export const ICON = "icon"; 16 | export const LABEL_NAME = `${DefaultTypes.LABEL}:name`; 17 | export const LABEL_TEXT = `${DefaultTypes.LABEL}:text`; 18 | export const LABEL_EDGE_NAME = `${DefaultTypes.LABEL}:edge-name`; 19 | export const LABEL_EDGE_MULTIPLICITY = `${DefaultTypes.LABEL}:edge-multiplicity`; 20 | export const ICON_CLASS = `${ICON}:class`; 21 | export const CLASS = `${DefaultTypes.NODE}:class`; 22 | export const ASSOCIATION = `${DefaultTypes.EDGE}:association`; 23 | export const PROPERTY = `${DefaultTypes.COMPARTMENT}:property`; 24 | export const ICON_PROPERTY = `${ICON}:property`; 25 | export const LABEL_PROPERTY_NAME = `${DefaultTypes.LABEL}:property:name`; 26 | export const LABEL_PROPERTY_TYPE = `${DefaultTypes.LABEL}:property:type`; 27 | export const LABEL_PROPERTY_MULTIPLICITY = `${DefaultTypes.LABEL}:property:multiplicity`; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /client/packages/uml-sprotty/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../configs/base.tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "lib", 5 | "baseUrl": ".", 6 | "reactNamespace": "JSX", 7 | "skipLibCheck": true 8 | }, 9 | "include": [ 10 | "src" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** @type {import('eslint').Linter.Config} */ 2 | module.exports = { 3 | extends: [ 4 | '../../configs/base.eslintrc.json', 5 | '../../configs/warnings.eslintrc.json', 6 | '../../configs/errors.eslintrc.json' 7 | ], 8 | ignorePatterns: [ 9 | '**/{node_modules,lib,server}' 10 | ], 11 | parserOptions: { 12 | tsconfigRootDir: __dirname, 13 | project: 'tsconfig.json' 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@eclipsesource/uml-theia", 3 | "description": "Glue code to integrate UML GLSP sprotty client into Eclipse Theia", 4 | "keywords": [ 5 | "theia-extension" 6 | ], 7 | "author": { 8 | "name": "EclipseSource" 9 | }, 10 | "license": "(EPL-2.0 OR MIT)", 11 | "version": "0.1.0", 12 | "files": [ 13 | "lib", 14 | "src" 15 | ], 16 | "homepage": "https://github.com/eclipsesource/uml-glsp", 17 | "bugs": "https://github.com/eclipsesource/uml-glsp/issues", 18 | "repository": { 19 | "type": "git", 20 | "url": "https://github.com/eclipsesource/uml-glsp.git" 21 | }, 22 | "dependencies": { 23 | "@eclipse-emfcloud/modelserver-theia": "next", 24 | "@eclipse-glsp/theia-integration": "next", 25 | "@eclipsesource/uml-glsp-common": "0.1.0", 26 | "@eclipsesource/uml-sprotty": "0.1.0", 27 | "@theia/core": "^1.0.0", 28 | "@theia/navigator": "^1.0.0" 29 | }, 30 | "devDependencies": { 31 | "eslint": "^6.8.0", 32 | "rimraf": "^2.6.1", 33 | "typescript": "~4.5.5" 34 | }, 35 | "scripts": { 36 | "prepare": "yarn run clean && yarn run build", 37 | "clean": "rimraf lib", 38 | "build": "tsc && yarn run lint", 39 | "lint": "eslint -c ./.eslintrc.js --ext .ts ./src", 40 | "watch": "tsc -w" 41 | }, 42 | "theiaExtensions": [ 43 | { 44 | "frontend": "lib/browser/frontend-extension", 45 | "backend": "lib/node/backend-extension" 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/src/browser/diagram/diagram-configuration.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { 12 | configureDiagramServer, 13 | GLSPDiagramConfiguration, 14 | TheiaDiagramServer 15 | } from "@eclipse-glsp/theia-integration/lib/browser"; 16 | import { createUmlDiagramContainer } from "@eclipsesource/uml-sprotty/lib"; 17 | import { Container, injectable } from "inversify"; 18 | 19 | import { UmlLanguage } from "../../common/uml-language"; 20 | import { UmlGLSPTheiaDiagramServer } from "./diagram-server"; 21 | 22 | @injectable() 23 | export class UmlDiagramConfiguration extends GLSPDiagramConfiguration { 24 | 25 | diagramType: string = UmlLanguage.diagramType; 26 | 27 | doCreateContainer(widgetId: string): Container { 28 | const container = createUmlDiagramContainer(widgetId); 29 | configureDiagramServer(container, UmlGLSPTheiaDiagramServer); 30 | container.bind(TheiaDiagramServer).toService(UmlGLSPTheiaDiagramServer); 31 | return container; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/src/browser/diagram/diagram-manager.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { GLSPDiagramManager, GLSPWidgetOpenerOptions, GLSPWidgetOptions } from "@eclipse-glsp/theia-integration/lib/browser"; 12 | import { SelectionService } from "@theia/core"; 13 | import URI from "@theia/core/lib/common/uri"; 14 | import { WorkspaceService } from "@theia/workspace/lib/browser"; 15 | import { inject, injectable, postConstruct } from "inversify"; 16 | import { DiagramWidgetOptions } from "sprotty-theia"; 17 | 18 | import { UmlLanguage } from "../../common/uml-language"; 19 | 20 | export interface UmlDiagramWidgetOptions extends DiagramWidgetOptions, GLSPWidgetOptions { 21 | workspaceRoot: string; 22 | } 23 | 24 | @injectable() 25 | export class UmlDiagramManager extends GLSPDiagramManager { 26 | 27 | @inject(SelectionService) protected readonly selectionService: SelectionService; 28 | @inject(WorkspaceService) protected readonly workspaceService: WorkspaceService; 29 | 30 | readonly diagramType = UmlLanguage.diagramType; 31 | readonly label = UmlLanguage.label + " Editor"; 32 | 33 | private workspaceRoot: string; 34 | 35 | @postConstruct() 36 | protected async initialize(): Promise { 37 | super.initialize(); 38 | this.workspaceService.roots.then(roots => (this.workspaceRoot = roots[0].resource.toString())); 39 | } 40 | 41 | get fileExtensions(): string[] { 42 | return UmlLanguage.fileExtensions; 43 | } 44 | 45 | get iconClass(): string { 46 | return UmlLanguage.iconClass!; 47 | } 48 | 49 | protected createWidgetOptions(uri: URI, options?: GLSPWidgetOpenerOptions): UmlDiagramWidgetOptions { 50 | return { 51 | ...super.createWidgetOptions(uri, options), 52 | workspaceRoot: this.workspaceRoot 53 | } as UmlDiagramWidgetOptions; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/src/browser/diagram/diagram-server.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { ActionHandlerRegistry } from "@eclipse-glsp/client/lib"; 12 | import { GLSPTheiaDiagramServer } from "@eclipse-glsp/theia-integration/lib/browser"; 13 | import { GetTypesAction, ReturnTypesAction } from "@eclipsesource/uml-sprotty/lib/features/edit-label"; 14 | import { injectable } from "inversify"; 15 | 16 | @injectable() 17 | export class UmlGLSPTheiaDiagramServer extends GLSPTheiaDiagramServer { 18 | initialize(registry: ActionHandlerRegistry): void { 19 | super.initialize(registry); 20 | 21 | registry.register(GetTypesAction.KIND, this); 22 | registry.register(ReturnTypesAction.KIND, this); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/src/browser/diagram/theia-glsp-connector.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { Args } from "@eclipse-glsp/protocol"; 12 | import { GLSPDiagramLanguage, TheiaDiagramServer } from "@eclipse-glsp/theia-integration"; 13 | import { BaseTheiaGLSPConnector } from "@eclipse-glsp/theia-integration/lib/browser/diagram/base-theia-glsp-connector"; 14 | import { injectable } from "inversify"; 15 | 16 | import { UmlLanguage } from "../../common/uml-language"; 17 | 18 | @injectable() 19 | export class UmlTheiaGLSPConnector extends BaseTheiaGLSPConnector { 20 | 21 | private _diagramType: string = UmlLanguage.diagramType; 22 | private _contributionId: string = UmlLanguage.contributionId; 23 | 24 | doConfigure(diagramLanguage: GLSPDiagramLanguage): void { 25 | this._contributionId = diagramLanguage.contributionId; 26 | this._diagramType = diagramLanguage.diagramType; 27 | this.initialize(); 28 | } 29 | 30 | get diagramType(): string { 31 | if (!this._diagramType) { 32 | throw new Error("No diagramType has been set for this UmlTheiaGLSPConnector"); 33 | } 34 | return this._diagramType; 35 | } 36 | 37 | get contributionId(): string { 38 | if (!this._contributionId) { 39 | throw new Error("No contributionId has been set for this UmlTheiaGLSPConnector"); 40 | } 41 | return this._contributionId; 42 | } 43 | 44 | protected initialize(): void { 45 | if (this._diagramType && this._contributionId) { 46 | super.initialize(); 47 | } 48 | } 49 | 50 | disposeClientSessionArgs(diagramServer: TheiaDiagramServer): Args | undefined { 51 | return { 52 | ["sourceUri"]: diagramServer.sourceUri 53 | }; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/src/browser/glsp-client-contribution.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { ModelServerClient } from "@eclipse-emfcloud/modelserver-theia/lib/common"; 12 | import { Args, MaybePromise } from "@eclipse-glsp/client"; 13 | import { BaseGLSPClientContribution } from "@eclipse-glsp/theia-integration/lib/browser"; 14 | import { inject, injectable } from "inversify"; 15 | 16 | import { UmlLanguage } from "../common/uml-language"; 17 | 18 | export interface UmlInitializeOptions { 19 | timestamp: Date; 20 | modelServerURL: string; 21 | } 22 | 23 | @injectable() 24 | export class UmlGLSPClientContribution extends BaseGLSPClientContribution { 25 | 26 | @inject(ModelServerClient) protected readonly modelServerClient: ModelServerClient; 27 | 28 | readonly id = UmlLanguage.contributionId; 29 | readonly fileExtensions = UmlLanguage.fileExtensions; 30 | 31 | protected createInitializeOptions(): MaybePromise { 32 | return { 33 | ["timestamp"]: new Date().toString(), 34 | ["modelServerURL"]: "http://localhost:8081/api/v1/" 35 | }; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/src/common/uml-language.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { GLSPDiagramLanguage } from "@eclipse-glsp/theia-integration"; 12 | 13 | export const UmlLanguage: GLSPDiagramLanguage = { 14 | contributionId: "uml", 15 | label: "UML diagram", 16 | diagramType: "umldiagram", 17 | iconClass: "codicon codicon-type-hierarchy-sub", 18 | fileExtensions: [".uml"] 19 | }; 20 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/src/common/uml-model-server-client.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { ModelServerClient, ModelServerMessage, Response } from "@eclipse-emfcloud/modelserver-theia"; 12 | 13 | export enum UmlDiagramType { 14 | NONE = "", 15 | ACTIVITY = "ACTIVITY", 16 | CLASS = "CLASS", 17 | COMPONENT = "COMPONENT", 18 | DEPLOYMENT = "DEPLOYMENT", 19 | PACKAGE = "PACKAGE", 20 | SEQUENCE = "SEQUENCE", 21 | STATEMACHINE = "STATEMACHINE", 22 | USECASE = "USECASE" 23 | } 24 | 25 | export const UmlModelServerClient = Symbol("UmlModelServerClient"); 26 | export interface UmlModelServerClient extends ModelServerClient { 27 | createUmlResource(modelName: string, diagramType: UmlDiagramType): Promise>; 28 | } 29 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/src/node/backend-extension.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { LaunchOptions, ModelServerClient } from "@eclipse-emfcloud/modelserver-theia"; 12 | import { GLSPServerContribution } from "@eclipse-glsp/theia-integration/lib/node"; 13 | import { ContainerModule, injectable } from "inversify"; 14 | import { join, resolve } from "path"; 15 | 16 | import { findEquinoxLauncher } from "./equinox"; 17 | import { UmlModelServerClientImpl } from "./model-server-client"; 18 | import { UmlGLSPServerContribution } from "./uml-glsp-server-contribution"; 19 | 20 | @injectable() 21 | export class UmlModelServerLaunchOptions implements LaunchOptions { 22 | baseURL = "api/v1/"; 23 | serverPort = 8081; 24 | hostname = "localhost"; 25 | jarPath = findEquinoxLauncher(join(__dirname, "..", "..", "build", "com.eclipsesource.uml.modelserver.product-0.1.0")); 26 | additionalArgs = [ 27 | `-r=${resolve(join(__dirname, "..", "..", "..", "..", "workspace"))}` 28 | ]; 29 | } 30 | 31 | export default new ContainerModule((bind, _unbind, isBound, rebind) => { 32 | if (isBound(LaunchOptions)) { 33 | rebind(LaunchOptions).to(UmlModelServerLaunchOptions).inSingletonScope(); 34 | } else { 35 | bind(LaunchOptions).to(UmlModelServerLaunchOptions).inSingletonScope(); 36 | } 37 | rebind(ModelServerClient).to(UmlModelServerClientImpl).inSingletonScope(); 38 | bind(GLSPServerContribution).to(UmlGLSPServerContribution).inSingletonScope(); 39 | }); 40 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/src/node/equinox.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import * as glob from "glob"; 12 | import * as path from "path"; 13 | 14 | export function findEquinoxLauncher(productPath: string): string { 15 | const jarPaths = glob.sync("**/plugins/org.eclipse.equinox.launcher_*.jar", { cwd: productPath }); 16 | if (jarPaths.length === 0) { 17 | throw new Error("The eclipse.equinox.launcher is not found. "); 18 | } 19 | const jarPath = path.resolve(productPath, jarPaths[0]); 20 | return jarPath; 21 | } 22 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/src/node/model-server-client.ts: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | import { ModelServerMessage, Response } from "@eclipse-emfcloud/modelserver-theia"; 12 | import { DefaultModelServerClient } from "@eclipse-emfcloud/modelserver-theia/lib/node"; 13 | import { injectable } from "inversify"; 14 | 15 | import { UmlDiagramType, UmlModelServerClient } from "../common/uml-model-server-client"; 16 | 17 | export namespace UmlModelServerPaths { 18 | export const CREATE_UML = "uml/create"; 19 | } 20 | 21 | @injectable() 22 | export class UmlModelServerClientImpl extends DefaultModelServerClient implements UmlModelServerClient { 23 | 24 | async createUmlResource(modelName: string, diagramType: UmlDiagramType): Promise> { 25 | const newModelUri = `${modelName}/model/${modelName}.uml`; 26 | return this.restClient.get(`${UmlModelServerPaths.CREATE_UML}?modeluri=${newModelUri}&diagramtype=${diagramType}`); 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /client/packages/uml-theia-integration/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../configs/base.tsconfig.json", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "rootDir": "src", 6 | "outDir": "lib", 7 | "skipLibCheck": true 8 | }, 9 | "include": [ 10 | "src" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./configs/base.tsconfig", 3 | "compilerOptions": { 4 | "baseUrl": ".", 5 | "paths": { 6 | "@eclipsesource/uml-glsp-common": [ 7 | "packages/common/src/*" 8 | ], 9 | "@eclipsesource/uml-sprotty": [ 10 | "packages/uml-sprotty/src/*" 11 | ], 12 | "@eclipsesource/uml-theia": [ 13 | "packages/uml-theia-integration/src/*" 14 | ], 15 | } 16 | }, 17 | "include": [ 18 | "packages/*/src" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /client/workspace/course/model/course.unotation: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /documentation/uml-glsp-animated-classdiagram.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eclipsesource/uml-glsp/8640b88525297ea7edd6efa98571a630352daf83/documentation/uml-glsp-animated-classdiagram.gif -------------------------------------------------------------------------------- /server/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | parent-pom 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | 19 | 1599121354274 20 | 21 | 30 22 | 23 | org.eclipse.core.resources.regexFilterMatcher 24 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /server/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/README.md: -------------------------------------------------------------------------------- 1 | # UML Editor - Server Development 2 | 3 | ## Getting started with the Eclipse IDE 4 | 5 | - Please make sure your Eclipse workspace uses a JRE of Java 11. 6 | - We use the [Eclipse Modeling Tools](https://www.eclipse.org/downloads/packages/release/2020-12/r/eclipse-modeling-tools) 7 | - The following Eclipse plugins are required: 8 | - The M2Eclipse (Maven Integration for Eclipse) plugin: 9 | - Update site location: http://download.eclipse.org/technology/m2e/releases/ 10 | - Install *Maven Integration for Eclipse* 11 | - Import all maven projects via `File > Import... > Maven > Existing Maven Projects > Root directory: $REPO_LOCATION`. 12 | - You may skip the parent modules (i.e. `com.eclipsesource.uml.parent`, `com.eclipsesource.uml.glsp.app` and `com.eclipsesource.uml.modelserver.app`) 13 | - You need to set the active target platform once to be able to resolve all necessary plugins. To do so, open `r2020-09.target` (located in the module `targetplatform`) and hit `Set Active Target Platform` in the Target Editor. After the target platform is set, you can simple reload the target platform on demand. 14 | 15 | 16 | ## Build 17 | 18 | To build the model server as standalone JAR and execute all component tests execute the following maven goal in the root directory: 19 | ```bash 20 | mvn clean install 21 | ``` 22 | 23 | ## Running/Debugging 24 | 25 | ### Execute from IDE 26 | To start both server instances within the Eclipse IDE, run or debug the Launch Group configuration `UML-GLSP App.launch` (located in module `com.eclipsesource.uml.modelserver.product`). 27 | 28 | To start the instances separately, run or debug the following launch configs as Eclipse products: 29 | - `com.eclipsesource.uml.modelserver.product.launch` located in module `com.eclipsesource.uml.modelserver.product` 30 | - `com.eclipsesource.uml.glsp.product.launch` located in module `com.eclipsesource.uml.glsp.product` 31 | 32 | 33 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eclipsesource.uml.glsp-app 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eclipsesource.uml.glsp.app 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 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.m2e.core.maven2Nature 31 | org.eclipse.pde.PluginNature 32 | org.eclipse.jdt.core.javanature 33 | 34 | 35 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 3 | org.eclipse.jdt.core.compiler.compliance=11 4 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 5 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 8 | org.eclipse.jdt.core.compiler.release=enabled 9 | org.eclipse.jdt.core.compiler.source=11 10 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %pluginName 4 | Bundle-SymbolicName: com.eclipsesource.uml.glsp.app;singleton:=true 5 | Bundle-Version: 0.1.0.qualifier 6 | Bundle-Vendor: %providerName 7 | Automatic-Module-Name: com.eclipsesource.uml.glsp.app 8 | Bundle-RequiredExecutionEnvironment: JavaSE-11 9 | Require-Bundle: org.eclipse.equinox.app;bundle-version="1.4.0", 10 | com.eclipsesource.uml.glsp;bundle-version="0.1.0", 11 | org.eclipse.equinox.event;bundle-version="1.5.500" 12 | Export-Package: com.eclipsesource.uml.glsp.app 13 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | bin.includes = META-INF/,\ 3 | .,\ 4 | plugin.xml 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/plugin.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 EclipseSource and others. 2 | # 3 | # This program and the accompanying materials are made available under the 4 | # terms of the Eclipse Public License v. 2.0 which is available at 5 | # https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 6 | # available at https://opensource.org/licenses/MIT. 7 | # 8 | # SPDX-License-Identifier: EPL-2.0 OR MIT 9 | # 10 | 11 | pluginName = Uml GLSP Server App plugin 12 | providerName = EclipseSource 13 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 13 | 14 | 15 | 16 | 19 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | com.eclipsesource.uml 8 | com.eclipsesource.uml.glsp-app 9 | 0.1.0 10 | 11 | 12 | com.eclipsesource.uml.glsp.app 13 | 0.1.0-SNAPSHOT 14 | eclipse-plugin 15 | 16 | 17 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.app/src/com/eclipsesource/uml/glsp/app/ServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.eclipsesource.uml.glsp.app; 2 | 3 | import com.eclipsesource.uml.glsp.UmlGLSPServerLauncher; 4 | import org.eclipse.equinox.app.IApplication; 5 | import org.eclipse.equinox.app.IApplicationContext; 6 | 7 | /** 8 | * An application to start the UML GLSP Server. 9 | */ 10 | public class ServerApplication implements IApplication { 11 | 12 | @Override 13 | public Object start(IApplicationContext context) throws Exception { 14 | String[] args = getArgs(context); 15 | UmlGLSPServerLauncher.main(args); 16 | return null; 17 | } 18 | 19 | private String[] getArgs(IApplicationContext context) { 20 | Object object = context.getArguments().get(IApplicationContext.APPLICATION_ARGS); 21 | if (object instanceof String[]) { 22 | return (String[])object; 23 | } 24 | return new String[0]; 25 | } 26 | 27 | @Override 28 | public void stop() { 29 | // Nothing 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.feature/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.feature/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eclipsesource.uml.glsp.feature 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.FeatureBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.pde.FeatureNature 22 | 23 | 24 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.feature/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.feature/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.feature/build.properties: -------------------------------------------------------------------------------- 1 | bin.includes = feature.xml 2 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.feature/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | com.eclipsesource.uml 8 | com.eclipsesource.uml.glsp-app 9 | 0.1.0 10 | 11 | 12 | com.eclipsesource.uml.glsp.feature 13 | 0.1.0-SNAPSHOT 14 | eclipse-feature 15 | 16 | 17 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.product/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.product/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eclipsesource.uml.glsp.product 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.product/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.product/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.product/com.eclipsesource.uml.glsp.product: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -nosplash 11 | 12 | -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/com.eclipsesource.uml.glsp.product/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | com.eclipsesource.uml 8 | com.eclipsesource.uml.glsp-app 9 | 0.1.0 10 | 11 | 12 | com.eclipsesource.uml.glsp.product 13 | eclipse-repository 14 | 15 | 16 | 17 | 18 | org.eclipse.tycho 19 | tycho-p2-director-plugin 20 | ${tycho.version} 21 | 22 | 23 | materialize-products 24 | 25 | materialize-products 26 | 27 | 28 | 29 | 30 | 31 | org.apache.maven.plugins 32 | maven-antrun-plugin 33 | ${maven.antrun.plugin.version} 34 | 35 | 36 | Copy Jar to client/packages/uml-theia-integration 37 | package 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | run 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp-app/pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | com.eclipsesource.uml.glsp-app 7 | pom 8 | 9 | 10 | com.eclipsesource.uml 11 | com.eclipsesource.uml.parent 12 | 0.1.0 13 | 14 | 15 | 16 | com.eclipsesource.uml.glsp.app 17 | com.eclipsesource.uml.glsp.feature 18 | com.eclipsesource.uml.glsp.product 19 | 20 | 21 | 22 | 23 | 24 | org.eclipse.tycho 25 | target-platform-configuration 26 | 27 | 28 | 29 | linux 30 | gtk 31 | x86_64 32 | 33 | 34 | win32 35 | win32 36 | x86_64 37 | 38 | 39 | macosx 40 | cocoa 41 | x86_64 42 | 43 | 44 | 45 | 46 | 47 | org.eclipse.tycho 48 | tycho-maven-plugin 49 | true 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eclipsesource.uml.glsp 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 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.m2e.core.maven2Nature 31 | org.eclipse.jdt.core.javanature 32 | org.eclipse.pde.PluginNature 33 | 34 | 35 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/.settings/org.eclipse.jdt.launching.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.launching.PREF_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE=ignore 3 | org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore 4 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %pluginName 4 | Bundle-SymbolicName: com.eclipsesource.uml.glsp;singleton:=true 5 | Automatic-Module-Name: com.eclipsesource.uml.glsp 6 | Bundle-Version: 0.1.0.qualifier 7 | Bundle-ClassPath: . 8 | Bundle-Vendor: %providerName 9 | Bundle-Localization: plugin 10 | Bundle-RequiredExecutionEnvironment: JavaSE-11 11 | Export-Package: com.eclipsesource.uml.glsp, 12 | com.eclipsesource.uml.glsp.actions, 13 | com.eclipsesource.uml.glsp.diagram, 14 | com.eclipsesource.uml.glsp.gmodel, 15 | com.eclipsesource.uml.glsp.model, 16 | com.eclipsesource.uml.glsp.modelserver, 17 | com.eclipsesource.uml.glsp.operations, 18 | com.eclipsesource.uml.glsp.palette, 19 | com.eclipsesource.uml.glsp.util 20 | Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.23.0,4.0.0)", 21 | org.eclipse.emf.ecore;bundle-version="[2.25.0,3.0.0)";visibility:=reexport, 22 | org.eclipse.glsp.graph;bundle-version="[0.10.0,0.11.0)", 23 | org.eclipse.glsp.layout;bundle-version="[0.10.0,0.11.0)", 24 | org.eclipse.glsp.server;bundle-version="[0.10.0,0.11.0)", 25 | org.eclipse.elk.core;bundle-version="[0.7.1,0.8.0)", 26 | org.eclipse.elk.graph;bundle-version="[0.7.1,0.8.0)", 27 | org.eclipse.elk.alg.layered;bundle-version="[0.7.1,0.8.0)", 28 | org.eclipse.emf.ecore.xmi;bundle-version="[2.16.0,3.0.0)", 29 | org.eclipse.emf.edit;bundle-version="[2.16.0,3.0.0)", 30 | org.eclipse.emfcloud.modelserver.client;bundle-version="[0.7.0,0.8.0)", 31 | org.eclipse.emfcloud.modelserver.common;bundle-version="[0.7.0,0.8.0)", 32 | org.eclipse.emfcloud.modelserver.edit;bundle-version="[0.7.0,0.8.0)", 33 | org.eclipse.emfcloud.modelserver.emf;bundle-version="[0.7.0,0.8.0)", 34 | com.eclipsesource.uml.modelserver;bundle-version="0.1.0", 35 | org.eclipse.uml2.uml;bundle-version="[5.5.0,6.0.0)", 36 | org.eclipse.emf.common;bundle-version="[2.23.0,3.0.0)", 37 | org.eclipse.uml2.uml.resources;bundle-version="[5.5.0,6.0.0)", 38 | org.eclipse.emfcloud.modelserver.glsp.integration;bundle-version="0.7.0", 39 | org.eclipse.emfcloud.modelserver.glsp.notation.commands;bundle-version="0.7.0", 40 | org.eclipse.emfcloud.modelserver.glsp.notation.model;bundle-version="0.7.0", 41 | org.apache.log4j;bundle-version="1.2.19" 42 | Bundle-ActivationPolicy: lazy 43 | Import-Package: javax.inject;version="1.0.0" 44 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/build.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 EclipseSource and others. 2 | # 3 | # This program and the accompanying materials are made available under the 4 | # terms of the Eclipse Public License v. 2.0 which is available at 5 | # https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 6 | # available at https://opensource.org/licenses/MIT. 7 | # 8 | # SPDX-License-Identifier: EPL-2.0 OR MIT 9 | # 10 | 11 | bin.includes = .,\ 12 | META-INF/,\ 13 | plugin.properties 14 | jars.compile.order = . 15 | source.. = src/main/java/ 16 | output.. = target/classes/ 17 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/plugin.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 EclipseSource and others. 2 | # 3 | # This program and the accompanying materials are made available under the 4 | # terms of the Eclipse Public License v. 2.0 which is available at 5 | # https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 6 | # available at https://opensource.org/licenses/MIT. 7 | # 8 | # SPDX-License-Identifier: EPL-2.0 OR MIT 9 | # 10 | 11 | pluginName = Uml GLSP Server plugin 12 | providerName = EclipseSource 13 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | com.eclipsesource.uml.glsp 6 | 0.1.0-SNAPSHOT 7 | eclipse-plugin 8 | 9 | 10 | com.eclipsesource.uml 11 | com.eclipsesource.uml.parent 12 | 0.1.0 13 | 14 | 15 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/UmlGLSPServer.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp; 12 | 13 | import java.net.MalformedURLException; 14 | import java.util.Optional; 15 | import java.util.concurrent.CompletableFuture; 16 | 17 | import org.eclipse.emfcloud.modelserver.client.v1.ModelServerClientV1; 18 | import org.eclipse.emfcloud.modelserver.glsp.EMSGLSPServer; 19 | import org.eclipse.glsp.server.protocol.DisposeClientSessionParameters; 20 | import org.eclipse.glsp.server.types.GLSPServerException; 21 | import org.eclipse.glsp.server.utils.ClientOptionsUtil; 22 | import org.eclipse.uml2.uml.resource.UMLResource; 23 | 24 | import com.eclipsesource.uml.modelserver.UmlModelServerClient; 25 | import com.eclipsesource.uml.modelserver.UmlNotationUtil; 26 | 27 | public class UmlGLSPServer extends EMSGLSPServer { 28 | 29 | @Override 30 | protected ModelServerClientV1 createModelServerClient(final String modelServerURL) throws MalformedURLException { 31 | return new UmlModelServerClient(modelServerURL); 32 | } 33 | 34 | @Override 35 | public CompletableFuture disposeClientSession(final DisposeClientSessionParameters params) { 36 | Optional modelServerClient = modelServerClientProvider.get(); 37 | if (modelServerClient.isPresent()) { 38 | String sourceURI = ClientOptionsUtil.getSourceUri(params.getArgs()) 39 | .orElseThrow(() -> new GLSPServerException("No source URI given to dispose client session!")); 40 | modelServerClient.get() 41 | .unsubscribe(sourceURI.replace(UmlNotationUtil.NOTATION_EXTENSION, UMLResource.FILE_EXTENSION)); 42 | } 43 | return super.disposeClientSession(params); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/UmlGLSPServerLauncher.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp; 12 | 13 | import org.apache.log4j.Logger; 14 | import org.eclipse.elk.alg.layered.options.LayeredMetaDataProvider; 15 | import org.eclipse.emfcloud.modelserver.command.CCommandPackage; 16 | import org.eclipse.glsp.layout.ElkLayoutEngine; 17 | import org.eclipse.glsp.server.di.ServerModule; 18 | import org.eclipse.glsp.server.launch.GLSPServerLauncher; 19 | import org.eclipse.glsp.server.launch.SocketGLSPServerLauncher; 20 | 21 | public class UmlGLSPServerLauncher { 22 | 23 | private static final Logger LOGGER = Logger.getLogger(UmlGLSPServerLauncher.class.getSimpleName()); 24 | 25 | private static final int DEFAULT_PORT = 5007; 26 | 27 | public static void main(final String[] args) { 28 | int port = getPort(args); 29 | ElkLayoutEngine.initialize(new LayeredMetaDataProvider()); 30 | ServerModule module = new UmlServerModule(); 31 | module.configureDiagramModule(new UmlGLSPModule()); 32 | GLSPServerLauncher launcher = new SocketGLSPServerLauncher(module); 33 | CCommandPackage.eINSTANCE.eClass(); 34 | launcher.start("localhost", port); 35 | } 36 | 37 | private static int getPort(final String[] args) { 38 | for (int i = 0; i < args.length; i++) { 39 | if ("--port".contentEquals(args[i])) { 40 | return Integer.parseInt(args[i + 1]); 41 | } 42 | } 43 | LOGGER.info("The server port was not specified; using default port 5007"); 44 | return DEFAULT_PORT; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/UmlServerModule.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp; 12 | 13 | import org.eclipse.glsp.server.di.ServerModule; 14 | import org.eclipse.glsp.server.protocol.GLSPServer; 15 | 16 | public class UmlServerModule extends ServerModule { 17 | 18 | @Override 19 | protected Class bindGLSPServer() { 20 | return UmlGLSPServer.class; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/actions/ActionKind.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.actions; 12 | 13 | public class ActionKind { 14 | private ActionKind() {} 15 | 16 | public static final String GET_TYPES = "getTypes"; 17 | public static final String RETURN_TYPES = "returnTypes"; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/actions/GetTypesAction.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.actions; 12 | 13 | import org.eclipse.glsp.server.actions.RequestAction; 14 | 15 | public class GetTypesAction extends RequestAction { 16 | 17 | public GetTypesAction() { 18 | super(ActionKind.GET_TYPES); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/actions/ReturnTypesAction.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.actions; 12 | 13 | import java.util.List; 14 | 15 | import org.eclipse.glsp.server.actions.ResponseAction; 16 | 17 | public class ReturnTypesAction extends ResponseAction { 18 | 19 | private List types; 20 | 21 | public ReturnTypesAction() { 22 | super(ActionKind.RETURN_TYPES); 23 | } 24 | 25 | public ReturnTypesAction(final List types) { 26 | super(ActionKind.RETURN_TYPES); 27 | this.types = types; 28 | } 29 | 30 | public List getTypes() { return types; } 31 | 32 | public void setTypes(final List types) { this.types = types; } 33 | } 34 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/actions/UmlGetTypesActionHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.actions; 12 | 13 | import java.util.Collections; 14 | import java.util.List; 15 | import java.util.concurrent.ExecutionException; 16 | 17 | import org.apache.log4j.Logger; 18 | import org.eclipse.emfcloud.modelserver.client.Response; 19 | import org.eclipse.emfcloud.modelserver.glsp.actions.handlers.EMSBasicActionHandler; 20 | import org.eclipse.glsp.server.actions.Action; 21 | 22 | import com.eclipsesource.uml.glsp.modelserver.UmlModelServerAccess; 23 | 24 | public class UmlGetTypesActionHandler extends EMSBasicActionHandler { 25 | 26 | private static Logger LOGGER = Logger.getLogger(UmlGetTypesActionHandler.class.getSimpleName()); 27 | 28 | @Override 29 | public List executeAction(final GetTypesAction action, final UmlModelServerAccess modelServerAccess) { 30 | try { 31 | Response> response = modelServerAccess.getUmlTypes().get(); 32 | List types = response.body(); 33 | Collections.sort(types); 34 | return List.of(new ReturnTypesAction(types)); 35 | } catch (InterruptedException | ExecutionException e) { 36 | LOGGER.error("Error while fetching UML types from Model Server"); 37 | e.printStackTrace(); 38 | } 39 | return List.of(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/gmodel/AbstractGModelFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.gmodel; 12 | 13 | import java.util.Optional; 14 | 15 | import org.eclipse.emf.ecore.EObject; 16 | import org.eclipse.emf.ecore.util.EcoreUtil; 17 | import org.eclipse.glsp.graph.GModelElement; 18 | 19 | import com.eclipsesource.uml.glsp.model.UmlModelState; 20 | 21 | public abstract class AbstractGModelFactory { 22 | 23 | protected UmlModelState modelState; 24 | 25 | public AbstractGModelFactory(final UmlModelState modelState) { 26 | this.modelState = modelState; 27 | } 28 | 29 | public abstract E create(T semanticElement); 30 | 31 | public Optional create(final T semanticElement, final Class clazz) { 32 | return Optional.ofNullable(create(semanticElement)).filter(clazz::isInstance).map(clazz::cast); 33 | } 34 | 35 | protected String toId(final EObject semanticElement) { 36 | String id = modelState.getIndex().getSemanticId(semanticElement).orElse(null); 37 | if (id == null) { 38 | id = EcoreUtil.getURI(semanticElement).fragment(); 39 | modelState.getIndex().indexSemantic(id, semanticElement); 40 | } 41 | return id; 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/gmodel/DiagramFactoryProvider.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.gmodel; 12 | 13 | import com.eclipsesource.uml.glsp.model.UmlModelState; 14 | import com.eclipsesource.uml.modelserver.unotation.Representation; 15 | 16 | public class DiagramFactoryProvider { 17 | 18 | public static DiagramFactory get(final UmlModelState modelState) { 19 | Representation diagramType = modelState.getNotationModel().getDiagramType(); 20 | switch (diagramType) { 21 | case CLASS: { 22 | return new UmlClassDiagramModelFactory(modelState); 23 | } 24 | } 25 | return null; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/layout/UmlLayoutEngine.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.layout; 12 | 13 | import org.eclipse.elk.alg.layered.options.EdgeLabelSideSelection; 14 | import org.eclipse.elk.alg.layered.options.LayeredOptions; 15 | import org.eclipse.elk.core.options.EdgeLabelPlacement; 16 | import org.eclipse.emf.ecore.util.EcoreUtil; 17 | import org.eclipse.glsp.graph.DefaultTypes; 18 | import org.eclipse.glsp.graph.GGraph; 19 | import org.eclipse.glsp.graph.GModelElement; 20 | import org.eclipse.glsp.layout.ElkLayoutEngine; 21 | import org.eclipse.glsp.layout.GLSPLayoutConfigurator; 22 | import org.eclipse.glsp.server.model.GModelState; 23 | 24 | public class UmlLayoutEngine extends ElkLayoutEngine { 25 | 26 | public GModelElement layoutRoot(final GModelState modelState) { 27 | 28 | GModelElement newRoot = EcoreUtil.copy(modelState.getRoot()); 29 | if (newRoot instanceof GGraph) { 30 | GLSPLayoutConfigurator configurator = new GLSPLayoutConfigurator(); 31 | // ELK Layered Algorithm Reference: 32 | // https://www.eclipse.org/elk/reference/algorithms/org-eclipse-elk-layered.html 33 | configurator.configureByType(DefaultTypes.GRAPH) 34 | .setProperty(LayeredOptions.EDGE_LABELS_PLACEMENT, EdgeLabelPlacement.CENTER) 35 | .setProperty(LayeredOptions.EDGE_LABELS_SIDE_SELECTION, EdgeLabelSideSelection.ALWAYS_UP); 36 | this.layout((GGraph) newRoot, configurator); 37 | } 38 | return newRoot; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/operations/UmlChangeBoundsOperationHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.operations; 12 | 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | 16 | import org.eclipse.emfcloud.modelserver.glsp.operations.handlers.EMSBasicOperationHandler; 17 | import org.eclipse.glsp.server.operations.ChangeBoundsOperation; 18 | import org.eclipse.glsp.server.types.ElementAndBounds; 19 | import org.eclipse.glsp.server.types.GLSPServerException; 20 | 21 | import com.eclipsesource.uml.glsp.model.UmlModelState; 22 | import com.eclipsesource.uml.glsp.modelserver.UmlModelServerAccess; 23 | import com.eclipsesource.uml.modelserver.unotation.Shape; 24 | 25 | public class UmlChangeBoundsOperationHandler 26 | extends EMSBasicOperationHandler { 27 | 28 | protected UmlModelState getUmlModelState() { return (UmlModelState) getEMSModelState(); } 29 | 30 | @Override 31 | public void executeOperation(final ChangeBoundsOperation changeBoundsOperation, 32 | final UmlModelServerAccess modelServerAccess) { 33 | UmlModelState modelState = getUmlModelState(); 34 | Map changeBoundsMap = new HashMap<>(); 35 | for (ElementAndBounds element : changeBoundsOperation.getNewBounds()) { 36 | modelState.getIndex().getNotation(element.getElementId(), Shape.class).ifPresent(notationElement -> { 37 | changeBoundsMap.put(notationElement, element); 38 | }); 39 | } 40 | modelServerAccess.changeBounds(changeBoundsMap) 41 | .thenAccept(response -> { 42 | if (!response.body()) { 43 | throw new GLSPServerException("Could not change bounds: " + changeBoundsMap.toString()); 44 | } 45 | }); 46 | } 47 | 48 | @Override 49 | public String getLabel() { return "Change bounds"; } 50 | } 51 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/operations/UmlChangeRoutingPointsOperationHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.operations; 12 | 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | 16 | import org.eclipse.emfcloud.modelserver.glsp.operations.handlers.EMSBasicOperationHandler; 17 | import org.eclipse.glsp.server.operations.ChangeRoutingPointsOperation; 18 | import org.eclipse.glsp.server.types.ElementAndRoutingPoints; 19 | 20 | import com.eclipsesource.uml.glsp.model.UmlModelState; 21 | import com.eclipsesource.uml.glsp.modelserver.UmlModelServerAccess; 22 | import com.eclipsesource.uml.modelserver.unotation.Edge; 23 | 24 | public class UmlChangeRoutingPointsOperationHandler 25 | extends EMSBasicOperationHandler { 26 | 27 | protected UmlModelState getUmlModelState() { return (UmlModelState) getEMSModelState(); } 28 | 29 | @Override 30 | public void executeOperation(final ChangeRoutingPointsOperation operation, 31 | final UmlModelServerAccess modelServerAccess) { 32 | UmlModelState modelState = getUmlModelState(); 33 | Map changeRoutingPointsMap = new HashMap<>(); 34 | for (ElementAndRoutingPoints element : operation.getNewRoutingPoints()) { 35 | modelState.getIndex().getNotation(element.getElementId(), Edge.class) 36 | .ifPresent(notationElement -> { 37 | changeRoutingPointsMap.put(notationElement, element); 38 | }); 39 | } 40 | modelServerAccess.changeRoutingPoints(changeRoutingPointsMap); 41 | } 42 | 43 | @Override 44 | public String getLabel() { return "Reroute uml edge"; } 45 | } 46 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/util/UmlConfig.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.util; 12 | 13 | public final class UmlConfig { 14 | 15 | public static final class Types { 16 | 17 | public static final String LABEL_NAME = "label:name"; 18 | public static final String LABEL_TEXT = "label:text"; 19 | public static final String LABEL_COMP = "comp:label"; 20 | public static final String LABEL_EDGE_NAME = "label:edge-name"; 21 | public static final String LABEL_EDGE_MULTIPLICITY = "label:edge-multiplicity"; 22 | public static final String COMPARTMENT = "comp"; 23 | public static final String COMPARTMENT_HEADER = "comp:header"; 24 | public static final String ICON_CLASS = "icon:class"; 25 | public static final String CLASS = "node:class"; 26 | public static final String PROPERTY = "comp:property"; 27 | public static final String ICON_PROPERTY = "icon:property"; 28 | public static final String LABEL_PROPERTY_NAME = "label:property:name"; 29 | public static final String LABEL_PROPERTY_TYPE = "label:property:type"; 30 | public static final String LABEL_PROPERTY_MULTIPLICITY = "label:property:multiplicity"; 31 | public static final String ASSOCIATION = "edge:association"; 32 | 33 | private Types() {} 34 | } 35 | 36 | public static final class CSS { 37 | 38 | public static final String NODE = "uml-node"; 39 | public static final String EDGE = "uml-edge"; 40 | 41 | private CSS() {} 42 | } 43 | 44 | private UmlConfig() {} 45 | } 46 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/util/UmlEdgeUtil.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.util; 12 | 13 | import org.eclipse.emf.ecore.EReference; 14 | 15 | public final class UmlEdgeUtil { 16 | 17 | private UmlEdgeUtil() {} 18 | 19 | public static String getStringId(final EReference reference) { 20 | return Integer.toString(reference.hashCode()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.glsp/src/main/java/com/eclipsesource/uml/glsp/util/UmlLabelUtil.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.glsp.util; 12 | 13 | import org.eclipse.uml2.uml.Property; 14 | 15 | public final class UmlLabelUtil { 16 | 17 | private UmlLabelUtil() {} 18 | 19 | public static String getTypeName(final Property property) { 20 | if (property.getType() != null) { 21 | return property.getType().getName(); 22 | } 23 | return ""; 24 | } 25 | 26 | public static String getMultiplicity(final Property property) { 27 | if (property.getLower() == property.getUpper()) { 28 | return String.format("%s", property.getUpper() == -1 ? "*" : property.getUpper()); 29 | } 30 | return String.format("%s..%s", property.getLower(), property.getUpper() == -1 ? "*" : property.getUpper()); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eclipsesource.uml.modelserver-app 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eclipsesource.uml.modelserver.app 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 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.m2e.core.maven2Nature 31 | org.eclipse.pde.PluginNature 32 | org.eclipse.jdt.core.javanature 33 | 34 | 35 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 3 | org.eclipse.jdt.core.compiler.compliance=11 4 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 5 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 8 | org.eclipse.jdt.core.compiler.release=enabled 9 | org.eclipse.jdt.core.compiler.source=11 10 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %pluginName 4 | Bundle-SymbolicName: com.eclipsesource.uml.modelserver.app;singleton:=true 5 | Bundle-Version: 0.1.0.qualifier 6 | Bundle-Vendor: %providerName 7 | Automatic-Module-Name: com.eclipsesource.uml.modelserver.app 8 | Bundle-RequiredExecutionEnvironment: JavaSE-11 9 | Export-Package: com.eclipsesource.uml.modelserver.app;uses:="org.eclipse.equinox.app" 10 | Require-Bundle: org.eclipse.equinox.app;bundle-version="1.4.0", 11 | com.eclipsesource.uml.modelserver;bundle-version="0.1.0", 12 | org.apache.logging.log4j;bundle-version="2.17.1", 13 | org.eclipse.core.runtime;bundle-version="3.24.100" 14 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = target/classes/ 3 | bin.includes = META-INF/,\ 4 | .,\ 5 | plugin.xml,\ 6 | resources/log4j2.xml 7 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/plugin.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 EclipseSource and others. 2 | # 3 | # This program and the accompanying materials are made available under the 4 | # terms of the Eclipse Public License v. 2.0 which is available at 5 | # https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 6 | # available at https://opensource.org/licenses/MIT. 7 | # 8 | # SPDX-License-Identifier: EPL-2.0 OR MIT 9 | # 10 | 11 | pluginName = Uml Model Server App plugin 12 | providerName = EclipseSource 13 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 10 | 13 | 14 | 15 | 16 | 19 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | com.eclipsesource.uml 8 | com.eclipsesource.uml.modelserver-app 9 | 0.1.0 10 | 11 | 12 | com.eclipsesource.uml.modelserver.app 13 | 0.1.0-SNAPSHOT 14 | eclipse-plugin 15 | 16 | 17 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | %d{DEFAULT_NANOS} [%t] %-5level %logger{1} - %msg%n 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.app/src/com/eclipsesource/uml/modelserver/app/ServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.eclipsesource.uml.modelserver.app; 2 | 3 | import java.io.IOException; 4 | import java.net.URL; 5 | import java.util.ArrayList; 6 | import java.util.Arrays; 7 | 8 | import org.eclipse.core.runtime.FileLocator; 9 | import org.eclipse.core.runtime.Platform; 10 | import org.eclipse.equinox.app.IApplication; 11 | import org.eclipse.equinox.app.IApplicationContext; 12 | 13 | import com.eclipsesource.uml.modelserver.UmlModelServerLauncher; 14 | 15 | /** 16 | * An application to start the UML GLSP Modelserver. 17 | */ 18 | public class ServerApplication implements IApplication { 19 | 20 | @Override 21 | public Object start(IApplicationContext context) throws Exception { 22 | String[] args = getArgs(context); 23 | String[] logArgs = addLogConfigArg(args); 24 | UmlModelServerLauncher.main(logArgs); 25 | System.in.read(); 26 | return null; 27 | } 28 | 29 | private String[] getArgs(IApplicationContext context) { 30 | Object object = context.getArguments().get(IApplicationContext.APPLICATION_ARGS); 31 | if (object instanceof String[]) { 32 | return (String[]) object; 33 | } 34 | return new String[0]; 35 | } 36 | 37 | private String[] addLogConfigArg(String[] args) { 38 | URL configPath = null; 39 | try { 40 | configPath = FileLocator 41 | .toFileURL(Platform.getBundle("com.eclipsesource.uml.modelserver.app").getEntry("resources/log4j2.xml")); 42 | } catch (IOException e) { 43 | e.printStackTrace(); 44 | } 45 | String logConfigParam = "-l=" + configPath.getFile(); 46 | 47 | ArrayList argsList = new ArrayList<>(); 48 | argsList.addAll(Arrays.asList(args)); 49 | argsList.add(logConfigParam); 50 | return argsList.toArray(new String[argsList.size()]); 51 | } 52 | 53 | @Override 54 | public void stop() { 55 | // Nothing 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.feature/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.feature/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eclipsesource.uml.modelserver.feature 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.pde.FeatureBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.pde.FeatureNature 22 | 23 | 24 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.feature/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.feature/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.feature/build.properties: -------------------------------------------------------------------------------- 1 | bin.includes = feature.xml 2 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.feature/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | com.eclipsesource.uml 8 | com.eclipsesource.uml.modelserver-app 9 | 0.1.0 10 | 11 | 12 | com.eclipsesource.uml.modelserver.feature 13 | 0.1.0-SNAPSHOT 14 | eclipse-feature 15 | 16 | 17 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.product/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.product/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eclipsesource.uml.modelserver.product 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.product/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.product/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.product/UML-GLSP App.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.product/com.eclipsesource.uml.modelserver.product: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -nosplash 11 | 12 | -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/com.eclipsesource.uml.modelserver.product/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | com.eclipsesource.uml 8 | com.eclipsesource.uml.modelserver-app 9 | 0.1.0 10 | 11 | 12 | com.eclipsesource.uml.modelserver.product 13 | eclipse-repository 14 | 15 | 16 | 17 | 18 | org.eclipse.tycho 19 | tycho-p2-director-plugin 20 | ${tycho.version} 21 | 22 | 23 | materialize-products 24 | 25 | materialize-products 26 | 27 | 28 | 29 | 30 | 31 | org.apache.maven.plugins 32 | maven-antrun-plugin 33 | ${maven.antrun.plugin.version} 34 | 35 | 36 | Copy Jar to client/packages/uml-theia-integration 37 | package 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | run 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver-app/pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | com.eclipsesource.uml.modelserver-app 7 | pom 8 | 9 | 10 | com.eclipsesource.uml 11 | com.eclipsesource.uml.parent 12 | 0.1.0 13 | 14 | 15 | 16 | com.eclipsesource.uml.modelserver.app 17 | com.eclipsesource.uml.modelserver.feature 18 | com.eclipsesource.uml.modelserver.product 19 | 20 | 21 | 22 | 23 | 24 | org.eclipse.tycho 25 | target-platform-configuration 26 | 27 | 28 | 29 | linux 30 | gtk 31 | x86_64 32 | 33 | 34 | win32 35 | win32 36 | x86_64 37 | 38 | 39 | macosx 40 | cocoa 41 | x86_64 42 | 43 | 44 | 45 | 46 | 47 | org.eclipse.tycho 48 | tycho-maven-plugin 49 | true 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.eclipsesource.uml.modelserver 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 | org.eclipse.m2e.core.maven2Builder 25 | 26 | 27 | 28 | 29 | 30 | org.eclipse.jdt.core.javanature 31 | org.eclipse.m2e.core.maven2Nature 32 | org.eclipse.pde.PluginNature 33 | 34 | 35 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/.settings/org.eclipse.jdt.launching.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.launching.PREF_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE=ignore 3 | org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=ignore 4 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %pluginName 4 | Bundle-SymbolicName: com.eclipsesource.uml.modelserver;singleton:=true 5 | Automatic-Module-Name: com.eclipsesource.uml.modelserver 6 | Bundle-Version: 0.1.0.qualifier 7 | Bundle-ClassPath: . 8 | Bundle-Vendor: %providerName 9 | Bundle-Localization: plugin 10 | Bundle-RequiredExecutionEnvironment: JavaSE-11 11 | Require-Bundle: org.apache.commons.io;bundle-version="[2.8.0,3.0.0)", 12 | com.google.inject;bundle-version="[5.0.1,6.0.0)", 13 | com.google.guava;bundle-version="[30.1.0,31.0.0)", 14 | org.eclipse.emf.common;bundle-version="[2.23.0,3.0.0)", 15 | org.eclipse.emf.ecore.xmi;bundle-version="[2.16.0,3.0.0)", 16 | org.eclipse.emfcloud.modelserver.client;bundle-version="[0.7.0,0.8.0)", 17 | org.eclipse.emfcloud.modelserver.common;bundle-version="[0.7.0,0.8.0)", 18 | org.eclipse.emfcloud.modelserver.edit;bundle-version="[0.7.0,0.8.0)", 19 | org.eclipse.emfcloud.modelserver.emf;bundle-version="[0.7.0,0.8.0)", 20 | org.eclipse.emfcloud.modelserver.lib;bundle-version="[0.7.0,0.8.0)", 21 | org.eclipse.glsp.graph;bundle-version="[0.10.0,0.11.0)", 22 | org.eclipse.uml2.common;bundle-version="[2.5.0,3.0.0)", 23 | org.eclipse.uml2.types;bundle-version="[2.5.0,3.0.0)", 24 | org.eclipse.uml2.uml;bundle-version="[5.5.0,6.0.0)", 25 | org.eclipse.emf.edit;bundle-version="[2.16.0,3.0.0)", 26 | org.eclipse.emf.transaction;bundle-version="[1.9.1,2.0.0)", 27 | com.fasterxml.jackson.core.jackson-core;bundle-version="[2.12.1,3.0.0)", 28 | com.fasterxml.jackson.core.jackson-databind;bundle-version="[2.12.1,3.0.0)", 29 | org.eclipse.uml2.uml.resources;bundle-version="[5.5.0,6.0.0)", 30 | org.eclipse.emfcloud.modelserver.glsp.notation.commands;bundle-version="[0.7.0,0.8.0)", 31 | org.eclipse.emfcloud.modelserver.glsp.notation.model;bundle-version="[0.7.0,0.8.0)", 32 | org.eclipse.emfcloud.modelserver.glsp.integration;bundle-version="[0.7.0,0.8.0)", 33 | org.apache.logging.log4j;bundle-version="2.17.1" 34 | Bundle-ActivationPolicy: lazy 35 | Export-Package: com.eclipsesource.uml.modelserver, 36 | com.eclipsesource.uml.modelserver.commands.contributions, 37 | com.eclipsesource.uml.modelserver.unotation, 38 | com.eclipsesource.uml.modelserver.unotation.impl, 39 | com.eclipsesource.uml.modelserver.unotation.util 40 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/build.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 EclipseSource and others. 2 | # 3 | # This program and the accompanying materials are made available under the 4 | # terms of the Eclipse Public License v. 2.0 which is available at 5 | # https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 6 | # available at https://opensource.org/licenses/MIT. 7 | # 8 | # SPDX-License-Identifier: EPL-2.0 OR MIT 9 | 10 | bin.includes = .,\ 11 | META-INF/,\ 12 | plugin.xml,\ 13 | plugin.properties 14 | jars.compile.order = . 15 | source.. = src/main/java-gen/,\ 16 | src/main/java/ 17 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/plugin.properties: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021 EclipseSource and others. 2 | # 3 | # This program and the accompanying materials are made available under the 4 | # terms of the Eclipse Public License v. 2.0 which is available at 5 | # https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 6 | # available at https://opensource.org/licenses/MIT. 7 | # 8 | # SPDX-License-Identifier: EPL-2.0 OR MIT 9 | # 10 | 11 | pluginName = Uml Model Server plugin 12 | providerName = EclipseSource 13 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.eclipsesource.uml.modelserver 4 | 0.1.0-SNAPSHOT 5 | eclipse-plugin 6 | 7 | 8 | com.eclipsesource.uml 9 | com.eclipsesource.uml.parent 10 | 0.1.0 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/UmlModelServerLauncher.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the Eclipse 10 | * Public License v. 2.0 are satisfied: GNU General Public License, version 2 11 | * with the GNU Classpath Exception which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | ********************************************************************************/ 16 | package com.eclipsesource.uml.modelserver; 17 | 18 | import org.eclipse.emfcloud.modelserver.emf.launch.CLIBasedModelServerLauncher; 19 | import org.eclipse.emfcloud.modelserver.emf.launch.CLIParser; 20 | import org.eclipse.emfcloud.modelserver.emf.launch.ModelServerLauncher; 21 | 22 | public class UmlModelServerLauncher { 23 | 24 | public static void main(final String[] args) { 25 | final ModelServerLauncher launcher = new CLIBasedModelServerLauncher(createCLIParser(args), 26 | new UmlModelServerModule()); 27 | launcher.run(); 28 | } 29 | 30 | protected static CLIParser createCLIParser(final String[] args) { 31 | CLIParser parser = new CLIParser(args, CLIParser.getDefaultCLIOptions(), "", 8081); 32 | return parser; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/UmlModelServerPaths.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver; 12 | 13 | import org.eclipse.emfcloud.modelserver.common.ModelServerPathsV1; 14 | 15 | public interface UmlModelServerPaths extends ModelServerPathsV1 { 16 | 17 | String UML_TYPES = "uml/types"; 18 | String UML_CREATE = "uml/create"; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/UmlModelServerPathsParameters.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver; 12 | 13 | import org.eclipse.emfcloud.modelserver.common.ModelServerPathParametersV1; 14 | 15 | public interface UmlModelServerPathsParameters extends ModelServerPathParametersV1 { 16 | 17 | String DIAGRAM_TYPE = "diagramtype"; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/UmlNotationUtil.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver; 12 | 13 | import com.eclipsesource.uml.modelserver.unotation.Representation; 14 | 15 | public final class UmlNotationUtil { 16 | 17 | private UmlNotationUtil() {} 18 | 19 | public static final String NOTATION_EXTENSION = "unotation"; 20 | 21 | public static Representation getRepresentation(final String diagramType) { 22 | switch (diagramType.toLowerCase()) { 23 | case "activity": 24 | return Representation.ACTIVITY; 25 | case "class": 26 | return Representation.CLASS; 27 | case "component": 28 | return Representation.COMPONENT; 29 | case "deployment": 30 | return Representation.DEPLOYMENT; 31 | case "package": 32 | return Representation.PACKAGE; 33 | case "sequence": 34 | return Representation.SEQUENCE; 35 | case "statemachine": 36 | return Representation.STATEMACHINE; 37 | case "usecase": 38 | return Representation.USECASE; 39 | } 40 | return Representation.CLASS; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/UmlPackageConfiguration.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the Eclipse 10 | * Public License v. 2.0 are satisfied: GNU General Public License, version 2 11 | * with the GNU Classpath Exception which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | ********************************************************************************/ 16 | package com.eclipsesource.uml.modelserver; 17 | 18 | import java.util.Collection; 19 | 20 | import org.eclipse.emfcloud.modelserver.emf.configuration.EPackageConfiguration; 21 | import org.eclipse.uml2.uml.UMLPackage; 22 | import org.eclipse.uml2.uml.resource.UMLResource; 23 | 24 | import com.google.common.collect.Lists; 25 | 26 | public class UmlPackageConfiguration implements EPackageConfiguration { 27 | 28 | @Override 29 | public String getId() { return UMLPackage.eINSTANCE.getNsURI(); } 30 | 31 | @Override 32 | public Collection getFileExtensions() { return Lists.newArrayList(UMLResource.FILE_EXTENSION); } 33 | 34 | @Override 35 | public void registerEPackage() { 36 | UMLPackage.eINSTANCE.eClass(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/UnotationPackageConfiguration.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0. 7 | * 8 | * This Source Code may also be made available under the following Secondary 9 | * Licenses when the conditions for such availability set forth in the Eclipse 10 | * Public License v. 2.0 are satisfied: GNU General Public License, version 2 11 | * with the GNU Classpath Exception which is available at 12 | * https://www.gnu.org/software/classpath/license.html. 13 | * 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 15 | ********************************************************************************/ 16 | package com.eclipsesource.uml.modelserver; 17 | 18 | import java.util.Collection; 19 | 20 | import org.eclipse.emfcloud.modelserver.emf.configuration.EPackageConfiguration; 21 | 22 | import com.eclipsesource.uml.modelserver.unotation.UnotationPackage; 23 | import com.google.common.collect.Lists; 24 | 25 | public class UnotationPackageConfiguration implements EPackageConfiguration { 26 | 27 | @Override 28 | public String getId() { return UnotationPackage.eINSTANCE.getNsURI(); } 29 | 30 | @Override 31 | public Collection getFileExtensions() { return Lists.newArrayList("unotation"); } 32 | 33 | @Override 34 | public void registerEPackage() { 35 | UnotationPackage.eINSTANCE.eClass(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/compound/AddAssociationCompoundCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.compound; 12 | 13 | import java.util.function.Supplier; 14 | 15 | import org.eclipse.emf.common.command.CompoundCommand; 16 | import org.eclipse.emf.common.util.URI; 17 | import org.eclipse.emf.edit.domain.EditingDomain; 18 | import org.eclipse.uml2.uml.Association; 19 | 20 | import com.eclipsesource.uml.modelserver.commands.notation.AddAssociationEdgeCommand; 21 | import com.eclipsesource.uml.modelserver.commands.semantic.AddAssociationCommand; 22 | 23 | public class AddAssociationCompoundCommand extends CompoundCommand { 24 | 25 | public AddAssociationCompoundCommand(final EditingDomain domain, final URI modelUri, 26 | final String sourceClassUriFragment, final String targetClassUriFragment) { 27 | 28 | // Chain semantic and notation command 29 | AddAssociationCommand command = new AddAssociationCommand(domain, modelUri, sourceClassUriFragment, 30 | targetClassUriFragment); 31 | this.append(command); 32 | Supplier semanticResultSupplier = () -> command.getNewAssociation(); 33 | this.append(new AddAssociationEdgeCommand(domain, modelUri, semanticResultSupplier)); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/compound/AddClassCompoundCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.compound; 12 | 13 | import java.util.function.Supplier; 14 | 15 | import org.eclipse.emf.common.command.CompoundCommand; 16 | import org.eclipse.emf.common.util.URI; 17 | import org.eclipse.emf.edit.domain.EditingDomain; 18 | import org.eclipse.glsp.graph.GPoint; 19 | import org.eclipse.uml2.uml.Class; 20 | 21 | import com.eclipsesource.uml.modelserver.commands.notation.AddClassShapeCommand; 22 | import com.eclipsesource.uml.modelserver.commands.semantic.AddClassCommand; 23 | 24 | public class AddClassCompoundCommand extends CompoundCommand { 25 | 26 | public AddClassCompoundCommand(final EditingDomain domain, final URI modelUri, final GPoint classPosition) { 27 | 28 | // Chain semantic and notation command 29 | AddClassCommand command = new AddClassCommand(domain, modelUri); 30 | this.append(command); 31 | Supplier semanticResultSupplier = () -> command.getNewClass(); 32 | this.append(new AddClassShapeCommand(domain, modelUri, classPosition, semanticResultSupplier)); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/compound/RemoveAssociationCompoundCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.compound; 12 | 13 | import org.eclipse.emf.common.command.CompoundCommand; 14 | import org.eclipse.emf.common.util.URI; 15 | import org.eclipse.emf.edit.domain.EditingDomain; 16 | 17 | import com.eclipsesource.uml.modelserver.commands.notation.RemoveAssociationEdgeCommand; 18 | import com.eclipsesource.uml.modelserver.commands.semantic.RemoveAssociationCommand; 19 | 20 | public class RemoveAssociationCompoundCommand extends CompoundCommand { 21 | 22 | public RemoveAssociationCompoundCommand(final EditingDomain domain, final URI modelUri, 23 | final String semanticUriFragment) { 24 | this.append(new RemoveAssociationCommand(domain, modelUri, semanticUriFragment)); 25 | this.append(new RemoveAssociationEdgeCommand(domain, modelUri, semanticUriFragment)); 26 | 27 | // TODO Make sure to remove also all other AssociationEnds (not only the ownedByAssociation Ends! 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/AddPropertyCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.Command; 14 | import org.eclipse.emf.common.util.URI; 15 | import org.eclipse.emf.edit.domain.EditingDomain; 16 | import org.eclipse.emfcloud.modelserver.command.CCommand; 17 | import org.eclipse.emfcloud.modelserver.command.CCommandFactory; 18 | import org.eclipse.emfcloud.modelserver.common.codecs.DecodingException; 19 | 20 | import com.eclipsesource.uml.modelserver.commands.semantic.AddPropertyCommand; 21 | 22 | public class AddPropertyCommandContribution extends UmlSemanticCommandContribution { 23 | 24 | public static final String TYPE = "addProperty"; 25 | 26 | public static CCommand create(final String parentSemanticUri) { 27 | CCommand addPropertyCommand = CCommandFactory.eINSTANCE.createCommand(); 28 | addPropertyCommand.setType(TYPE); 29 | addPropertyCommand.getProperties().put(PARENT_SEMANTIC_URI_FRAGMENT, parentSemanticUri); 30 | return addPropertyCommand; 31 | } 32 | 33 | @Override 34 | protected Command toServer(final URI modelUri, final EditingDomain domain, final CCommand command) 35 | throws DecodingException { 36 | 37 | String parentSemanticUriFragment = command.getProperties().get(PARENT_SEMANTIC_URI_FRAGMENT); 38 | return new AddPropertyCommand(domain, modelUri, parentSemanticUriFragment); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/RemoveAssociationCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.CompoundCommand; 14 | import org.eclipse.emf.common.util.URI; 15 | import org.eclipse.emf.edit.domain.EditingDomain; 16 | import org.eclipse.emfcloud.modelserver.command.CCommand; 17 | import org.eclipse.emfcloud.modelserver.command.CCommandFactory; 18 | import org.eclipse.emfcloud.modelserver.command.CCompoundCommand; 19 | import org.eclipse.emfcloud.modelserver.common.codecs.DecodingException; 20 | 21 | import com.eclipsesource.uml.modelserver.commands.compound.RemoveAssociationCompoundCommand; 22 | 23 | public class RemoveAssociationCommandContribution extends UmlCompoundCommandContribution { 24 | 25 | public static final String TYPE = "removeAssociation"; 26 | 27 | public static CCompoundCommand create(final String semanticUriFragment) { 28 | CCompoundCommand removeAssociationCommand = CCommandFactory.eINSTANCE.createCompoundCommand(); 29 | removeAssociationCommand.setType(TYPE); 30 | removeAssociationCommand.getProperties().put(SEMANTIC_URI_FRAGMENT, semanticUriFragment); 31 | return removeAssociationCommand; 32 | } 33 | 34 | @Override 35 | protected CompoundCommand toServer(final URI modelUri, final EditingDomain domain, final CCommand command) 36 | throws DecodingException { 37 | 38 | String semanticUriFragment = command.getProperties().get(SEMANTIC_URI_FRAGMENT); 39 | return new RemoveAssociationCompoundCommand(domain, modelUri, semanticUriFragment); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/RemoveClassCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.CompoundCommand; 14 | import org.eclipse.emf.common.util.URI; 15 | import org.eclipse.emf.edit.domain.EditingDomain; 16 | import org.eclipse.emfcloud.modelserver.command.CCommand; 17 | import org.eclipse.emfcloud.modelserver.command.CCommandFactory; 18 | import org.eclipse.emfcloud.modelserver.command.CCompoundCommand; 19 | import org.eclipse.emfcloud.modelserver.common.codecs.DecodingException; 20 | 21 | import com.eclipsesource.uml.modelserver.commands.compound.RemoveClassCompoundCommand; 22 | 23 | public class RemoveClassCommandContribution extends UmlCompoundCommandContribution { 24 | 25 | public static final String TYPE = "removeClass"; 26 | 27 | public static CCompoundCommand create(final String semanticUri) { 28 | CCompoundCommand removeClassCommand = CCommandFactory.eINSTANCE.createCompoundCommand(); 29 | removeClassCommand.setType(TYPE); 30 | removeClassCommand.getProperties().put(SEMANTIC_URI_FRAGMENT, semanticUri); 31 | return removeClassCommand; 32 | } 33 | 34 | @Override 35 | protected CompoundCommand toServer(final URI modelUri, final EditingDomain domain, final CCommand command) 36 | throws DecodingException { 37 | 38 | String semanticUriFragment = command.getProperties().get(SEMANTIC_URI_FRAGMENT); 39 | return new RemoveClassCompoundCommand(domain, modelUri, semanticUriFragment); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/RemovePropertyCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.Command; 14 | import org.eclipse.emf.common.util.URI; 15 | import org.eclipse.emf.edit.domain.EditingDomain; 16 | import org.eclipse.emfcloud.modelserver.command.CCommand; 17 | import org.eclipse.emfcloud.modelserver.command.CCommandFactory; 18 | import org.eclipse.emfcloud.modelserver.common.codecs.DecodingException; 19 | 20 | import com.eclipsesource.uml.modelserver.commands.semantic.RemovePropertyCommand; 21 | 22 | public class RemovePropertyCommandContribution extends UmlSemanticCommandContribution { 23 | 24 | public static final String TYPE = "removeProperty"; 25 | 26 | public static CCommand create(final String parentSemanticUri, final String semanticUri) { 27 | CCommand removePropertyCommand = CCommandFactory.eINSTANCE.createCommand(); 28 | removePropertyCommand.setType(TYPE); 29 | removePropertyCommand.getProperties().put(PARENT_SEMANTIC_URI_FRAGMENT, parentSemanticUri); 30 | removePropertyCommand.getProperties().put(SEMANTIC_URI_FRAGMENT, semanticUri); 31 | return removePropertyCommand; 32 | } 33 | 34 | @Override 35 | protected Command toServer(final URI modelUri, final EditingDomain domain, final CCommand command) 36 | throws DecodingException { 37 | 38 | String parentSemanticUri = command.getProperties().get(PARENT_SEMANTIC_URI_FRAGMENT); 39 | String semanticUri = command.getProperties().get(SEMANTIC_URI_FRAGMENT); 40 | 41 | return new RemovePropertyCommand(domain, modelUri, parentSemanticUri, semanticUri); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/SetAssociationEndNameCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.Command; 14 | import org.eclipse.emf.common.util.URI; 15 | import org.eclipse.emf.edit.domain.EditingDomain; 16 | import org.eclipse.emfcloud.modelserver.command.CCommand; 17 | import org.eclipse.emfcloud.modelserver.command.CCommandFactory; 18 | import org.eclipse.emfcloud.modelserver.common.codecs.DecodingException; 19 | 20 | import com.eclipsesource.uml.modelserver.commands.semantic.SetAssociationEndNameCommand; 21 | 22 | public class SetAssociationEndNameCommandContribution extends UmlSemanticCommandContribution { 23 | 24 | public static final String TYPE = "setAssociationEndName"; 25 | public static final String NEW_NAME = "newName"; 26 | 27 | public static CCommand create(final String semanticUri, final String newName) { 28 | CCommand setAssociationEndNameCommand = CCommandFactory.eINSTANCE.createCommand(); 29 | setAssociationEndNameCommand.setType(TYPE); 30 | setAssociationEndNameCommand.getProperties().put(SEMANTIC_URI_FRAGMENT, semanticUri); 31 | setAssociationEndNameCommand.getProperties().put(NEW_NAME, newName); 32 | return setAssociationEndNameCommand; 33 | } 34 | 35 | @Override 36 | protected Command toServer(final URI modelUri, final EditingDomain domain, final CCommand command) 37 | throws DecodingException { 38 | 39 | String semanticUriFragment = command.getProperties().get(SEMANTIC_URI_FRAGMENT); 40 | String newName = command.getProperties().get(NEW_NAME); 41 | 42 | return new SetAssociationEndNameCommand(domain, modelUri, semanticUriFragment, newName); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/SetClassNameCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.Command; 14 | import org.eclipse.emf.common.util.URI; 15 | import org.eclipse.emf.edit.domain.EditingDomain; 16 | import org.eclipse.emfcloud.modelserver.command.CCommand; 17 | import org.eclipse.emfcloud.modelserver.command.CCommandFactory; 18 | import org.eclipse.emfcloud.modelserver.common.codecs.DecodingException; 19 | 20 | import com.eclipsesource.uml.modelserver.commands.semantic.SetClassNameCommand; 21 | 22 | public class SetClassNameCommandContribution extends UmlSemanticCommandContribution { 23 | 24 | public static final String TYPE = "setClassName"; 25 | public static final String NEW_NAME = "newName"; 26 | 27 | public static CCommand create(final String semanticUri, final String newName) { 28 | CCommand setClassNameCommand = CCommandFactory.eINSTANCE.createCommand(); 29 | setClassNameCommand.setType(TYPE); 30 | setClassNameCommand.getProperties().put(SEMANTIC_URI_FRAGMENT, semanticUri); 31 | setClassNameCommand.getProperties().put(NEW_NAME, newName); 32 | return setClassNameCommand; 33 | } 34 | 35 | @Override 36 | protected Command toServer(final URI modelUri, final EditingDomain domain, final CCommand command) 37 | throws DecodingException { 38 | 39 | String semanticUriFragment = command.getProperties().get(SEMANTIC_URI_FRAGMENT); 40 | String newName = command.getProperties().get(NEW_NAME); 41 | 42 | return new SetClassNameCommand(domain, modelUri, semanticUriFragment, newName); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/SetPropertyNameCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.Command; 14 | import org.eclipse.emf.common.util.URI; 15 | import org.eclipse.emf.edit.domain.EditingDomain; 16 | import org.eclipse.emfcloud.modelserver.command.CCommand; 17 | import org.eclipse.emfcloud.modelserver.command.CCommandFactory; 18 | import org.eclipse.emfcloud.modelserver.common.codecs.DecodingException; 19 | 20 | import com.eclipsesource.uml.modelserver.commands.semantic.SetPropertyNameCommand; 21 | 22 | public class SetPropertyNameCommandContribution extends UmlSemanticCommandContribution { 23 | 24 | public static final String TYPE = "setPropertyName"; 25 | public static final String NEW_NAME = "newName"; 26 | 27 | public static CCommand create(final String semanticUri, final String newName) { 28 | CCommand setPropertyCommand = CCommandFactory.eINSTANCE.createCommand(); 29 | setPropertyCommand.setType(TYPE); 30 | setPropertyCommand.getProperties().put(SEMANTIC_URI_FRAGMENT, semanticUri); 31 | setPropertyCommand.getProperties().put(NEW_NAME, newName); 32 | return setPropertyCommand; 33 | } 34 | 35 | @Override 36 | protected Command toServer(final URI modelUri, final EditingDomain domain, final CCommand command) 37 | throws DecodingException { 38 | 39 | String semanticUriFragment = command.getProperties().get(SEMANTIC_URI_FRAGMENT); 40 | String newName = command.getProperties().get(NEW_NAME); 41 | 42 | return new SetPropertyNameCommand(domain, modelUri, semanticUriFragment, newName); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/SetPropertyTypeCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.Command; 14 | import org.eclipse.emf.common.util.URI; 15 | import org.eclipse.emf.edit.domain.EditingDomain; 16 | import org.eclipse.emfcloud.modelserver.command.CCommand; 17 | import org.eclipse.emfcloud.modelserver.command.CCommandFactory; 18 | import org.eclipse.emfcloud.modelserver.common.codecs.DecodingException; 19 | import org.eclipse.uml2.uml.Type; 20 | 21 | import com.eclipsesource.uml.modelserver.commands.semantic.SetPropertyTypeCommand; 22 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 23 | 24 | public class SetPropertyTypeCommandContribution extends UmlSemanticCommandContribution { 25 | 26 | public static final String TYPE = "setPropertyType"; 27 | public static final String NEW_TYPE = "newType"; 28 | 29 | public static CCommand create(final String semanticUri, final String newType) { 30 | CCommand setPropertyCommand = CCommandFactory.eINSTANCE.createCommand(); 31 | setPropertyCommand.setType(TYPE); 32 | setPropertyCommand.getProperties().put(SEMANTIC_URI_FRAGMENT, semanticUri); 33 | setPropertyCommand.getProperties().put(NEW_TYPE, newType); 34 | return setPropertyCommand; 35 | } 36 | 37 | @Override 38 | protected Command toServer(final URI modelUri, final EditingDomain domain, final CCommand command) 39 | throws DecodingException { 40 | 41 | String semanticUriFragment = command.getProperties().get(SEMANTIC_URI_FRAGMENT); 42 | Type newType = UmlSemanticCommandUtil.getType(domain, command.getProperties().get(NEW_TYPE)); 43 | 44 | return new SetPropertyTypeCommand(domain, modelUri, semanticUriFragment, newType); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/UmlCompoundCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.CompoundCommand; 14 | import org.eclipse.emfcloud.modelserver.edit.command.BasicCommandContribution; 15 | 16 | public abstract class UmlCompoundCommandContribution extends BasicCommandContribution { 17 | 18 | public static final String SEMANTIC_URI_FRAGMENT = "semanticUriFragment"; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/UmlNotationCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.Command; 14 | import org.eclipse.emfcloud.modelserver.edit.command.BasicCommandContribution; 15 | 16 | public abstract class UmlNotationCommandContribution extends BasicCommandContribution { 17 | 18 | public static final String SEMANTIC_PROXI_URI = "semanticProxyUri"; 19 | public static final String POSITION_X = "positionX"; 20 | public static final String POSITION_Y = "positionY"; 21 | public static final String HEIGHT = "height"; 22 | public static final String WIDTH = "weight"; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/contributions/UmlSemanticCommandContribution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.contributions; 12 | 13 | import org.eclipse.emf.common.command.Command; 14 | import org.eclipse.emfcloud.modelserver.edit.command.BasicCommandContribution; 15 | 16 | public abstract class UmlSemanticCommandContribution extends BasicCommandContribution { 17 | 18 | public static final String SEMANTIC_URI_FRAGMENT = "semanticUriFragment"; 19 | public static final String PARENT_SEMANTIC_URI_FRAGMENT = "parentSemanticUriFragment"; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/notation/ChangeBoundsCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.notation; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.glsp.graph.GDimension; 16 | import org.eclipse.glsp.graph.GPoint; 17 | 18 | import com.eclipsesource.uml.modelserver.commands.util.UmlNotationCommandUtil; 19 | import com.eclipsesource.uml.modelserver.unotation.Shape; 20 | 21 | public class ChangeBoundsCommand extends UmlNotationElementCommand { 22 | 23 | protected final GPoint shapePosition; 24 | protected final GDimension shapeSize; 25 | protected final Shape shape; 26 | 27 | public ChangeBoundsCommand(final EditingDomain domain, final URI modelUri, 28 | final String semanticProxyUri, final GPoint shapePosition, final GDimension shapeSize) { 29 | super(domain, modelUri); 30 | this.shapePosition = shapePosition; 31 | this.shapeSize = shapeSize; 32 | this.shape = UmlNotationCommandUtil.getNotationElement(modelUri, domain, semanticProxyUri, Shape.class); 33 | } 34 | 35 | @Override 36 | protected void doExecute() { 37 | shape.setPosition(shapePosition); 38 | shape.setSize(shapeSize); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/notation/ChangeRoutingPointsCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.notation; 12 | 13 | import java.util.List; 14 | 15 | import org.eclipse.emf.common.util.URI; 16 | import org.eclipse.emf.edit.domain.EditingDomain; 17 | import org.eclipse.glsp.graph.GPoint; 18 | 19 | import com.eclipsesource.uml.modelserver.commands.util.UmlNotationCommandUtil; 20 | import com.eclipsesource.uml.modelserver.unotation.Edge; 21 | 22 | public class ChangeRoutingPointsCommand extends UmlNotationElementCommand { 23 | 24 | protected final Edge edge; 25 | protected final List newRoutingPoints; 26 | 27 | public ChangeRoutingPointsCommand(final EditingDomain domain, final URI modelUri, 28 | final String semanticProxyUri, final List newRoutingPoints) { 29 | super(domain, modelUri); 30 | this.newRoutingPoints = newRoutingPoints; 31 | this.edge = UmlNotationCommandUtil.getNotationElement(modelUri, domain, semanticProxyUri, Edge.class); 32 | } 33 | 34 | @Override 35 | protected void doExecute() { 36 | edge.getBendPoints().clear(); 37 | edge.getBendPoints().addAll(newRoutingPoints); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/notation/RemoveAssociationEdgeCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.notation; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | 16 | import com.eclipsesource.uml.modelserver.commands.util.UmlNotationCommandUtil; 17 | import com.eclipsesource.uml.modelserver.unotation.Edge; 18 | 19 | public class RemoveAssociationEdgeCommand extends UmlNotationElementCommand { 20 | 21 | protected final Edge edgeToRemove; 22 | 23 | public RemoveAssociationEdgeCommand(final EditingDomain domain, final URI modelUri, final String semanticProxyUri) { 24 | super(domain, modelUri); 25 | this.edgeToRemove = UmlNotationCommandUtil.getNotationElement(modelUri, domain, semanticProxyUri, Edge.class); 26 | } 27 | 28 | @Override 29 | protected void doExecute() { 30 | umlDiagram.getElements().remove(edgeToRemove); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/notation/RemoveClassShapeCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.notation; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | 16 | import com.eclipsesource.uml.modelserver.commands.util.UmlNotationCommandUtil; 17 | import com.eclipsesource.uml.modelserver.unotation.Shape; 18 | 19 | public class RemoveClassShapeCommand extends UmlNotationElementCommand { 20 | 21 | protected final Shape shapeToRemove; 22 | 23 | public RemoveClassShapeCommand(final EditingDomain domain, final URI modelUri, final String semanticProxyUri) { 24 | super(domain, modelUri); 25 | this.shapeToRemove = UmlNotationCommandUtil.getNotationElement(modelUri, domain, semanticProxyUri, Shape.class); 26 | } 27 | 28 | @Override 29 | protected void doExecute() { 30 | umlDiagram.getElements().remove(shapeToRemove); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/notation/UmlNotationElementCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.notation; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.emf.transaction.RecordingCommand; 16 | import org.eclipse.emf.transaction.TransactionalEditingDomain; 17 | 18 | import com.eclipsesource.uml.modelserver.commands.util.UmlNotationCommandUtil; 19 | import com.eclipsesource.uml.modelserver.unotation.Diagram; 20 | 21 | public abstract class UmlNotationElementCommand extends RecordingCommand { 22 | 23 | protected final Diagram umlDiagram; 24 | 25 | public UmlNotationElementCommand(final EditingDomain domain, final URI modelUri) { 26 | super((TransactionalEditingDomain) domain); 27 | this.umlDiagram = UmlNotationCommandUtil.getDiagram(modelUri, domain); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/AddAssociationCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Association; 16 | import org.eclipse.uml2.uml.Class; 17 | import org.eclipse.uml2.uml.UMLFactory; 18 | 19 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 20 | 21 | public class AddAssociationCommand extends UmlSemanticElementCommand { 22 | 23 | private final Association newAssociation; 24 | protected final Class sourceClass; 25 | protected final Class targetClass; 26 | 27 | public AddAssociationCommand(final EditingDomain domain, final URI modelUri, 28 | final String sourceClassUriFragment, final String targetClassUriFragment) { 29 | super(domain, modelUri); 30 | this.newAssociation = UMLFactory.eINSTANCE.createAssociation(); 31 | this.sourceClass = UmlSemanticCommandUtil.getElement(umlModel, sourceClassUriFragment, Class.class); 32 | this.targetClass = UmlSemanticCommandUtil.getElement(umlModel, targetClassUriFragment, Class.class); 33 | } 34 | 35 | @Override 36 | protected void doExecute() { 37 | getNewAssociation().createOwnedEnd(UmlSemanticCommandUtil.getNewAssociationEndName(sourceClass), sourceClass); 38 | getNewAssociation().createOwnedEnd(UmlSemanticCommandUtil.getNewAssociationEndName(targetClass), targetClass); 39 | umlModel.getPackagedElements().add(getNewAssociation()); 40 | } 41 | 42 | public Association getNewAssociation() { return newAssociation; } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/AddClassCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Class; 16 | import org.eclipse.uml2.uml.UMLFactory; 17 | 18 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 19 | 20 | public class AddClassCommand extends UmlSemanticElementCommand { 21 | 22 | protected final Class newClass; 23 | 24 | public AddClassCommand(final EditingDomain domain, final URI modelUri) { 25 | super(domain, modelUri); 26 | this.newClass = UMLFactory.eINSTANCE.createClass(); 27 | } 28 | 29 | @Override 30 | protected void doExecute() { 31 | newClass.setName(UmlSemanticCommandUtil.getNewClassName(umlModel)); 32 | umlModel.getPackagedElements().add(newClass); 33 | } 34 | 35 | public Class getNewClass() { return newClass; } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/AddPropertyCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021-2022 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Class; 16 | import org.eclipse.uml2.uml.Property; 17 | import org.eclipse.uml2.uml.Type; 18 | import org.eclipse.uml2.uml.UMLFactory; 19 | 20 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 21 | 22 | public class AddPropertyCommand extends UmlSemanticElementCommand { 23 | 24 | protected final String parentSemanticUriFragment; 25 | protected final Type defaultType; 26 | 27 | public AddPropertyCommand(final EditingDomain domain, final URI modelUri, final String parentSemanticUriFragment) { 28 | super(domain, modelUri); 29 | this.parentSemanticUriFragment = parentSemanticUriFragment; 30 | this.defaultType = UmlSemanticCommandUtil.getType(domain, "String"); 31 | } 32 | 33 | @Override 34 | protected void doExecute() { 35 | Class parentClass = UmlSemanticCommandUtil.getElement(umlModel, parentSemanticUriFragment, Class.class); 36 | Property newProperty = UMLFactory.eINSTANCE.createProperty(); 37 | newProperty.setName(UmlSemanticCommandUtil.getNewPropertyName(parentClass)); 38 | newProperty.setType(defaultType); 39 | parentClass.getOwnedAttributes().add(newProperty); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/RemoveAssociationCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Association; 16 | 17 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 18 | 19 | public class RemoveAssociationCommand extends UmlSemanticElementCommand { 20 | 21 | protected final String semanticUriFragment; 22 | 23 | public RemoveAssociationCommand(final EditingDomain domain, final URI modelUri, 24 | final String semanticUriFragment) { 25 | super(domain, modelUri); 26 | this.semanticUriFragment = semanticUriFragment; 27 | } 28 | 29 | @Override 30 | protected void doExecute() { 31 | Association associationToRemove = UmlSemanticCommandUtil.getElement(umlModel, semanticUriFragment, 32 | Association.class); 33 | umlModel.getPackagedElements().remove(associationToRemove); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/RemoveClassCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Class; 16 | 17 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 18 | 19 | public class RemoveClassCommand extends UmlSemanticElementCommand { 20 | 21 | protected final String semanticUriFragment; 22 | 23 | public RemoveClassCommand(final EditingDomain domain, final URI modelUri, final String semanticUriFragment) { 24 | super(domain, modelUri); 25 | this.semanticUriFragment = semanticUriFragment; 26 | } 27 | 28 | @Override 29 | protected void doExecute() { 30 | Class classToRemove = UmlSemanticCommandUtil.getElement(umlModel, semanticUriFragment, Class.class); 31 | umlModel.getPackagedElements().remove(classToRemove); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/RemovePropertyCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Class; 16 | import org.eclipse.uml2.uml.Property; 17 | 18 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 19 | 20 | public class RemovePropertyCommand extends UmlSemanticElementCommand { 21 | 22 | protected final String parentSemanticUriFragment; 23 | protected final String semanticUriFragment; 24 | 25 | public RemovePropertyCommand(final EditingDomain domain, final URI modelUri, final String parentSemanticUriFragment, 26 | final String semanticUriFragment) { 27 | super(domain, modelUri); 28 | this.parentSemanticUriFragment = parentSemanticUriFragment; 29 | this.semanticUriFragment = semanticUriFragment; 30 | } 31 | 32 | @Override 33 | protected void doExecute() { 34 | Class parentClass = UmlSemanticCommandUtil.getElement(umlModel, parentSemanticUriFragment, Class.class); 35 | Property propertyToRemove = UmlSemanticCommandUtil.getElement(umlModel, semanticUriFragment, Property.class); 36 | parentClass.getOwnedAttributes().remove(propertyToRemove); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/SetAssociationEndMultiplicityCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Property; 16 | 17 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 18 | 19 | public class SetAssociationEndMultiplicityCommand extends UmlSemanticElementCommand { 20 | 21 | protected String semanticUriFragment; 22 | protected int newLowerBound; 23 | protected int newUpperBound; 24 | 25 | public SetAssociationEndMultiplicityCommand(final EditingDomain domain, final URI modelUri, 26 | final String semanticUriFragment, final int newLowerBound, final int newUpperBound) { 27 | super(domain, modelUri); 28 | this.semanticUriFragment = semanticUriFragment; 29 | this.newLowerBound = newLowerBound; 30 | this.newUpperBound = newUpperBound; 31 | } 32 | 33 | @Override 34 | protected void doExecute() { 35 | Property property = UmlSemanticCommandUtil.getElement(umlModel, semanticUriFragment, Property.class); 36 | property.setLower(newLowerBound); 37 | property.setUpper(newUpperBound); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/SetAssociationEndNameCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Property; 16 | 17 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 18 | 19 | public class SetAssociationEndNameCommand extends UmlSemanticElementCommand { 20 | 21 | protected String semanticUriFragment; 22 | protected String newName; 23 | 24 | public SetAssociationEndNameCommand(final EditingDomain domain, final URI modelUri, final String semanticUriFragment, 25 | final String newName) { 26 | super(domain, modelUri); 27 | this.semanticUriFragment = semanticUriFragment; 28 | this.newName = newName; 29 | } 30 | 31 | @Override 32 | protected void doExecute() { 33 | Property property = UmlSemanticCommandUtil.getElement(umlModel, semanticUriFragment, Property.class); 34 | property.setName(newName); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/SetClassNameCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Class; 16 | 17 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 18 | 19 | public class SetClassNameCommand extends UmlSemanticElementCommand { 20 | 21 | protected String semanticUriFragment; 22 | protected String newName; 23 | 24 | public SetClassNameCommand(final EditingDomain domain, final URI modelUri, final String semanticUriFragment, 25 | final String newName) { 26 | super(domain, modelUri); 27 | this.semanticUriFragment = semanticUriFragment; 28 | this.newName = newName; 29 | } 30 | 31 | @Override 32 | protected void doExecute() { 33 | Class classToRename = UmlSemanticCommandUtil.getElement(umlModel, semanticUriFragment, Class.class); 34 | classToRename.setName(newName); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/SetPropertyBoundsCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Property; 16 | 17 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 18 | 19 | public class SetPropertyBoundsCommand extends UmlSemanticElementCommand { 20 | 21 | protected String semanticUriFragment; 22 | protected int newLowerBound; 23 | protected int newUpperBound; 24 | 25 | public SetPropertyBoundsCommand(final EditingDomain domain, final URI modelUri, final String semanticUriFragment, 26 | final int newLowerBound, final int newUpperBound) { 27 | super(domain, modelUri); 28 | this.semanticUriFragment = semanticUriFragment; 29 | this.newLowerBound = newLowerBound; 30 | this.newUpperBound = newUpperBound; 31 | } 32 | 33 | @Override 34 | protected void doExecute() { 35 | Property property = UmlSemanticCommandUtil.getElement(umlModel, semanticUriFragment, Property.class); 36 | property.setLower(newLowerBound); 37 | property.setUpper(newUpperBound); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/SetPropertyNameCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Property; 16 | 17 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 18 | 19 | public class SetPropertyNameCommand extends UmlSemanticElementCommand { 20 | 21 | protected String semanticUriFragment; 22 | protected String newName; 23 | 24 | public SetPropertyNameCommand(final EditingDomain domain, final URI modelUri, final String semanticUriFragment, 25 | final String newName) { 26 | super(domain, modelUri); 27 | this.semanticUriFragment = semanticUriFragment; 28 | this.newName = newName; 29 | } 30 | 31 | @Override 32 | protected void doExecute() { 33 | Property property = UmlSemanticCommandUtil.getElement(umlModel, semanticUriFragment, Property.class); 34 | property.setName(newName); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/SetPropertyTypeCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.uml2.uml.Property; 16 | import org.eclipse.uml2.uml.Type; 17 | 18 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 19 | 20 | public class SetPropertyTypeCommand extends UmlSemanticElementCommand { 21 | 22 | protected String semanticUriFragment; 23 | protected Type newType; 24 | 25 | public SetPropertyTypeCommand(final EditingDomain domain, final URI modelUri, final String semanticUriFragment, 26 | final Type newType) { 27 | super(domain, modelUri); 28 | this.semanticUriFragment = semanticUriFragment; 29 | this.newType = newType; 30 | } 31 | 32 | @Override 33 | protected void doExecute() { 34 | Property property = UmlSemanticCommandUtil.getElement(umlModel, semanticUriFragment, Property.class); 35 | property.setType(newType); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /server/com.eclipsesource.uml.modelserver/src/main/java/com/eclipsesource/uml/modelserver/commands/semantic/UmlSemanticElementCommand.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | * Copyright (c) 2021 EclipseSource and others. 3 | * 4 | * This program and the accompanying materials are made available under the 5 | * terms of the Eclipse Public License v. 2.0 which is available at 6 | * https://www.eclipse.org/legal/epl-2.0, or the MIT License which is 7 | * available at https://opensource.org/licenses/MIT. 8 | * 9 | * SPDX-License-Identifier: EPL-2.0 OR MIT 10 | ********************************************************************************/ 11 | package com.eclipsesource.uml.modelserver.commands.semantic; 12 | 13 | import org.eclipse.emf.common.util.URI; 14 | import org.eclipse.emf.edit.domain.EditingDomain; 15 | import org.eclipse.emf.transaction.RecordingCommand; 16 | import org.eclipse.emf.transaction.TransactionalEditingDomain; 17 | import org.eclipse.uml2.uml.Model; 18 | 19 | import com.eclipsesource.uml.modelserver.commands.util.UmlSemanticCommandUtil; 20 | 21 | public abstract class UmlSemanticElementCommand extends RecordingCommand { 22 | 23 | protected final Model umlModel; 24 | 25 | public UmlSemanticElementCommand(final EditingDomain domain, final URI modelUri) { 26 | super((TransactionalEditingDomain) domain); 27 | this.umlModel = UmlSemanticCommandUtil.getModel(modelUri, domain); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /server/targetplatform/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | targetplatform 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.xtext.ui.shared.xtextBuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.xtext.ui.shared.xtextNature 22 | 23 | 24 | -------------------------------------------------------------------------------- /server/targetplatform/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /server/targetplatform/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /server/targetplatform/pom.xml: -------------------------------------------------------------------------------- 1 | 4 | 4.0.0 5 | 6 | 7 | com.eclipsesource.uml 8 | com.eclipsesource.uml.parent 9 | 0.1.0 10 | 11 | 12 | targetplatform 13 | pom 14 | 15 | 16 | --------------------------------------------------------------------------------