Skip to content

Commit

Permalink
first draft version
Browse files Browse the repository at this point in the history
Issue #269
  • Loading branch information
rsoika committed Jul 23, 2023
1 parent 0280a00 commit 1338aa5
Show file tree
Hide file tree
Showing 38 changed files with 941 additions and 992 deletions.
127 changes: 127 additions & 0 deletions open-bpmn.glsp-client/open-bpmn-app/gen-webpack.node.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/**
* Don't touch this file. It will be regenerated by theia build.
* To customize webpack configuration change /home/rsoika/git/open-bpmn/open-bpmn.glsp-client/open-bpmn-app/webpack.config.js
*/
// @ts-check
const path = require('path');
const yargs = require('yargs');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const NativeWebpackPlugin = require('@theia/native-webpack-plugin');

const { mode } = yargs.option('mode', {
description: "Mode to use",
choices: ["development", "production"],
default: "production"
}).argv;

const production = mode === 'production';

/** @type {import('webpack').EntryObject} */
const commonJsLibraries = {};
for (const [entryPointName, entryPointPath] of Object.entries({

'nsfw-watcher': '@theia/filesystem/lib/node/nsfw-watcher',

})) {
commonJsLibraries[entryPointName] = {
import: require.resolve(entryPointPath),
library: {
type: 'commonjs2',
},
};
}

const ignoredResources = new Set();

if (process.platform !== 'win32') {
ignoredResources.add('@vscode/windows-ca-certs');
}

const nativePlugin = new NativeWebpackPlugin({
out: 'native',
ripgrep: false,
pty: true,
nativeBindings: {
drivelist: 'drivelist/build/Release/drivelist.node'
}
});

/** @type {import('webpack').Configuration} */
const config = {
mode,
devtool: mode === 'development' ? 'source-map' : false,
target: 'node',
node: {
global: false,
__filename: false,
__dirname: false
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'lib', 'backend'),
devtoolModuleFilenameTemplate: 'webpack:///[absolute-resource-path]?[loaders]',
},
entry: {
// Main entry point of the Theia application backend:
'main': require.resolve('./src-gen/backend/main'),
// Theia's IPC mechanism:
'ipc-bootstrap': require.resolve('@theia/core/lib/node/messaging/ipc-bootstrap'),

// Make sure the node-pty thread worker can be executed:
'worker/conoutSocketWorker': require.resolve('node-pty/lib/worker/conoutSocketWorker'),


...commonJsLibraries
},
module: {
rules: [
// Make sure we can still find and load our native addons.
{
test: /\.node$/,
loader: 'node-loader',
options: {
name: 'native/[name].[ext]'
}
},
{
test: /\.js$/,
enforce: 'pre',
loader: 'source-map-loader'
},
// jsonc-parser exposes its UMD implementation by default, which
// confuses Webpack leading to missing js in the bundles.
{
test: /node_modules[\/](jsonc-parser)/,
loader: 'umd-compat-loader'
}
]
},
plugins: [
// Some native dependencies (bindings, @vscode/ripgrep) need special code replacements
nativePlugin,
// Optional node dependencies can be safely ignored
new webpack.IgnorePlugin({
checkResource: resource => ignoredResources.has(resource)
})
],
optimization: {
// Split and reuse code across the various entry points
splitChunks: {
chunks: 'all'
},
// Only minimize if we run webpack in production mode
minimize: production,
minimizer: [
new TerserPlugin({
exclude: /^(lib|builtins)\//
})
]
},
};

module.exports = {
config,
nativePlugin,
ignoredResources
};
24 changes: 12 additions & 12 deletions open-bpmn.glsp-client/open-bpmn-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
"license": "(GPL-3.0)",
"dependencies": {
"@open-bpmn/open-bpmn-theia": "1.0.3",
"@theia/core": "1.34.0",
"@theia/editor": "1.34.0",
"@theia/filesystem": "1.34.0",
"@theia/markers": "1.34.0",
"@theia/messages": "1.34.0",
"@theia/monaco": "1.34.0",
"@theia/navigator": "1.34.0",
"@theia/preferences": "1.34.0",
"@theia/process": "1.34.0",
"@theia/terminal": "1.34.0",
"@theia/workspace": "1.34.0",
"@theia/core": "1.39.0-next.20",
"@theia/editor": "1.39.0-next.20",
"@theia/filesystem": "1.39.0-next.20",
"@theia/markers": "1.39.0-next.20",
"@theia/messages": "1.39.0-next.20",
"@theia/monaco": "1.39.0-next.20",
"@theia/navigator": "1.39.0-next.20",
"@theia/preferences": "1.39.0-next.20",
"@theia/process": "1.39.0-next.20",
"@theia/terminal": "1.39.0-next.20",
"@theia/workspace": "1.39.0-next.20",
"sprotty-theia": "0.13.0-next.9cbedec"
},
"devDependencies": {
"@theia/cli": "1.34.0"
"@theia/cli": "1.39.0-next.20"
},
"scripts": {
"build": "theia build --mode development",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ serverAddress.then(({ port, address }) => {
}
});

module.exports = serverAddress;
globalThis.serverAddress = serverAddress;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ container.load(messagingBackendModule);
container.load(loggerBackendModule);

function defaultServeStatic(app) {
app.use(express.static(path.resolve(__dirname, '../../lib')))
app.use(express.static(path.resolve(__dirname, '../../lib/frontend')))
}

function load(raw) {
Expand Down
11 changes: 5 additions & 6 deletions open-bpmn.glsp-client/open-bpmn-app/src-gen/frontend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ FrontendApplicationConfigProvider.set({
"light": "light",
"dark": "dark"
},
"defaultIconTheme": "none",
"defaultIconTheme": "theia-file-icons",
"electron": {
"windowOptions": {}
},
Expand All @@ -26,7 +26,6 @@ self.MonacoEnvironment = {
}
}


const preloader = require('@theia/core/lib/browser/preloader');

// We need to fetch some data from the backend before the frontend starts (nls, os)
Expand All @@ -47,24 +46,24 @@ module.exports = preloader.preload().then(() => {
.then(function () { return import('@theia/core/lib/browser/window/browser-window-module').then(load) })
.then(function () { return import('@theia/core/lib/browser/keyboard/browser-keyboard-module').then(load) })
.then(function () { return import('@theia/core/lib/browser/request/browser-request-module').then(load) })
.then(function () { return import('@theia/messages/lib/browser/messages-frontend-module').then(load) })
.then(function () { return import('@theia/variable-resolver/lib/browser/variable-resolver-frontend-module').then(load) })
.then(function () { return import('@theia/editor/lib/browser/editor-frontend-module').then(load) })
.then(function () { return import('@theia/filesystem/lib/browser/filesystem-frontend-module').then(load) })
.then(function () { return import('@theia/filesystem/lib/browser/download/file-download-frontend-module').then(load) })
.then(function () { return import('@theia/filesystem/lib/browser/file-dialog/file-dialog-module').then(load) })
.then(function () { return import('@theia/messages/lib/browser/messages-frontend-module').then(load) })
.then(function () { return import('@theia/variable-resolver/lib/browser/variable-resolver-frontend-module').then(load) })
.then(function () { return import('@theia/editor/lib/browser/editor-frontend-module').then(load) })
.then(function () { return import('@theia/workspace/lib/browser/workspace-frontend-module').then(load) })
.then(function () { return import('@theia/markers/lib/browser/problem/problem-frontend-module').then(load) })
.then(function () { return import('@theia/outline-view/lib/browser/outline-view-frontend-module').then(load) })
.then(function () { return import('@theia/monaco/lib/browser/monaco-frontend-module').then(load) })
.then(function () { return import('sprotty-theia/lib/theia/diagram-module').then(load) })
.then(function () { return import('@eclipse-glsp/theia-integration/lib/browser/theia-integration-frontend-module').then(load) })
.then(function () { return import('@open-bpmn/open-bpmn-theia/lib/browser/bpmn-frontend-module').then(load) })
.then(function () { return import('@theia/navigator/lib/browser/navigator-frontend-module').then(load) })
.then(function () { return import('@theia/userstorage/lib/browser/user-storage-frontend-module').then(load) })
.then(function () { return import('@theia/preferences/lib/browser/preference-frontend-module').then(load) })
.then(function () { return import('@theia/process/lib/common/process-common-module').then(load) })
.then(function () { return import('@theia/terminal/lib/browser/terminal-frontend-module').then(load) })
.then(function () { return import('sprotty-theia/lib/theia/diagram-module').then(load) })
.then(start).catch(reason => {
console.error('Failed to start the frontend application.');
if (reason) {
Expand Down
2 changes: 1 addition & 1 deletion open-bpmn.glsp-client/open-bpmn-glsp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
],
"dependencies": {
"@eclipse-glsp/client": "1.1.0-RC04",
"@eclipse-glsp/client": "1.1.0-RC10",
"@open-bpmn/open-bpmn-model": "1.0.3",
"@open-bpmn/open-bpmn-properties": "1.0.3",
"balloon-css": "^0.5.0"
Expand Down
10 changes: 5 additions & 5 deletions open-bpmn.glsp-client/open-bpmn-glsp/src/bpmn-helperlines.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { EventNode, isBoundaryEvent, isBPMNLabelNode, isBPMNNode, isTaskNode, LabelNode, TaskNode } from '@open-bpmn/open-bpmn-model';
import { inject, injectable } from 'inversify';
import { VNode } from 'snabbdom';
import { CommandExecutionContext, CommandReturn, IView, RenderingContext, SChildElement, svg, TYPES } from 'sprotty';
import { CommandExecutionContext, CommandReturn, IView, RenderingContext, SChildElementImpl, svg, TYPES } from 'sprotty';
import { Bounds, Point } from 'sprotty-protocol';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const JSX = { createElement: svg };
Expand All @@ -43,7 +43,7 @@ const JSX = { createElement: svg };
* The HelperLinesElement defines the SModelElement
* to containing a list of helperLines.
*/
export class HelperLinesElement extends SChildElement {
export class HelperLinesElement extends SChildElementImpl {
override type: string;
override id: string;
readonly helperLines: ReadonlyArray<HelperLine> = [];
Expand Down Expand Up @@ -186,7 +186,7 @@ export class BPMNElementSnapper implements ISnapper {

if (isBoundsAware(modelElement)) {
// we need to find out if we are in a container....
if (modelElement instanceof SChildElement) {
if (modelElement instanceof SChildElementImpl) {
childs=modelElement.parent.children;
}

Expand Down Expand Up @@ -299,7 +299,7 @@ export class HelperLineListener extends MouseListener {
const boundsAware = findParentByFeature(element, isBoundsAware);
if (boundsAware !== undefined) {
let current: SModelElement = boundsAware;
while (current instanceof SChildElement) {
while (current instanceof SChildElementImpl) {
const parent = current.parent;
if ('pool' === parent.type) {
return parent;
Expand Down Expand Up @@ -479,7 +479,7 @@ export class RemoveHelperLinesCommand extends FeedbackCommand {
*/
export function removeHelperLines(root: SModelRoot): void {
const helperLines = root.index.getById(helpLineId(root));
if (helperLines instanceof SChildElement) {
if (helperLines instanceof SChildElementImpl) {
root.remove(helperLines);
}
}
Expand Down
42 changes: 34 additions & 8 deletions open-bpmn.glsp-client/open-bpmn-glsp/src/di.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,23 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import {
boundsFeature, CircularNodeView, configureCommand,
configureDefaultModelElements, configureModelElement, configureView, ConsoleLogger,
createDiagramContainer,
CircularNodeView,
ConsoleLogger,
ContainerConfiguration,
DeleteElementContextMenuItemProvider,
DiamondNodeView, editLabelFeature, ForeignObjectView, LogLevel, moveFeature, overrideViewerOptions,
DiamondNodeView,
ForeignObjectView, LogLevel,
RectangularNodeView,
RoundedCornerNodeView, SCompartment,
SCompartmentView, selectFeature, SLabel, SLabelView, TYPES
SCompartmentView,
SLabel, SLabelView, TYPES,
boundsFeature,
configureCommand,
configureDefaultModelElements, configureModelElement, configureView,
editLabelFeature,
initializeDiagramContainer,
moveFeature, overrideViewerOptions,
selectFeature
} from '@eclipse-glsp/client';
import {
BPMNEdge,
Expand Down Expand Up @@ -129,9 +138,26 @@ const bpmnDiagramModule = new ContainerModule((bind, unbind, isBound, rebind) =>
/*
* Create the createClientContainer with the diagramModule and the BPMN bpmnPropertyModule...
*/
export default function createBPMNDiagramContainer(widgetId: string): Container {
// Note: the widgetId is generated by the GLSP core and is something like 'bpmn-diagram_0'
const container = createDiagramContainer(bpmnDiagramModule, BPMNPropertyModule);
// export default function createBPMNDiagramContainer(widgetId: string): Container {
// // Note: the widgetId is generated by the GLSP core and is something like 'bpmn-diagram_0'
// const container = createDiagramContainer(bpmnDiagramModule, BPMNPropertyModule);
// overrideViewerOptions(container, {
// baseDiv: widgetId,
// hiddenDiv: widgetId + '_hidden'
// });
// return container;
// }

export function createBPMNDiagramContainer(widgetId: string, ...containerConfiguration: ContainerConfiguration): Container {
return initializeBPMNDiagramContainer(new Container(), widgetId, ...containerConfiguration);
}

export function initializeBPMNDiagramContainer(
container: Container,
widgetId: string,
...containerConfiguration: ContainerConfiguration
): Container {
initializeDiagramContainer(container, bpmnDiagramModule, BPMNPropertyModule, ...containerConfiguration);
overrideViewerOptions(container, {
baseDiv: widgetId,
hiddenDiv: widgetId + '_hidden'
Expand Down
5 changes: 3 additions & 2 deletions open-bpmn.glsp-client/open-bpmn-glsp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import createBPMNDiagramContainer from './di.config';
// import createBPMNDiagramContainer from './di.config';

export * from './bpmn-element-views';
export * from './bpmn-routing-views';
export { createBPMNDiagramContainer };
// export { createBPMNDiagramContainer };
export * from './di.config';

2 changes: 1 addition & 1 deletion open-bpmn.glsp-client/open-bpmn-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"watch": "tsc -w"
},
"dependencies": {
"@eclipse-glsp/client": "1.1.0-RC04"
"@eclipse-glsp/client": "1.1.0-RC10"
},
"files": [
"lib",
Expand Down
2 changes: 1 addition & 1 deletion open-bpmn.glsp-client/open-bpmn-properties/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "GLSP property panel for BPMN 2.0",
"license": "(GPL-3.0)",
"dependencies": {
"@eclipse-glsp/client": "1.1.0-RC04",
"@eclipse-glsp/client": "1.1.0-RC10",
"@open-bpmn/open-bpmn-model": "1.0.3",
"@jsonforms/core": "3.0.0",
"@jsonforms/react": "3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
********************************************************************************/
import {
EditorContextService, EnableToolPaletteAction,
GLSPActionDispatcher, hasArguments
GLSPActionDispatcher, hasArguments,
SModelElement,
SModelRoot
} from '@eclipse-glsp/client';
import { Action, RequestContextActions, SetContextActions } from '@eclipse-glsp/protocol';
import {
Expand All @@ -24,8 +26,6 @@ import {
EnableToolsAction,
IActionHandler,
ICommand,
SModelElement,
SModelRoot,
SetUIExtensionVisibilityAction,
TYPES
} from 'sprotty';
Expand Down
2 changes: 1 addition & 1 deletion open-bpmn.glsp-client/open-bpmn-theia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"dependencies": {
"@open-bpmn/open-bpmn-glsp": "1.0.3",
"@eclipse-glsp/theia-integration": "1.1.0-RC04"
"@eclipse-glsp/theia-integration": "1.1.0-RC10"
},
"scripts": {
"prepare": "yarn run clean && yarn run build",
Expand Down
Loading

0 comments on commit 1338aa5

Please sign in to comment.