dazscript-framework 0.1.0

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.
Files changed (67) hide show
  1. package/babel/babel.config.js +33 -0
  2. package/babel/trace-babel-plugin.js +243 -0
  3. package/babel/trace-log-babel-plugin.js +164 -0
  4. package/common/core.ts +2 -0
  5. package/common/log.ts +57 -0
  6. package/common/trace.ts +26 -0
  7. package/core/action-decorator.ts +16 -0
  8. package/dialog/basic-dialog.ts +32 -0
  9. package/dialog/builders/button-builder.ts +53 -0
  10. package/dialog/builders/checkbox-builder.ts +30 -0
  11. package/dialog/builders/combo-box-builder.ts +36 -0
  12. package/dialog/builders/combo-edit-builder.ts +36 -0
  13. package/dialog/builders/dialog-builder.ts +49 -0
  14. package/dialog/builders/groupbox-builder.ts +73 -0
  15. package/dialog/builders/label-builder.ts +18 -0
  16. package/dialog/builders/layout-builder.ts +46 -0
  17. package/dialog/builders/line-edit-builder.ts +118 -0
  18. package/dialog/builders/list-view-builder.ts +327 -0
  19. package/dialog/builders/node-selection-builder.ts +44 -0
  20. package/dialog/builders/popup-menu-builder.ts +47 -0
  21. package/dialog/builders/radio-builder.ts +43 -0
  22. package/dialog/builders/splitter-builder.ts +90 -0
  23. package/dialog/builders/tab-builder.ts +106 -0
  24. package/dialog/builders/widget-builder.ts +109 -0
  25. package/dialog/builders/widgets-builder.ts +119 -0
  26. package/dialog/input-dialog.ts +28 -0
  27. package/dialog/input-validator.ts +9 -0
  28. package/dialog/shared.ts +8 -0
  29. package/helpers/action-helper.ts +81 -0
  30. package/helpers/array-helper.ts +145 -0
  31. package/helpers/camera-helper.ts +14 -0
  32. package/helpers/custom-action-helper.ts +176 -0
  33. package/helpers/file-helper.ts +90 -0
  34. package/helpers/input-helper.ts +19 -0
  35. package/helpers/list-view-helper.ts +89 -0
  36. package/helpers/menu-helper.ts +29 -0
  37. package/helpers/message-box-helper.ts +16 -0
  38. package/helpers/node-helper.ts +216 -0
  39. package/helpers/number-helper.ts +11 -0
  40. package/helpers/numeric-property-helper.ts +92 -0
  41. package/helpers/object-helper.ts +3 -0
  42. package/helpers/pane-helper.ts +21 -0
  43. package/helpers/progress-helper.ts +34 -0
  44. package/helpers/property-helper.ts +53 -0
  45. package/helpers/record-helper.ts +16 -0
  46. package/helpers/scene-helper.ts +96 -0
  47. package/helpers/script-helper.ts +16 -0
  48. package/helpers/skeleton-helper.ts +27 -0
  49. package/helpers/splitter-helper.ts +9 -0
  50. package/helpers/string-helper.ts +28 -0
  51. package/helpers/surface-helper.ts +6 -0
  52. package/helpers/undo-helper.ts +7 -0
  53. package/helpers/viewport-helper.ts +9 -0
  54. package/lib/delayed.ts +39 -0
  55. package/lib/dz-dump.ts +121 -0
  56. package/lib/global.ts +5 -0
  57. package/lib/guid.ts +3 -0
  58. package/lib/observable.ts +94 -0
  59. package/lib/set.ts +25 -0
  60. package/lib/settings.ts +104 -0
  61. package/models/custom-action.ts +12 -0
  62. package/models/frame-keys.ts +68 -0
  63. package/package.json +48 -0
  64. package/shared/base-script.ts +30 -0
  65. package/shared/install-generator.js +185 -0
  66. package/shared/set-keyboard-shortcut.ts +103 -0
  67. package/webpack.config.js +48 -0
@@ -0,0 +1,145 @@
1
+ import Set from '@dsf/lib/set';
2
+
3
+ export const contains = <T>(array: T[], searchElement: T, fromIndex?: number): boolean => {
4
+ if (array == null) {
5
+ throw new TypeError('Array.prototype includes called on null or undefined');
6
+ }
7
+
8
+ const O = Object(array);
9
+ const len = O.length >>> 0;
10
+
11
+ if (len === 0) {
12
+ return false;
13
+ }
14
+
15
+ let k = 0;
16
+
17
+ if (fromIndex !== undefined) {
18
+ k = fromIndex | 0;
19
+ k = Math.max(k >= 0 ? k : len - Math.abs(k), 0);
20
+ }
21
+
22
+ while (k < len) {
23
+ if (O[k] === searchElement) {
24
+ return true;
25
+ }
26
+ k++;
27
+ }
28
+
29
+ return false;
30
+ }
31
+
32
+ export const find = <T>(array: T[], f: (item: T) => boolean): T | null => {
33
+ for (const item of array) {
34
+ if (f(item)) {
35
+ return item
36
+ }
37
+ }
38
+ return null
39
+ }
40
+
41
+ export const distinct = <T>(items: T[], f?: (item: T) => any): T[] => {
42
+ const distinctItems: T[] = [];
43
+ const customSet = new Set<T>();
44
+
45
+ for (const item of items) {
46
+ const key = f ? f(item) : item;
47
+ if (!customSet.has(key)) {
48
+ customSet.add(key);
49
+ distinctItems.push(item);
50
+ }
51
+ }
52
+
53
+ return distinctItems;
54
+ }
55
+
56
+ /**
57
+ * Adds the item to the array only if it is not already contained
58
+ * @param array
59
+ * @param item
60
+ * @returns
61
+ */
62
+ export const append = <T>(array: T[], item: T): T[] => {
63
+ if (!contains(array, item)) {
64
+ array.push(item);
65
+ }
66
+ return array
67
+ }
68
+
69
+ export const flatten = <T>(array: (T | T[])[]): T[] => {
70
+ const flattened: T[] = [];
71
+ const stack: (T | T[])[] = [...array];
72
+
73
+ while (stack.length) {
74
+ const item = stack.pop();
75
+ if (Array.isArray(item)) {
76
+ // If the item is an array, push its contents onto the stack.
77
+ stack.push(...item);
78
+ } else {
79
+ // If the item is not an array, add it to the flattened array.
80
+ flattened.push(item);
81
+ }
82
+ }
83
+
84
+ return flattened.reverse(); // Reverse the array to maintain original order.
85
+ }
86
+
87
+ export const any = <T>(array: T[], f?: (item: T) => boolean): boolean => {
88
+ if (!f)
89
+ return array.length > 0
90
+
91
+ for (const item of array) {
92
+ if (f(item)) {
93
+ return true
94
+ }
95
+ }
96
+ return false;
97
+ }
98
+
99
+ export const moveToTop = <T>(arr: T[], element: T, findBy: (item: T) => string) => {
100
+ const findByValue = findBy(element);
101
+ let index = -1;
102
+
103
+ for (let i = 0; i < arr.length; i++) {
104
+ if (findBy(arr[i]) === findByValue) {
105
+ index = i;
106
+ break;
107
+ }
108
+ }
109
+
110
+ if (index > -1) {
111
+ const [removed] = arr.splice(index, 1);
112
+ arr.unshift(removed);
113
+ return;
114
+ }
115
+ }
116
+
117
+ export const moveToBottom = <T>(arr: T[], element: T, findBy: (item: T) => string) => {
118
+ const findByValue = findBy(element);
119
+ let index = -1;
120
+
121
+ for (let i = arr.length - 1; i >= 0; i--) {
122
+ if (findBy(arr[i]) === findByValue) {
123
+ index = i;
124
+ break;
125
+ }
126
+ }
127
+
128
+ if (index > -1) {
129
+ const [removed] = arr.splice(index, 1);
130
+ arr.push(removed);
131
+ return;
132
+ }
133
+ }
134
+
135
+ export const group = <T, K extends string>(array: T[], getKey: (item: T) => K): Record<K, T[]> => {
136
+ let reduced: Record<K, T[]> = array.reduce((previous, currentItem) => {
137
+ let group = getKey(currentItem);
138
+ if (!group) group = "" as K;
139
+ if (!previous[group]) previous[group] = [];
140
+ previous[group].push(currentItem);
141
+ return previous;
142
+ }, {} as Record<K, T[]>);
143
+ return reduced;
144
+ }
145
+
@@ -0,0 +1,14 @@
1
+ import * as global from '@dsf/lib/global'
2
+ import { mainWindow } from '@dsf/lib/global';
3
+
4
+ export const getActiveCamera = (): DzCamera => {
5
+ return mainWindow.getViewportMgr().getActiveViewport().get3DViewport().getCamera()
6
+ }
7
+
8
+ export const setActiveCamera = (camera: DzCamera) => {
9
+ mainWindow.getViewportMgr().getActiveViewport().get3DViewport().setCamera(camera);
10
+ }
11
+
12
+ export const getPerspectiveCamera = (): DzCamera => {
13
+ return mainWindow.getViewportMgr().getViewCamera(DzCamera.PERSPECTIVE_CAM)
14
+ }
@@ -0,0 +1,176 @@
1
+ import { debug } from '@dsf/common/log'
2
+ import * as array from '@dsf/helpers/array-helper'
3
+ import { mainWindow } from '@dsf/lib/global'
4
+ import { CustomAction } from '@dsf/models/custom-action'
5
+ import { getMenu } from './menu-helper'
6
+ import { keys } from './object-helper'
7
+ import { progress } from './progress-helper'
8
+ import { getScriptPath } from './script-helper'
9
+
10
+ const actionMgr = mainWindow.getActionMgr()
11
+ const paneMgr = mainWindow.getPaneMgr()
12
+
13
+ export const findByFilePath = (action: CustomAction, filePath: string): CustomAction | null => {
14
+ var actionsCount = actionMgr.getNumCustomActions()
15
+ for (var i = 0; i < actionsCount; i++) {
16
+ var actionFilePath = actionMgr.getCustomActionFile(i)
17
+
18
+ if (actionFilePath != filePath) continue
19
+
20
+ var name = actionMgr.getCustomActionName(i)
21
+ var text = actionMgr.getCustomActionText(i)
22
+ var desc = actionMgr.getCustomActionDesc(i)
23
+ var icon = actionMgr.getCustomActionIcon(i)
24
+
25
+ return {
26
+ name: name.toString(),
27
+ text: text.toString(),
28
+ description: desc.toString(),
29
+ filePath: actionFilePath.toString(),
30
+ icon: icon.toString(),
31
+ menuPath: action.menuPath,
32
+ group: action.group,
33
+ shortcut: action.shortcut,
34
+ sort: action.sort,
35
+ toolbar: action.toolbar
36
+ } as CustomAction
37
+ }
38
+
39
+ return null
40
+ }
41
+
42
+ export const findMenuFor = (actionName: string, topMenu?: DzActionMenu): DzActionMenu | null => {
43
+ topMenu = topMenu ?? actionMgr.getMenu()
44
+ if (!topMenu.hasItems()) return null
45
+ for (let i = 0; i < topMenu.getNumItems(); i++) {
46
+ let item = topMenu.getItem(i)
47
+ if (item.type == DzActionMenuItem.CustomAction && item.action == actionName)
48
+ return item.getParentMenu()
49
+ if (item.type == DzActionMenuItem.SubMenu) {
50
+ var subMenu = findMenuFor(actionName, item.getSubMenu())
51
+ if (subMenu) return subMenu
52
+ }
53
+ }
54
+ return null
55
+ }
56
+
57
+ export const findInMenu = (menu: DzActionMenu, actionName: string): DzActionMenuItem | null => {
58
+ var item: DzActionMenuItem
59
+
60
+ var aItems = menu.getItemList()
61
+ for (var i = 0; i < aItems.length; i += 1) {
62
+ item = aItems[i]
63
+
64
+ if (item.type != DzActionMenuItem.CustomAction) {
65
+ continue
66
+ }
67
+
68
+ if (item.action == actionName) {
69
+ return item
70
+ }
71
+ }
72
+
73
+ return null
74
+ }
75
+
76
+ export const createCustomAction = (action: CustomAction, update: boolean) => {
77
+ let existingAction = findByFilePath(action, action.filePath)
78
+
79
+ if (existingAction && !update) return
80
+
81
+ if (existingAction) {
82
+ removeCustomAction(existingAction)
83
+ }
84
+
85
+ let name = actionMgr.addCustomAction(String(action.text), String(action.description), String(action.filePath), true, action.shortcut ?? "", String(action.icon)).toString()
86
+ action.name = name
87
+
88
+ if (action.shortcut) {
89
+ actionMgr.setCustomActionShortcut(actionMgr.findCustomAction(name), action.shortcut)
90
+ debug(`Created Custom Action: ${action.text} (${action.name}): ${action.filePath}`)
91
+ }
92
+
93
+ addToMenu(action)
94
+ addToToolbar(action)
95
+ }
96
+
97
+ export const addToMenu = (action: CustomAction) => {
98
+ if (!action.menuPath) return
99
+ action.menuPath = action.menuPath + '/'
100
+ var menu = getMenu(action.menuPath, true)
101
+ var menuAction = findInMenu(menu, action.name)
102
+ if (menuAction) return
103
+ menu.insertCustomAction(action.name, action.sort ?? -1)
104
+ debug(`Action "${action.text}" added to menu "${menu.getPath()}"`)
105
+ }
106
+
107
+ export const addToToolbar = (action: CustomAction) => {
108
+ if (!action.toolbar) return;
109
+
110
+ var toolbar = paneMgr.findToolBar(action.toolbar);
111
+
112
+ if (!toolbar) {
113
+ toolbar = paneMgr.createToolBar(action.toolbar);
114
+ toolbar.dock(DzToolBar.ToolBarTop);
115
+ }
116
+
117
+ if (array.find(toolbar.getItemList(), i => i.action == action.name)) return
118
+
119
+ debug(`Adding menu to toolbar ${toolbar.name}`)
120
+ toolbar.insertCustomAction(action.name, action.sort)
121
+ }
122
+
123
+ const removeCustomAction = (action: CustomAction) => {
124
+ if (!action.name) return
125
+ var menu = findMenuFor(action.name, actionMgr.getMenu())
126
+ if (menu) {
127
+ var menuAction = findInMenu(menu, action.name)
128
+ if (menuAction) {
129
+ menu.removeItem(menuAction)
130
+ debug(`Action ${action.text} Removed from menu`)
131
+ }
132
+ }
133
+
134
+ actionMgr.removeCustomAction(actionMgr.findCustomAction(action.name))
135
+ debug(`Action ${action.text} Removed`)
136
+ debug(`Toolbar: ${action.toolbar}`)
137
+
138
+ if (!action.toolbar) return
139
+ debug(`Removing Toolbar ${action.toolbar}`)
140
+ var toolbar = paneMgr.findToolBar(action.toolbar)
141
+ if (!toolbar) return
142
+ toolbar.clear()
143
+ paneMgr.removeToolBar(action.toolbar)
144
+ debug(`Toolbar Removed`)
145
+ }
146
+
147
+ export const installCustomActions = (actions: CustomAction[]) => {
148
+ uninstallCustomActions(actions)
149
+ let scriptsPath = getScriptPath()
150
+ debug(`Script path: ${scriptsPath}`)
151
+ let menuPaths = array.group(actions, (a => a.menuPath ?? ""))
152
+ progress('Installing', keys(menuPaths), (menuPath) => {
153
+ let actions = menuPaths[menuPath] as CustomAction[]
154
+ let groups = array.group(actions, (action) => action.group ?? "")
155
+ keys(groups).forEach(group => {
156
+ groups[group].forEach(action => {
157
+ action.filePath = `${scriptsPath}/${action.filePath}`
158
+ action.icon = action.icon ? `${scriptsPath}/${action.icon}` : ''
159
+ createCustomAction(action, true)
160
+ // findMenuFor(action.name)
161
+ })
162
+ })
163
+ })
164
+ }
165
+
166
+ export const uninstallCustomActions = (actions: CustomAction[]) => {
167
+ debug(`Uninstalling Actions`)
168
+ actions.forEach(action => {
169
+ if (!action) return
170
+ let customAction = findByFilePath(action, `${getScriptPath()}/${action.filePath}`)
171
+ if (!customAction) return
172
+ debug(`Uninstalling action "${customAction.text} (${customAction.name})"`)
173
+ removeCustomAction(customAction)
174
+ })
175
+ }
176
+
@@ -0,0 +1,90 @@
1
+ import * as log from '@dsf/common/log'
2
+
3
+ /**
4
+ * Reads a file and tries to deserialize it to the specified type, assuming the file content
5
+ * is a valid JSON
6
+ * @param filePath the file to read
7
+ * @param cache if true, cache the file into memory
8
+ * @returns the deserialized object or null of the file cannot be deserialized
9
+ */
10
+ export const readFromFile = <T>(filePath: string, cache: boolean = false): T | null => {
11
+ try {
12
+ var file = new DzFile(filePath)
13
+ if (!file.exists()) return null
14
+ file.open(DzFile.ReadOnly)
15
+ file.setCaching(cache)
16
+ var content = file.read().toString()
17
+ var items: T = JSON.parse(content)
18
+ file.close()
19
+ file.deleteLater()
20
+ return items
21
+ } catch (error) {
22
+ log.error(`Error while reading file ${filePath}`)
23
+ return null
24
+ }
25
+ }
26
+
27
+ /**
28
+ *
29
+ * @param path
30
+ * @param fileName
31
+ * @param content
32
+ * @returns
33
+ */
34
+ export const saveToFile = (filePath: string, content: string): boolean => {
35
+ try {
36
+ if (!filePath || !content) return false
37
+ let fileInfo = new DzFileInfo(filePath)
38
+ let path = fileInfo.absolutePath()
39
+ var dzDir = new DzDir(path)
40
+ dzDir.mkpath(path)
41
+ var file = new DzFile(`${filePath}`)
42
+ file.open(DzFile.WriteOnly)
43
+ file.write(content)
44
+ file.close()
45
+ fileInfo.deleteLater()
46
+ file.deleteLater()
47
+ return true
48
+ } catch (error) {
49
+ log.error(`Error while saving file ${filePath}`)
50
+ return false
51
+ }
52
+ }
53
+
54
+ /**
55
+ *
56
+ * @param path
57
+ * @param fileName
58
+ * @param content
59
+ * @returns
60
+ * @deprecated must remove path argument
61
+ */
62
+ export const saveToFileOld = (path: string, fileName: string, content: string): boolean => {
63
+ try {
64
+ if (!path || !fileName || !content) return false
65
+ var dzDir = new DzDir(path)
66
+ dzDir.mkpath(path)
67
+ var file = new DzFile(`${path}${fileName}`)
68
+ file.open(DzFile.WriteOnly)
69
+ file.write(content)
70
+ file.close()
71
+ file.deleteLater()
72
+ return true
73
+ } catch (error) {
74
+ log.error(`Error while saving file ${path}${fileName}`)
75
+ return false
76
+ }
77
+ }
78
+
79
+ export const deleteFile = (filePath: string): boolean => {
80
+ try {
81
+ var file = new DzFile(filePath)
82
+ if (!file.exists()) return
83
+ file.remove(filePath)
84
+ file.deleteLater()
85
+ return true
86
+ } catch (error) {
87
+ log.error(`Error while deleting file ${filePath}`)
88
+ return false
89
+ }
90
+ }
@@ -0,0 +1,19 @@
1
+ export const getModifierKeys = (): {
2
+ shift: boolean,
3
+ ctrl: boolean,
4
+ command: boolean,
5
+ win: boolean,
6
+ control: boolean,
7
+ alt: boolean
8
+ } => {
9
+ var nModifierState = App.modifierKeyState();
10
+
11
+ return {
12
+ shift: (nModifierState & 0x02000000) != 0,
13
+ ctrl: (nModifierState & 0x04000000) != 0,
14
+ alt: (nModifierState & 0x08000000) != 0,
15
+ win: (nModifierState & 0x10000000) != 0,
16
+ command: (nModifierState & 0x04000000) != 0,
17
+ control: (nModifierState & 0x10000000) != 0
18
+ };
19
+ }
@@ -0,0 +1,89 @@
1
+ import { contains } from './string-helper'
2
+
3
+ export const clearColumns = (listView: DzListView) => {
4
+ for (let i = 0; i < listView.columns; i++) {
5
+ listView.removeColumn(i)
6
+ }
7
+ }
8
+
9
+ export const setDataItem = (listItem: DzListViewItem, data: any) => {
10
+ listItem.addDataItem('data', data)
11
+ }
12
+
13
+ export const getDataItem = <T>(listItem: DzListViewItem): T | null => {
14
+ return listItem?.getDataItem('data') ?? null
15
+ }
16
+
17
+ export const filter = (listView: DzListView, filterOn: (viewItem: DzListViewItem) => string, keywords: string, options?: { selectOnFilter?: boolean, filters?: (viewItem: DzListViewItem) => boolean }) => {
18
+ listView.clearSelection()
19
+ listView.getItems(DzListView.All).forEach(item => item.visible = true)
20
+
21
+ const matchFilter = (text: string): boolean => {
22
+ text = text.toLowerCase()
23
+ var words = keywords?.toLowerCase().split(" ") ?? []
24
+
25
+ return !keywords || keywords.trim() == "" ||
26
+ words.every(w => {
27
+ return w.length >= 1 || !isNaN(Number(w))
28
+ ? contains(text, w)
29
+ : text.startsWith(w)
30
+ });
31
+ }
32
+
33
+ const setListViewItemVisibility = (viewItem: DzListViewItem): boolean => {
34
+ let keywordMatch = matchFilter(filterOn(viewItem))
35
+ let filtersMatch = !options?.filters || options.filters?.(viewItem) === true
36
+ viewItem.visible = keywordMatch && filtersMatch
37
+
38
+ if (options?.selectOnFilter === true && viewItem.visible && !listView.selectedItem()) {
39
+ listView.setSelected(viewItem, true)
40
+ listView.ensureItemVisible(viewItem)
41
+ }
42
+
43
+ return viewItem.visible;
44
+ }
45
+
46
+ const filterListViewItem = (viewItem: DzListViewItem): boolean => {
47
+ var visible = false;
48
+
49
+ if (viewItem.childCount() > 0) {
50
+ var child = viewItem.firstChild()
51
+ while (child) {
52
+ visible = visible || filterListViewItem(child)
53
+ child = child.nextSibling()
54
+ }
55
+ }
56
+
57
+ viewItem.visible = visible || setListViewItemVisibility(viewItem);
58
+ return viewItem.visible;
59
+ }
60
+
61
+ listView.getItems(DzListView.All).forEach(viewItem => {
62
+ viewItem.visible = true
63
+ filterListViewItem(viewItem)
64
+ });
65
+ }
66
+
67
+ export const expand = (listView: DzListView, expandOrCollapse: boolean, listItem?: DzListViewItem) => {
68
+ if (listItem) {
69
+ listItem.open = expandOrCollapse
70
+ if (listItem.childCount() > 0) {
71
+ var child = listItem.firstChild()
72
+ while (child) {
73
+ expand(listView, expandOrCollapse, child)
74
+ child = child.nextSibling()
75
+ }
76
+ }
77
+ }
78
+ else {
79
+ listView.getItems(DzListView.All).forEach((item) => {
80
+ item.open = expandOrCollapse
81
+ })
82
+ }
83
+ }
84
+
85
+ export const checkAll = (listView: DzListView, onOff: boolean) => {
86
+ listView.getItems(onOff ? DzListView.NotChecked : DzListView.Checked).forEach(item => {
87
+ (item as DzCheckListItem).on = onOff
88
+ })
89
+ }
@@ -0,0 +1,29 @@
1
+ import { mainWindow } from '@dsf/lib/global'
2
+
3
+ const actionMgr = mainWindow.getActionMgr()
4
+ const paneMgr = mainWindow.getPaneMgr()
5
+
6
+ export const getMenu = (menuPath: string, createIfNotFound: boolean): DzActionMenu => {
7
+ var index = menuPath.indexOf("::")
8
+ var hasPaneDelimiter = index >= 0
9
+
10
+ // TODO: Check what a path delimiter is and how to use it
11
+ if (hasPaneDelimiter) {
12
+ var paneClass = menuPath.substring(0, index)
13
+ var paneManager = paneMgr.findPane(paneClass)
14
+ if (paneManager) {
15
+ var menu = paneManager.getOptionsMenu();
16
+ var subMenu = menuPath.substring(index + 2)
17
+ // Get/Create the sub menu
18
+ return createIfNotFound
19
+ ? menu.findOrCreateSubMenu(subMenu)
20
+ : menu.findSubMenu(subMenu);
21
+ }
22
+ }
23
+ else {
24
+ // Get/Create the sub menu
25
+ return createIfNotFound
26
+ ? actionMgr.getMenu().findOrCreateSubMenu(menuPath)
27
+ : actionMgr.getMenu().findSubMenu(menuPath)
28
+ }
29
+ }
@@ -0,0 +1,16 @@
1
+ import * as log from "@dsf/common/log"
2
+
3
+ export const info = (msg: string) => {
4
+ MessageBox.information(msg, "", "Ok")
5
+ }
6
+
7
+ export const error = (message: string, writeLog?: boolean) => {
8
+ if (writeLog) log.debug(message)
9
+ MessageBox.critical(message, "Error", "Ok")
10
+ }
11
+
12
+ export const confirm = (message?: string): { ok: boolean, cancel: boolean } => {
13
+ var response = MessageBox.question(message ?? "Confirm?", "", "Ok", "Cancel");
14
+
15
+ return { ok: response == 0, cancel: response != 0 };
16
+ }