@eclipse-glsp/client 1.1.0-next.5a004c2.229 → 1.1.0-next.6c2f3cc.244
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{lib/features/change-bounds/snap.spec.d.ts → css/autocomplete-palette.css} +8 -3
- package/css/decoration.css +1 -1
- package/css/glsp-sprotty.css +16 -1
- package/lib/base/auto-complete/auto-complete-widget.d.ts +10 -4
- package/lib/base/auto-complete/auto-complete-widget.d.ts.map +1 -1
- package/lib/base/auto-complete/auto-complete-widget.js +28 -9
- package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
- package/lib/base/command-stack.d.ts +1 -2
- package/lib/base/command-stack.d.ts.map +1 -1
- package/lib/base/command-stack.js +5 -14
- package/lib/base/command-stack.js.map +1 -1
- package/lib/base/container-modules.d.ts +8 -16
- package/lib/base/container-modules.d.ts.map +1 -1
- package/lib/base/container-modules.js +52 -66
- package/lib/base/container-modules.js.map +1 -1
- package/lib/base/di.config.d.ts +1 -1
- package/lib/base/di.config.d.ts.map +1 -1
- package/lib/base/di.config.js +7 -7
- package/lib/base/di.config.js.map +1 -1
- package/lib/base/editor-context-service.d.ts +3 -3
- package/lib/base/editor-context-service.d.ts.map +1 -1
- package/lib/base/editor-context-service.js +3 -3
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.d.ts +4 -5
- package/lib/base/tool-manager/glsp-tool-manager.d.ts.map +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.js +15 -8
- package/lib/base/tool-manager/glsp-tool-manager.js.map +1 -1
- package/lib/features/accessibility/di.config.d.ts +21 -0
- package/lib/features/accessibility/di.config.d.ts.map +1 -0
- package/lib/features/accessibility/di.config.js +28 -0
- package/lib/features/accessibility/di.config.js.map +1 -0
- package/lib/features/accessibility/search/di.config.d.ts +20 -0
- package/lib/features/accessibility/search/di.config.d.ts.map +1 -0
- package/lib/features/accessibility/search/di.config.js +33 -0
- package/lib/features/accessibility/search/di.config.js.map +1 -0
- package/lib/features/accessibility/search/search-palette.d.ts +47 -0
- package/lib/features/accessibility/search/search-palette.d.ts.map +1 -0
- package/lib/features/accessibility/search/search-palette.js +155 -0
- package/lib/features/accessibility/search/search-palette.js.map +1 -0
- package/lib/features/accessibility/search/search-tool.d.ts +30 -0
- package/lib/features/accessibility/search/search-tool.d.ts.map +1 -0
- package/lib/features/accessibility/search/search-tool.js +73 -0
- package/lib/features/accessibility/search/search-tool.js.map +1 -0
- package/lib/features/autocomplete-palette/autocomplete-suggestion-providers.d.ts +35 -0
- package/lib/features/autocomplete-palette/autocomplete-suggestion-providers.d.ts.map +1 -0
- package/lib/features/{tools/marquee-behavior.spec.d.ts → autocomplete-palette/autocomplete-suggestion-providers.js} +4 -3
- package/lib/features/autocomplete-palette/autocomplete-suggestion-providers.js.map +1 -0
- package/lib/features/autocomplete-palette/base-autocomplete-palette.d.ts +41 -0
- package/lib/features/autocomplete-palette/base-autocomplete-palette.d.ts.map +1 -0
- package/lib/features/autocomplete-palette/base-autocomplete-palette.js +82 -0
- package/lib/features/autocomplete-palette/base-autocomplete-palette.js.map +1 -0
- package/lib/features/bounds/di.config.d.ts +0 -16
- package/lib/features/bounds/di.config.d.ts.map +1 -1
- package/lib/features/bounds/di.config.js +12 -9
- package/lib/features/bounds/di.config.js.map +1 -1
- package/lib/features/{layout → bounds}/freeform-layout.d.ts +2 -2
- package/lib/features/{layout → bounds}/freeform-layout.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/freeform-layout.js +2 -2
- package/lib/features/{layout → bounds}/freeform-layout.js.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.js +3 -2
- package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.d.ts +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.js +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.js.map +1 -1
- package/lib/features/{layout → bounds}/layouter.d.ts +1 -1
- package/lib/features/{layout → bounds}/layouter.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/layouter.js +1 -1
- package/lib/features/{layout → bounds}/layouter.js.map +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.d.ts +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.js +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.js.map +1 -1
- package/lib/features/command-palette/command-palette-tool.d.ts +1 -1
- package/lib/features/command-palette/command-palette-tool.d.ts.map +1 -1
- package/lib/features/command-palette/command-palette-tool.js +3 -3
- package/lib/features/command-palette/command-palette-tool.js.map +1 -1
- package/lib/features/command-palette/di.config.d.ts +0 -15
- package/lib/features/command-palette/di.config.d.ts.map +1 -1
- package/lib/features/command-palette/di.config.js +6 -7
- package/lib/features/command-palette/di.config.js.map +1 -1
- package/lib/features/context-menu/di.config.d.ts +0 -15
- package/lib/features/context-menu/di.config.d.ts.map +1 -1
- package/lib/features/context-menu/di.config.js +4 -3
- package/lib/features/context-menu/di.config.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.d.ts +2 -2
- package/lib/features/copy-paste/copy-paste-handler.d.ts.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.js +5 -5
- package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
- package/lib/features/decoration/di.config.d.ts +0 -15
- package/lib/features/decoration/di.config.d.ts.map +1 -1
- package/lib/features/decoration/di.config.js +4 -4
- package/lib/features/decoration/di.config.js.map +1 -1
- package/lib/features/edit-label/di.config.d.ts +0 -15
- package/lib/features/edit-label/di.config.d.ts.map +1 -1
- package/lib/features/edit-label/di.config.js +3 -2
- package/lib/features/edit-label/di.config.js.map +1 -1
- package/lib/features/export/di.config.d.ts +0 -15
- package/lib/features/export/di.config.d.ts.map +1 -1
- package/lib/features/export/di.config.js +6 -5
- package/lib/features/export/di.config.js.map +1 -1
- package/lib/features/export/glsp-svg-exporter.d.ts +1 -1
- package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -1
- package/lib/features/export/glsp-svg-exporter.js +1 -2
- package/lib/features/export/glsp-svg-exporter.js.map +1 -1
- package/lib/features/hover/di.config.d.ts +0 -15
- package/lib/features/hover/di.config.d.ts.map +1 -1
- package/lib/features/hover/di.config.js +7 -7
- package/lib/features/hover/di.config.js.map +1 -1
- package/lib/features/layout/di.config.d.ts +1 -1
- package/lib/features/layout/di.config.d.ts.map +1 -1
- package/lib/features/layout/di.config.js +1 -9
- package/lib/features/layout/di.config.js.map +1 -1
- package/lib/features/navigation/di.config.d.ts +2 -1
- package/lib/features/navigation/di.config.d.ts.map +1 -1
- package/lib/features/navigation/di.config.js +3 -3
- package/lib/features/navigation/di.config.js.map +1 -1
- package/lib/features/navigation/navigation-action-handler.d.ts +2 -2
- package/lib/features/navigation/navigation-action-handler.js +2 -2
- package/lib/features/save/di.config.d.ts +0 -15
- package/lib/features/save/di.config.d.ts.map +1 -1
- package/lib/features/save/di.config.js +3 -2
- package/lib/features/save/di.config.js.map +1 -1
- package/lib/features/select/di.config.d.ts +0 -15
- package/lib/features/select/di.config.d.ts.map +1 -1
- package/lib/features/select/di.config.js +8 -7
- package/lib/features/select/di.config.js.map +1 -1
- package/lib/features/svg-metadata/di.config.d.ts +19 -0
- package/lib/features/svg-metadata/di.config.d.ts.map +1 -0
- package/lib/features/svg-metadata/di.config.js +26 -0
- package/lib/features/svg-metadata/di.config.js.map +1 -0
- package/lib/features/svg-metadata/metadata-placer.d.ts +24 -0
- package/lib/features/svg-metadata/metadata-placer.d.ts.map +1 -0
- package/lib/features/svg-metadata/metadata-placer.js +63 -0
- package/lib/features/svg-metadata/metadata-placer.js.map +1 -0
- package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts +2 -2
- package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js +3 -3
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.js +1 -1
- package/lib/features/tool-feedback/di.config.d.ts +0 -15
- package/lib/features/tool-feedback/di.config.d.ts.map +1 -1
- package/lib/features/tool-feedback/di.config.js +20 -18
- package/lib/features/tool-feedback/di.config.js.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js +1 -1
- package/lib/features/tool-palette/di.config.d.ts +0 -15
- package/lib/features/tool-palette/di.config.d.ts.map +1 -1
- package/lib/features/tool-palette/di.config.js +4 -4
- package/lib/features/tool-palette/di.config.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette.js +2 -2
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/change-bounds-tool.d.ts +1 -1
- package/lib/features/tools/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds-tool.js +6 -6
- package/lib/features/tools/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/di.config.d.ts +18 -5
- package/lib/features/tools/di.config.d.ts.map +1 -1
- package/lib/features/tools/di.config.js +14 -15
- package/lib/features/tools/di.config.js.map +1 -1
- package/lib/features/tools/glsp-manhattan-edge-router.d.ts +2 -2
- package/lib/features/tools/glsp-manhattan-edge-router.d.ts.map +1 -1
- package/lib/features/tools/glsp-manhattan-edge-router.js +4 -4
- package/lib/features/tools/glsp-manhattan-edge-router.js.map +1 -1
- package/lib/features/validation/di.config.js +4 -4
- package/lib/features/validation/di.config.js.map +1 -1
- package/lib/features/validation/validate.d.ts +6 -6
- package/lib/features/validation/validate.d.ts.map +1 -1
- package/lib/features/validation/validate.js +18 -17
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/features/viewport/di.config.d.ts +0 -15
- package/lib/features/viewport/di.config.d.ts.map +1 -1
- package/lib/features/viewport/di.config.js +12 -11
- package/lib/features/viewport/di.config.js.map +1 -1
- package/lib/index.d.ts +30 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +79 -43
- package/lib/index.js.map +1 -1
- package/lib/sprotty-reexport.d.ts +2 -2
- package/lib/sprotty-reexport.d.ts.map +1 -1
- package/lib/sprotty-reexport.js +4 -4
- package/lib/sprotty-reexport.js.map +1 -1
- package/lib/utils/smodel-util.d.ts +1 -1
- package/lib/utils/smodel-util.d.ts.map +1 -1
- package/lib/utils/smodel-util.js +1 -1
- package/lib/utils/smodel-util.js.map +1 -1
- package/lib/views/base-view-module.d.ts +18 -6
- package/lib/views/base-view-module.d.ts.map +1 -1
- package/lib/views/base-view-module.js +1 -1
- package/lib/views/base-view-module.js.map +1 -1
- package/lib/views/glsp-edge-view.d.ts +2 -2
- package/lib/views/glsp-edge-view.d.ts.map +1 -1
- package/lib/views/glsp-edge-view.js +2 -2
- package/lib/views/glsp-edge-view.js.map +1 -1
- package/lib/views/index.d.ts +1 -1
- package/lib/views/index.js +1 -1
- package/lib/views/rounded-corner-view.js +2 -2
- package/lib/views/rounded-corner.d.ts +1 -1
- package/lib/views/rounded-corner.js +1 -1
- package/package.json +5 -3
- package/src/base/auto-complete/auto-complete-widget.ts +34 -10
- package/src/base/command-stack.ts +13 -11
- package/src/base/container-modules.ts +13 -36
- package/src/base/di.config.ts +8 -8
- package/src/base/editor-context-service.ts +4 -4
- package/src/base/tool-manager/glsp-tool-manager.ts +15 -12
- package/src/features/accessibility/di.config.ts +26 -0
- package/src/features/accessibility/search/di.config.ts +31 -0
- package/src/features/accessibility/search/search-palette.ts +181 -0
- package/src/features/accessibility/search/search-tool.ts +60 -0
- package/src/features/autocomplete-palette/autocomplete-suggestion-providers.ts +37 -0
- package/src/features/autocomplete-palette/base-autocomplete-palette.ts +88 -0
- package/src/features/bounds/di.config.ts +21 -11
- package/src/features/{layout/tests → bounds}/freeform-layout.spec.ts +2 -2
- package/src/features/{layout → bounds}/freeform-layout.ts +2 -2
- package/src/features/bounds/glsp-hidden-bounds-updater.ts +4 -7
- package/src/features/{layout/tests → bounds}/hbox-layout.spec.ts +2 -2
- package/src/features/{layout → bounds}/hbox-layout.ts +1 -1
- package/src/features/{layout/tests/layouter-test-util.ts → bounds/layouter-test-util.spec.ts} +5 -5
- package/src/features/{layout → bounds}/layouter.ts +1 -1
- package/src/features/{layout/tests → bounds}/vbox-layout.spec.ts +2 -2
- package/src/features/{layout → bounds}/vbox-layout.ts +1 -1
- package/src/features/command-palette/command-palette-tool.ts +3 -3
- package/src/features/command-palette/di.config.ts +6 -7
- package/src/features/context-menu/di.config.ts +4 -3
- package/src/features/copy-paste/copy-paste-handler.ts +5 -5
- package/src/features/decoration/di.config.ts +4 -4
- package/src/features/edit-label/di.config.ts +3 -2
- package/src/features/export/di.config.ts +6 -5
- package/src/features/export/glsp-svg-exporter.ts +8 -7
- package/src/features/hover/di.config.ts +8 -7
- package/src/features/layout/di.config.ts +2 -11
- package/src/features/navigation/di.config.ts +4 -2
- package/src/features/navigation/navigation-action-handler.ts +2 -2
- package/src/features/save/di.config.ts +3 -2
- package/src/features/select/di.config.ts +8 -7
- package/src/features/select/selection-service.spec.ts +4 -5
- package/src/features/svg-metadata/di.config.ts +26 -0
- package/src/features/svg-metadata/metadata-placer.ts +51 -0
- package/src/features/tool-feedback/change-bounds-tool-feedback.ts +3 -3
- package/src/features/tool-feedback/creation-tool-feedback.ts +1 -1
- package/src/features/tool-feedback/di.config.ts +20 -18
- package/src/features/tool-feedback/edge-edit-tool-feedback.ts +1 -1
- package/src/features/tool-palette/di.config.ts +4 -4
- package/src/features/tool-palette/tool-palette.ts +4 -4
- package/src/features/tools/change-bounds-tool.ts +7 -7
- package/src/features/tools/di.config.ts +18 -19
- package/src/features/tools/glsp-manhattan-edge-router.ts +8 -5
- package/src/features/validation/di.config.ts +5 -5
- package/src/features/validation/validate.ts +16 -19
- package/src/features/viewport/di.config.ts +13 -11
- package/src/index.ts +41 -5
- package/src/sprotty-reexport.ts +18 -8
- package/src/utils/smodel-util.ts +12 -5
- package/src/views/base-view-module.ts +4 -9
- package/src/views/glsp-edge-view.tsx +3 -3
- package/src/views/index.ts +1 -2
- package/src/views/rounded-corner-view.tsx +2 -2
- package/src/views/rounded-corner.ts +2 -2
- package/lib/features/change-bounds/snap.spec.d.ts.map +0 -1
- package/lib/features/change-bounds/snap.spec.js +0 -82
- package/lib/features/change-bounds/snap.spec.js.map +0 -1
- package/lib/features/layout/layout-elements-action.spec.d.ts +0 -3
- package/lib/features/layout/layout-elements-action.spec.d.ts.map +0 -1
- package/lib/features/layout/layout-elements-action.spec.js +0 -325
- package/lib/features/layout/layout-elements-action.spec.js.map +0 -1
- package/lib/features/layout/tests/freeform-layout.spec.d.ts +0 -3
- package/lib/features/layout/tests/freeform-layout.spec.d.ts.map +0 -1
- package/lib/features/layout/tests/freeform-layout.spec.js +0 -201
- package/lib/features/layout/tests/freeform-layout.spec.js.map +0 -1
- package/lib/features/layout/tests/hbox-layout.spec.d.ts +0 -3
- package/lib/features/layout/tests/hbox-layout.spec.d.ts.map +0 -1
- package/lib/features/layout/tests/hbox-layout.spec.js +0 -161
- package/lib/features/layout/tests/hbox-layout.spec.js.map +0 -1
- package/lib/features/layout/tests/layouter-test-util.d.ts +0 -34
- package/lib/features/layout/tests/layouter-test-util.d.ts.map +0 -1
- package/lib/features/layout/tests/layouter-test-util.js +0 -96
- package/lib/features/layout/tests/layouter-test-util.js.map +0 -1
- package/lib/features/layout/tests/vbox-layout.spec.d.ts +0 -3
- package/lib/features/layout/tests/vbox-layout.spec.d.ts.map +0 -1
- package/lib/features/layout/tests/vbox-layout.spec.js +0 -161
- package/lib/features/layout/tests/vbox-layout.spec.js.map +0 -1
- package/lib/features/navigation/navigation-target-resolver.spec.d.ts +0 -3
- package/lib/features/navigation/navigation-target-resolver.spec.d.ts.map +0 -1
- package/lib/features/navigation/navigation-target-resolver.spec.js +0 -54
- package/lib/features/navigation/navigation-target-resolver.spec.js.map +0 -1
- package/lib/features/select/selection-service.spec.d.ts +0 -2
- package/lib/features/select/selection-service.spec.d.ts.map +0 -1
- package/lib/features/select/selection-service.spec.js +0 -347
- package/lib/features/select/selection-service.spec.js.map +0 -1
- package/lib/features/tools/marquee-behavior.spec.d.ts.map +0 -1
- package/lib/features/tools/marquee-behavior.spec.js +0 -165
- package/lib/features/tools/marquee-behavior.spec.js.map +0 -1
- package/lib/features/validation/marker-navigator.spec.d.ts +0 -3
- package/lib/features/validation/marker-navigator.spec.d.ts.map +0 -1
- package/lib/features/validation/marker-navigator.spec.js +0 -169
- package/lib/features/validation/marker-navigator.spec.js.map +0 -1
package/src/base/di.config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { InitializeResult, SetEditModeAction } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { bindAsService, bindOrRebind, InitializeResult, SetEditModeAction } from '@eclipse-glsp/protocol';
|
|
17
17
|
import '@vscode/codicons/dist/codicon.css';
|
|
18
18
|
import { Container, ContainerModule } from 'inversify';
|
|
19
19
|
import { ActionHandlerRegistry, configureActionHandler, configureCommand, ModelSource, SetModelCommand } from 'sprotty';
|
|
@@ -54,19 +54,19 @@ const defaultGLSPModule = new ContainerModule((bind, _unbind, isBound, rebind) =
|
|
|
54
54
|
configureCommand(context, FeedbackAwareUpdateModelCommand);
|
|
55
55
|
configureActionHandler(context, SetModelCommand.KIND, SetModelActionHandler);
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
bindAsService(context, TYPES.MouseListener, SelectionClearingMouseListener);
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
bindOrRebind(context, TYPES.ICommandStack).to(GLSPCommandStack);
|
|
60
60
|
bind(GLSPToolManager).toSelf().inSingletonScope();
|
|
61
|
-
|
|
61
|
+
bindOrRebind(context, TYPES.IToolManager).toService(GLSPToolManager);
|
|
62
62
|
bind(GLSPActionDispatcher).toSelf().inSingletonScope();
|
|
63
|
-
|
|
63
|
+
bindOrRebind(context, TYPES.IActionDispatcher).toService(GLSPActionDispatcher);
|
|
64
64
|
|
|
65
65
|
bind(ModelInitializationConstraint).to(DefaultModelInitializationConstraint).inSingletonScope();
|
|
66
66
|
|
|
67
67
|
// support re-registration of model elements and views
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
bindOrRebind(context, TYPES.SModelRegistry).to(GLSPModelRegistry).inSingletonScope();
|
|
69
|
+
bindOrRebind(context, TYPES.ViewRegistry).to(GLSPViewRegistry).inSingletonScope();
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
export default defaultGLSPModule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -21,7 +21,7 @@ import { isSourceUriAware } from './source-uri-aware';
|
|
|
21
21
|
import { TYPES } from './types';
|
|
22
22
|
|
|
23
23
|
export interface EditModeListener {
|
|
24
|
-
editModeChanged(newValue: string,
|
|
24
|
+
editModeChanged(newValue: string, oldValue: string): void;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -81,11 +81,11 @@ export class EditorContextService implements IActionHandler {
|
|
|
81
81
|
if (SetEditModeAction.is(action)) {
|
|
82
82
|
const oldValue = this._editMode;
|
|
83
83
|
this._editMode = action.editMode;
|
|
84
|
-
this.
|
|
84
|
+
this.notifyEditModeListeners(oldValue);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
protected
|
|
88
|
+
protected notifyEditModeListeners(oldValue: string): void {
|
|
89
89
|
this.editModeListeners.forEach(listener => listener.editModeChanged(oldValue, this.editMode));
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,19 +13,14 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { distinctAdd, EditMode } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { AnyObject, distinctAdd, EditMode, hasBooleanProp, hasFunctionProp, hasStringProp } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { inject, injectable, multiInject, optional, postConstruct } from 'inversify';
|
|
18
18
|
import { Tool, ToolManager } from 'sprotty';
|
|
19
19
|
import { EditModeListener, EditorContextService, EditorContextServiceProvider } from '../editor-context-service';
|
|
20
20
|
import { TYPES } from '../types';
|
|
21
21
|
|
|
22
|
-
export interface IGLSPToolManager extends ToolManager {
|
|
23
|
-
/* Disables all actives tools and activates only default tool with non-edit function*/
|
|
24
|
-
disableEditTools(): void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
22
|
@injectable()
|
|
28
|
-
export class GLSPToolManager extends ToolManager implements
|
|
23
|
+
export class GLSPToolManager extends ToolManager implements EditModeListener {
|
|
29
24
|
protected editorContext?: EditorContextService;
|
|
30
25
|
|
|
31
26
|
@multiInject(TYPES.ITool) @optional() override tools: Tool[];
|
|
@@ -59,7 +54,7 @@ export class GLSPToolManager extends ToolManager implements IGLSPToolManager, Ed
|
|
|
59
54
|
this.disableActiveTools();
|
|
60
55
|
let tools = toolIds.map(id => this.tool(id));
|
|
61
56
|
if (this.editorContext && this.editorContext.isReadonly) {
|
|
62
|
-
tools = tools.filter(tool => tool && (!
|
|
57
|
+
tools = tools.filter(tool => tool && (!GLSPTool.is(tool) || tool.isEditTool === false));
|
|
63
58
|
}
|
|
64
59
|
tools.forEach(tool => {
|
|
65
60
|
if (tool !== undefined) {
|
|
@@ -71,7 +66,7 @@ export class GLSPToolManager extends ToolManager implements IGLSPToolManager, Ed
|
|
|
71
66
|
|
|
72
67
|
disableEditTools(): void {
|
|
73
68
|
this.disableActiveTools();
|
|
74
|
-
this.enable(this.defaultTools.filter(tool => !
|
|
69
|
+
this.enable(this.defaultTools.filter(tool => !GLSPTool.is(tool) || tool.isEditTool === false).map(tool => tool.id));
|
|
75
70
|
}
|
|
76
71
|
|
|
77
72
|
editModeChanged(oldValue: string, newValue: string): void {
|
|
@@ -90,6 +85,14 @@ export interface GLSPTool extends Tool {
|
|
|
90
85
|
isEditTool: boolean;
|
|
91
86
|
}
|
|
92
87
|
|
|
93
|
-
export
|
|
94
|
-
|
|
88
|
+
export namespace GLSPTool {
|
|
89
|
+
export function is(object: unknown): object is GLSPTool {
|
|
90
|
+
return (
|
|
91
|
+
AnyObject.is(object) &&
|
|
92
|
+
hasStringProp(object, 'id') &&
|
|
93
|
+
hasFunctionProp(object, 'enable') &&
|
|
94
|
+
hasFunctionProp(object, 'disable') &&
|
|
95
|
+
hasBooleanProp(object, 'isEditTool')
|
|
96
|
+
);
|
|
97
|
+
}
|
|
95
98
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 Business Informatics Group (TU Wien) 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
|
+
|
|
17
|
+
import { ContainerModule } from 'inversify';
|
|
18
|
+
import { configureSearchPaletteModule } from './search/di.config';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Enables the accessibility tools for a keyboard-only-usage
|
|
22
|
+
*/
|
|
23
|
+
export const glspAccessibilityModule = new ContainerModule((bind, _unbind, isBound, rebind) => {
|
|
24
|
+
const context = { bind, isBound, rebind };
|
|
25
|
+
configureSearchPaletteModule(context);
|
|
26
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 Business Informatics Group (TU Wien) 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
|
+
|
|
17
|
+
import { bindAsService, BindingContext } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { ContainerModule } from 'inversify';
|
|
19
|
+
import { TYPES } from '../../../base/types';
|
|
20
|
+
import { SearchAutocompletePalette } from './search-palette';
|
|
21
|
+
import { SearchAutocompletePaletteTool } from './search-tool';
|
|
22
|
+
|
|
23
|
+
export const glspSearchPaletteModule = new ContainerModule((bind, _unbind, isBound, rebind) => {
|
|
24
|
+
const context = { bind, isBound, rebind };
|
|
25
|
+
configureSearchPaletteModule(context);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export function configureSearchPaletteModule(context: Pick<BindingContext, 'bind'>): void {
|
|
29
|
+
bindAsService(context, TYPES.IUIExtension, SearchAutocompletePalette);
|
|
30
|
+
bindAsService(context, TYPES.IDefaultTool, SearchAutocompletePaletteTool);
|
|
31
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 Business Informatics Group (TU Wien) 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
|
+
|
|
17
|
+
import { Action, CenterAction, SelectAction, SelectAllAction } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { injectable } from 'inversify';
|
|
19
|
+
import { isEqual } from 'lodash';
|
|
20
|
+
import { codiconCSSString, isNameable, LabeledAction, name, SEdge, SModelElement, SModelRoot, SNode } from 'sprotty';
|
|
21
|
+
import { toArray } from 'sprotty/lib/utils/iterable';
|
|
22
|
+
import { AutocompleteSuggestion, IAutocompleteSuggestionProvider } from '../../autocomplete-palette/autocomplete-suggestion-providers';
|
|
23
|
+
import { BaseAutocompletePalette } from '../../autocomplete-palette/base-autocomplete-palette';
|
|
24
|
+
|
|
25
|
+
import { applyCssClasses, deleteCssClasses } from '../../tool-feedback/css-feedback';
|
|
26
|
+
|
|
27
|
+
const CSS_SEARCH_HIDDEN = 'search-hidden';
|
|
28
|
+
const CSS_SEARCH_HIGHLIGHTED = 'search-highlighted';
|
|
29
|
+
|
|
30
|
+
export class RevealNamedElementAutocompleteSuggestionProvider implements IAutocompleteSuggestionProvider {
|
|
31
|
+
async retrieveSuggestions(root: Readonly<SModelRoot>, text: string): Promise<AutocompleteSuggestion[]> {
|
|
32
|
+
const nameables = toArray(root.index.all().filter(element => isNameable(element)));
|
|
33
|
+
return nameables.map(nameable => ({
|
|
34
|
+
element: nameable,
|
|
35
|
+
action: new LabeledAction(
|
|
36
|
+
`[${nameable.type}] ${name(nameable) ?? '<no-name>'}`,
|
|
37
|
+
this.getActions(nameable),
|
|
38
|
+
codiconCSSString('eye')
|
|
39
|
+
)
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
protected getActions(nameable: SModelElement): Action[] {
|
|
44
|
+
return [SelectAction.create({ selectedElementsIDs: [nameable.id] }), CenterAction.create([nameable.id], { retainZoom: true })];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export class RevealEdgeElementAutocompleteSuggestionProvider implements IAutocompleteSuggestionProvider {
|
|
49
|
+
async retrieveSuggestions(root: Readonly<SModelRoot>, text: string): Promise<AutocompleteSuggestion[]> {
|
|
50
|
+
const edges = toArray(root.index.all().filter(element => element instanceof SEdge)) as SEdge[];
|
|
51
|
+
return edges.map(edge => ({
|
|
52
|
+
element: edge,
|
|
53
|
+
action: new LabeledAction(
|
|
54
|
+
`[${edge.type}] ` + this.getEdgeLabel(root, edge),
|
|
55
|
+
this.getActions(edge),
|
|
56
|
+
codiconCSSString('arrow-both')
|
|
57
|
+
)
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
protected getActions(edge: SEdge): Action[] {
|
|
61
|
+
return [SelectAction.create({ selectedElementsIDs: [edge.id] }), CenterAction.create([edge.sourceId, edge.targetId])];
|
|
62
|
+
}
|
|
63
|
+
protected getEdgeLabel(root: Readonly<SModelRoot>, edge: SEdge): string {
|
|
64
|
+
let sourceName = '';
|
|
65
|
+
let targetName = '';
|
|
66
|
+
|
|
67
|
+
const sourceNode = root.index.getById(edge.sourceId);
|
|
68
|
+
const targetNode = root.index.getById(edge.targetId);
|
|
69
|
+
|
|
70
|
+
if (sourceNode !== undefined) {
|
|
71
|
+
sourceName = name(sourceNode) ?? sourceNode.type;
|
|
72
|
+
}
|
|
73
|
+
if (targetNode !== undefined) {
|
|
74
|
+
targetName = name(targetNode) ?? targetNode.type;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return sourceName + ' -> ' + targetName;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
@injectable()
|
|
81
|
+
export class SearchAutocompletePalette extends BaseAutocompletePalette {
|
|
82
|
+
static readonly ID = 'search-autocomplete-palette';
|
|
83
|
+
|
|
84
|
+
protected cachedSuggestions: AutocompleteSuggestion[] = [];
|
|
85
|
+
|
|
86
|
+
id(): string {
|
|
87
|
+
return SearchAutocompletePalette.ID;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
protected override initializeContents(containerElement: HTMLElement): void {
|
|
91
|
+
super.initializeContents(containerElement);
|
|
92
|
+
|
|
93
|
+
this.autocompleteWidget.inputField.placeholder = 'Search for elements';
|
|
94
|
+
}
|
|
95
|
+
protected getSuggestionProviders(root: Readonly<SModelRoot>, input: string): IAutocompleteSuggestionProvider[] {
|
|
96
|
+
return [new RevealNamedElementAutocompleteSuggestionProvider(), new RevealEdgeElementAutocompleteSuggestionProvider()];
|
|
97
|
+
}
|
|
98
|
+
protected async retrieveSuggestions(root: Readonly<SModelRoot>, input: string): Promise<LabeledAction[]> {
|
|
99
|
+
const providers = this.getSuggestionProviders(root, input);
|
|
100
|
+
const suggestions = (await Promise.all(providers.map(provider => provider.retrieveSuggestions(root, input)))).flat(1);
|
|
101
|
+
|
|
102
|
+
this.cachedSuggestions = suggestions;
|
|
103
|
+
|
|
104
|
+
return suggestions.map(s => s.action);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
protected override async visibleSuggestionsChanged(root: Readonly<SModelRoot>, labeledActions: LabeledAction[]): Promise<void> {
|
|
108
|
+
await this.applyCSS(this.getHiddenElements(root, this.getSuggestionsFromLabeledActions(labeledActions)), CSS_SEARCH_HIDDEN);
|
|
109
|
+
await this.deleteCSS(
|
|
110
|
+
this.getSuggestionsFromLabeledActions(labeledActions).map(s => s.element),
|
|
111
|
+
CSS_SEARCH_HIDDEN
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
protected override async selectedSuggestionChanged(
|
|
116
|
+
root: Readonly<SModelRoot>,
|
|
117
|
+
labeledAction?: LabeledAction | undefined
|
|
118
|
+
): Promise<void> {
|
|
119
|
+
await this.deleteAllCSS(root, CSS_SEARCH_HIGHLIGHTED);
|
|
120
|
+
if (labeledAction !== undefined) {
|
|
121
|
+
const suggestions = this.getSuggestionsFromLabeledActions([labeledAction]);
|
|
122
|
+
|
|
123
|
+
const actions: CenterAction[] = [];
|
|
124
|
+
suggestions.map(currElem => actions.push(CenterAction.create([currElem.element.id], { animate: true, retainZoom: true })));
|
|
125
|
+
|
|
126
|
+
this.actionDispatcher.dispatchAll(actions);
|
|
127
|
+
await this.applyCSS(
|
|
128
|
+
suggestions.map(s => s.element),
|
|
129
|
+
CSS_SEARCH_HIGHLIGHTED
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public override show(root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
|
|
135
|
+
this.actionDispatcher.dispatch(SelectAllAction.create(false));
|
|
136
|
+
|
|
137
|
+
super.show(root, ...contextElementIds);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
public override hide(): void {
|
|
141
|
+
if (this.root !== undefined) {
|
|
142
|
+
this.deleteAllCSS(this.root, CSS_SEARCH_HIDDEN);
|
|
143
|
+
this.deleteAllCSS(this.root, CSS_SEARCH_HIGHLIGHTED);
|
|
144
|
+
this.autocompleteWidget.inputField.value = '';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
super.hide();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
protected applyCSS(elements: SModelElement[], cssClass: string): Promise<void> {
|
|
151
|
+
const actions = elements.map(element => applyCssClasses(element, cssClass));
|
|
152
|
+
return this.actionDispatcher.dispatchAll(actions);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
protected deleteCSS(elements: SModelElement[], cssClass: string): Promise<void> {
|
|
156
|
+
const actions = elements.map(element => deleteCssClasses(element, cssClass));
|
|
157
|
+
return this.actionDispatcher.dispatchAll(actions);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
protected deleteAllCSS(root: Readonly<SModelRoot>, cssClass: string): Promise<void> {
|
|
161
|
+
const actions = toArray(root.index.all().map(element => deleteCssClasses(element, cssClass)));
|
|
162
|
+
return this.actionDispatcher.dispatchAll(actions);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
protected getSuggestionsFromLabeledActions(labeledActions: LabeledAction[]): AutocompleteSuggestion[] {
|
|
166
|
+
return this.cachedSuggestions.filter(c => labeledActions.find(s => isEqual(s, c.action)));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
protected getHiddenSuggestionsFromLabeledActions(labeledActions: LabeledAction[]): AutocompleteSuggestion[] {
|
|
170
|
+
return this.cachedSuggestions.filter(c => !labeledActions.find(s => isEqual(s, c.action)));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
protected getHiddenElements(root: Readonly<SModelRoot>, suggestions: AutocompleteSuggestion[]): SModelElement[] {
|
|
174
|
+
return toArray(
|
|
175
|
+
root.index
|
|
176
|
+
.all()
|
|
177
|
+
.filter(element => element instanceof SNode || element instanceof SEdge)
|
|
178
|
+
.filter(element => suggestions.find(suggestion => suggestion.element.id === element.id) === undefined)
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 Business Informatics Group (TU Wien) 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
|
+
|
|
17
|
+
import { Action } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { inject, injectable } from 'inversify';
|
|
19
|
+
import { KeyListener, KeyTool, SetUIExtensionVisibilityAction, SModelElement, Tool } from 'sprotty';
|
|
20
|
+
import { matchesKeystroke } from 'sprotty/lib/utils/keyboard';
|
|
21
|
+
import { SearchAutocompletePalette } from './search-palette';
|
|
22
|
+
|
|
23
|
+
@injectable()
|
|
24
|
+
export class SearchAutocompletePaletteTool implements Tool {
|
|
25
|
+
static readonly ID = 'glsp.search-autocomplete-palette-tool';
|
|
26
|
+
|
|
27
|
+
protected readonly keyListener = new SearchAutocompletePaletteKeyListener();
|
|
28
|
+
|
|
29
|
+
@inject(KeyTool) protected keyTool: KeyTool;
|
|
30
|
+
|
|
31
|
+
get id(): string {
|
|
32
|
+
return SearchAutocompletePaletteTool.ID;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
enable(): void {
|
|
36
|
+
this.keyTool.register(this.keyListener);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
disable(): void {
|
|
40
|
+
this.keyTool.deregister(this.keyListener);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export class SearchAutocompletePaletteKeyListener extends KeyListener {
|
|
45
|
+
override keyDown(element: SModelElement, event: KeyboardEvent): Action[] {
|
|
46
|
+
if (this.matchesSearchActivateKeystroke(event)) {
|
|
47
|
+
return [
|
|
48
|
+
SetUIExtensionVisibilityAction.create({
|
|
49
|
+
extensionId: SearchAutocompletePalette.ID,
|
|
50
|
+
visible: true
|
|
51
|
+
})
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
protected matchesSearchActivateKeystroke(event: KeyboardEvent): boolean {
|
|
58
|
+
return matchesKeystroke(event, 'KeyF', 'ctrl');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 Business Informatics Group (TU Wien) 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
|
+
|
|
17
|
+
import { LabeledAction, SModelElement, SModelRoot } from 'sprotty';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Interface for a provider that provides suggestions that can be used to fill the autocomplete
|
|
21
|
+
*/
|
|
22
|
+
export interface IAutocompleteSuggestionProvider {
|
|
23
|
+
/**
|
|
24
|
+
* Returns the suggestions based on the provided parameters.
|
|
25
|
+
* @param root: The root model
|
|
26
|
+
* @param text: The text input provided by the user.
|
|
27
|
+
*/
|
|
28
|
+
retrieveSuggestions(root: Readonly<SModelRoot>, text: string): Promise<AutocompleteSuggestion[]>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Interface for autocomplete suggestions.
|
|
33
|
+
*/
|
|
34
|
+
export interface AutocompleteSuggestion {
|
|
35
|
+
element: SModelElement;
|
|
36
|
+
action: LabeledAction;
|
|
37
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 Business Informatics Group (TU Wien) 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
|
+
|
|
17
|
+
import { Action } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { inject } from 'inversify';
|
|
19
|
+
import { AbstractUIExtension, LabeledAction, SModelRoot, TYPES } from 'sprotty';
|
|
20
|
+
import '../../../css/autocomplete-palette.css';
|
|
21
|
+
import { GLSPActionDispatcher } from '../../base/action-dispatcher';
|
|
22
|
+
import { AutoCompleteWidget, CloseReason, toActionArray } from '../../base/auto-complete/auto-complete-widget';
|
|
23
|
+
|
|
24
|
+
export abstract class BaseAutocompletePalette extends AbstractUIExtension {
|
|
25
|
+
protected readonly autoSuggestionSettings = {
|
|
26
|
+
noSuggestionsMessage: 'No suggestions available',
|
|
27
|
+
suggestionsClass: 'command-palette-suggestions',
|
|
28
|
+
debounceWaitMs: 50,
|
|
29
|
+
showOnFocus: true
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
protected root?: Readonly<SModelRoot>;
|
|
33
|
+
protected autocompleteWidget: AutoCompleteWidget;
|
|
34
|
+
|
|
35
|
+
@inject(TYPES.IActionDispatcher)
|
|
36
|
+
protected actionDispatcher: GLSPActionDispatcher;
|
|
37
|
+
|
|
38
|
+
containerClass(): string {
|
|
39
|
+
return 'autocomplete-palette';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override show(root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
|
|
43
|
+
super.show(root, ...contextElementIds);
|
|
44
|
+
this.root = root;
|
|
45
|
+
this.autocompleteWidget.open(root);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override hide(): void {
|
|
49
|
+
this.autocompleteWidget.dispose();
|
|
50
|
+
this.root = undefined;
|
|
51
|
+
super.hide();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
protected initializeContents(containerElement: HTMLElement): void {
|
|
55
|
+
containerElement.classList.add('command-palette');
|
|
56
|
+
|
|
57
|
+
this.autocompleteWidget = new AutoCompleteWidget(
|
|
58
|
+
this.autoSuggestionSettings,
|
|
59
|
+
{ provideSuggestions: input => this.retrieveSuggestions(this.root!, input) },
|
|
60
|
+
{ executeFromSuggestion: input => this.executeSuggestion(input) },
|
|
61
|
+
reason => this.autocompleteHide(reason),
|
|
62
|
+
this.logger,
|
|
63
|
+
{
|
|
64
|
+
visibleSuggestionsChanged: suggestions => this.visibleSuggestionsChanged(this.root!, suggestions),
|
|
65
|
+
selectedSuggestionChanged: suggestion => this.selectedSuggestionChanged(this.root!, suggestion)
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
this.autocompleteWidget.initialize(containerElement);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
protected abstract retrieveSuggestions(root: Readonly<SModelRoot>, input: string): Promise<LabeledAction[]>;
|
|
72
|
+
|
|
73
|
+
protected async visibleSuggestionsChanged(root: Readonly<SModelRoot>, labeledActions: LabeledAction[]): Promise<void> {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
protected async selectedSuggestionChanged(root: Readonly<SModelRoot>, labeledAction?: LabeledAction): Promise<void> {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
protected autocompleteHide(reason: CloseReason): void {
|
|
82
|
+
this.hide();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
protected executeSuggestion(input: LabeledAction | Action[] | Action): void {
|
|
86
|
+
this.actionDispatcher.dispatchAll(toActionArray(input));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2022-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,27 +13,37 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { bindAsService } from '@eclipse-glsp/protocol';
|
|
16
17
|
import { ContainerModule } from 'inversify';
|
|
17
18
|
import {
|
|
18
|
-
configureCommand,
|
|
19
|
-
|
|
19
|
+
configureCommand,
|
|
20
|
+
configureLayout,
|
|
21
|
+
HBoxLayouter,
|
|
22
|
+
HiddenBoundsUpdater,
|
|
23
|
+
Layouter,
|
|
24
|
+
LayoutRegistry,
|
|
25
|
+
RequestBoundsCommand,
|
|
26
|
+
SetBoundsCommand,
|
|
27
|
+
VBoxLayouter
|
|
20
28
|
} from 'sprotty';
|
|
21
|
-
import '../../../css/command-palette.css';
|
|
22
29
|
import { TYPES } from '../../base/types';
|
|
30
|
+
import { FreeFormLayouter } from './freeform-layout';
|
|
23
31
|
import { GLSPHiddenBoundsUpdater } from './glsp-hidden-bounds-updater';
|
|
32
|
+
import { HBoxLayouterExt } from './hbox-layout';
|
|
33
|
+
import { VBoxLayouterExt } from './vbox-layout';
|
|
24
34
|
|
|
25
35
|
const glspBoundsModule = new ContainerModule((bind, _unbind, isBound, _rebind) => {
|
|
26
|
-
|
|
27
|
-
configureCommand(
|
|
36
|
+
const context = { bind, isBound };
|
|
37
|
+
configureCommand(context, SetBoundsCommand);
|
|
38
|
+
configureCommand(context, RequestBoundsCommand);
|
|
28
39
|
bind(HiddenBoundsUpdater).toSelf().inSingletonScope();
|
|
29
|
-
|
|
30
|
-
bind(TYPES.HiddenVNodePostprocessor).toService(GLSPHiddenBoundsUpdater);
|
|
40
|
+
bindAsService(context, TYPES.HiddenVNodePostprocessor, GLSPHiddenBoundsUpdater);
|
|
31
41
|
bind(TYPES.Layouter).to(Layouter).inSingletonScope();
|
|
32
42
|
bind(TYPES.LayoutRegistry).to(LayoutRegistry).inSingletonScope();
|
|
33
43
|
|
|
34
|
-
configureLayout(
|
|
35
|
-
configureLayout(
|
|
36
|
-
configureLayout(
|
|
44
|
+
configureLayout(context, VBoxLayouter.KIND, VBoxLayouterExt);
|
|
45
|
+
configureLayout(context, HBoxLayouter.KIND, HBoxLayouterExt);
|
|
46
|
+
configureLayout(context, FreeFormLayouter.KIND, FreeFormLayouter);
|
|
37
47
|
});
|
|
38
48
|
|
|
39
49
|
export default glspBoundsModule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -17,7 +17,7 @@ import { expect } from 'chai';
|
|
|
17
17
|
import 'mocha';
|
|
18
18
|
import 'reflect-metadata';
|
|
19
19
|
import { BoundsData, ConsoleLogger, SModelElement } from 'sprotty';
|
|
20
|
-
import { gModel, layout, sComp, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util';
|
|
20
|
+
import { gModel, layout, sComp, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util.spec';
|
|
21
21
|
|
|
22
22
|
describe('FreeFormLayouter', () => {
|
|
23
23
|
const layoutRegistry = setupLayoutRegistry();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021-
|
|
2
|
+
* Copyright (c) 2021-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -20,7 +20,7 @@ import { AbstractLayout } from 'sprotty/lib/features/bounds/abstract-layout';
|
|
|
20
20
|
import { AbstractLayoutOptions } from 'sprotty/lib/features/bounds/layout-options';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Layouts children of a container with
|
|
23
|
+
* Layouts children of a container with explicit X/Y positions
|
|
24
24
|
*/
|
|
25
25
|
@injectable()
|
|
26
26
|
export class FreeFormLayouter extends AbstractLayout<AbstractLayoutOptions> {
|