Browse Source

开始搞代码生成了

master
hejl 3 weeks ago
parent
commit
92a27463c8
  1. 7
      win_text_editor/lib/framework/common/constants.dart
  2. 32
      win_text_editor/lib/modules/code_creater/controllers/code_creater_controller.dart
  3. 14
      win_text_editor/lib/modules/code_creater/widgets/code_creater_view.dart
  4. 14
      win_text_editor/lib/modules/code_creater/widgets/node_table.dart
  5. 5
      win_text_editor/lib/modules/outline/models/code_partner.dart
  6. 2
      win_text_editor/lib/modules/outline/models/outline_node.dart
  7. 24
      win_text_editor/lib/modules/outline/services/component_service.dart
  8. 64
      win_text_editor/lib/modules/outline/services/functions_service.dart
  9. 32
      win_text_editor/lib/modules/outline/services/outline_service.dart
  10. 31
      win_text_editor/lib/modules/outline/services/std_field_service.dart
  11. 13
      win_text_editor/lib/modules/outline/services/uft_object_service.dart
  12. 10
      win_text_editor/lib/modules/outline/widgets/outline_explorer.dart
  13. 11
      win_text_editor/lib/shared/components/code_generation_components.dart

7
win_text_editor/lib/framework/common/constants.dart

@ -0,0 +1,7 @@
class Constants {
static const String uftTable = 'uftTable';
static const String component = 'component';
static const String business = 'business';
static const String atomService = 'atomService';
static const String atomFunction = 'atomFunction';
}

32
win_text_editor/lib/modules/code_creater/controllers/code_creater_controller.dart

@ -1,10 +1,29 @@
import 'package:win_text_editor/framework/common/constants.dart';
import 'package:win_text_editor/framework/controllers/logger.dart'; import 'package:win_text_editor/framework/controllers/logger.dart';
import 'package:win_text_editor/modules/outline/models/outline_node.dart'; import 'package:win_text_editor/modules/outline/models/outline_node.dart';
import 'package:win_text_editor/shared/base/base_content_controller.dart'; import 'package:win_text_editor/shared/base/base_content_controller.dart';
class CodeCreaterController extends BaseContentController { class CodeCreaterController extends BaseContentController {
final Map<String, List<String>> unMatchMap = {
Constants.atomFunction: ['逻辑服务', '逻辑函数'],
Constants.atomService: ['原子服务', '原子函数'],
Constants.business: ['原子服务', '原子函数'],
Constants.uftTable: [],
Constants.component: [],
};
List<OutlineNode> _members = []; List<OutlineNode> _members = [];
List<OutlineNode> get members => _members; List<OutlineNode> get members => _members;
String _selectedOperation = '原子函数';
String get selectedOperation => _selectedOperation;
set selectedOperation(String value) {
final filtered =
_members.where((node) => !(unMatchMap[node.value]?.contains(value) ?? false)).toList();
_members = filtered; //
_selectedOperation = value;
notifyListeners(); //
}
void updateMembers(List<OutlineNode> newMembers) { void updateMembers(List<OutlineNode> newMembers) {
_members = newMembers; _members = newMembers;
@ -12,17 +31,18 @@ class CodeCreaterController extends BaseContentController {
} }
@override @override
void onOpenFile(String filePath, {dynamic appendArg}) { void onOpenFile(String filePath, {dynamic appendArg}) {}
// TODO: implement onOpenFile
}
@override @override
void onOpenFolder(String folderPath) { void onOpenFolder(String folderPath) {}
// TODO: implement onOpenFolder
}
@override @override
void onDropOutlineNode(OutlineNode node) { void onDropOutlineNode(OutlineNode node) {
if (unMatchMap[node.value]?.contains(selectedOperation) ?? false) {
Logger().error('当前节点不支持操作: $selectedOperation');
return;
}
members.add(node); members.add(node);
notifyListeners(); notifyListeners();
} }

14
win_text_editor/lib/modules/code_creater/widgets/code_creater_view.dart

@ -21,7 +21,6 @@ class _CodeCreaterViewState extends State<CodeCreaterView> {
bool _isControllerFromTabManager = false; bool _isControllerFromTabManager = false;
final TextEditingController _codeController = TextEditingController(); final TextEditingController _codeController = TextEditingController();
final List<String> operations = ['逻辑服务', '逻辑函数', '原子服务', '原子函数']; final List<String> operations = ['逻辑服务', '逻辑函数', '原子服务', '原子函数'];
String? _selectedOperation = '原子函数';
get tabManager => Provider.of<TabItemsController>(context, listen: false); get tabManager => Provider.of<TabItemsController>(context, listen: false);
@ -87,7 +86,7 @@ class _CodeCreaterViewState extends State<CodeCreaterView> {
onNodeDropped: (node) => _controller.onDropOutlineNode(node), onNodeDropped: (node) => _controller.onDropOutlineNode(node),
child: OperationRadioSection( child: OperationRadioSection(
operations: operations, operations: operations,
selectedOperation: _selectedOperation, selectedOperation: _controller.selectedOperation,
onOperationSelected: _selectOperation, onOperationSelected: _selectOperation,
), ),
), ),
@ -136,17 +135,16 @@ class _CodeCreaterViewState extends State<CodeCreaterView> {
} }
void _selectOperation(String? operation) { void _selectOperation(String? operation) {
if (operation == null || operation.isEmpty) {
return;
}
setState(() { setState(() {
_selectedOperation = operation; _controller.selectedOperation = operation;
_updateDisplay(); _updateDisplay();
}); });
} }
void _updateDisplay() { void _updateDisplay() {
if (_selectedOperation != null) { _codeController.text = _controller.genCodeString([_controller.selectedOperation!]) ?? '';
_codeController.text = _controller.genCodeString([_selectedOperation!]) ?? '';
} else {
_codeController.text = '';
}
} }
} }

14
win_text_editor/lib/modules/code_creater/widgets/node_table.dart

@ -2,6 +2,7 @@ import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pluto_grid/pluto_grid.dart'; import 'package:pluto_grid/pluto_grid.dart';
import 'package:win_text_editor/framework/common/constants.dart';
import 'package:win_text_editor/modules/outline/models/outline_node.dart'; import 'package:win_text_editor/modules/outline/models/outline_node.dart';
import 'package:win_text_editor/shared/components/my_pluto_column.dart'; import 'package:win_text_editor/shared/components/my_pluto_column.dart';
import 'package:win_text_editor/shared/components/my_pluto_configuration.dart'; import 'package:win_text_editor/shared/components/my_pluto_configuration.dart';
@ -222,13 +223,14 @@ class NodeTableState extends State<NodeTable> {
List<String> _getOptions(String type) { List<String> _getOptions(String type) {
switch (type) { switch (type) {
case 'Atom': case Constants.atomFunction:
case 'Business': case Constants.atomService:
case Constants.business:
return ['普通调用', '事务调用']; return ['普通调用', '事务调用'];
case 'UFTTable': case Constants.uftTable:
return ['遍历记录', '获取记录', '插入记录', '修改记录', '删除记录']; return ['获取记录', '遍历记录', '插入记录', '修改记录', '删除记录'];
case 'Component': case Constants.component:
return ['遍历组件', '获取组件', '插入组件', '修改组件', '尾部插入组件']; return ['获取组件', '遍历组件', '插入组件', '修改组件', '尾部插入组件'];
default: default:
return ['']; // return ['']; //
} }

5
win_text_editor/lib/modules/outline/models/code_partner.dart

@ -1,4 +1,5 @@
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'package:win_text_editor/framework/common/constants.dart';
import 'package:win_text_editor/modules/outline/models/outline_node.dart'; import 'package:win_text_editor/modules/outline/models/outline_node.dart';
import 'package:win_text_editor/modules/outline/services/component_service.dart'; import 'package:win_text_editor/modules/outline/services/component_service.dart';
import 'package:win_text_editor/modules/outline/services/uft_object_service.dart'; import 'package:win_text_editor/modules/outline/services/uft_object_service.dart';
@ -13,14 +14,14 @@ class CodePartner {
String? name; String? name;
List<String> fields = []; List<String> fields = [];
switch (node.value) { switch (node.value) {
case "UFTTable": case Constants.uftTable:
final List<String>? values = UftObjectService.uftObjectMap[node.title]; final List<String>? values = UftObjectService.uftObjectMap[node.title];
if (values != null && values.isNotEmpty) { if (values != null && values.isNotEmpty) {
name = path.basenameWithoutExtension(values[0]); name = path.basenameWithoutExtension(values[0]);
fields.addAll(values.sublist(1)); fields.addAll(values.sublist(1));
} }
break; break;
case "Component": case Constants.component:
name = node.name; name = node.name;
final List<String>? values = ComponentService.componentFieldMap[node.name]; final List<String>? values = ComponentService.componentFieldMap[node.name];
if (values != null && values.isNotEmpty) { if (values != null && values.isNotEmpty) {

2
win_text_editor/lib/modules/outline/models/outline_node.dart

@ -40,7 +40,7 @@ class OutlineNode implements TreeNode {
List<OutlineNode>? children, List<OutlineNode>? children,
this.title = "", this.title = "",
}) : _children = children ?? [] { }) : _children = children ?? [] {
id = DateTime.now().microsecondsSinceEpoch.toRadixString(36) + value.hashCode.toRadixString(36); id = DateTime.now().microsecondsSinceEpoch.toRadixString(36) + title.hashCode.toRadixString(36);
} }
OutlineNode copyWith({bool? isExpanded, List<OutlineNode>? children}) { OutlineNode copyWith({bool? isExpanded, List<OutlineNode>? children}) {

24
win_text_editor/lib/modules/outline/services/component_service.dart

@ -1,5 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/widgets.dart';
import 'package:win_text_editor/framework/common/constants.dart';
import 'package:win_text_editor/framework/controllers/logger.dart'; import 'package:win_text_editor/framework/controllers/logger.dart';
import 'package:win_text_editor/modules/outline/models/outline_node.dart'; import 'package:win_text_editor/modules/outline/models/outline_node.dart';
import 'package:xml/xml.dart'; import 'package:xml/xml.dart';
@ -44,7 +46,7 @@ class ComponentService {
} }
// //
static Future<Map<String, String>> matchComponent(String fieldName) async { static Map<String, String> matchComponent(String fieldName) {
Map<String, String> matchComponents = {}; Map<String, String> matchComponents = {};
componentFieldMap.forEach((key, value) { componentFieldMap.forEach((key, value) {
@ -54,13 +56,19 @@ class ComponentService {
return matchComponents; return matchComponents;
} }
static Future<void> loadComponent(String? fieldName, OutlineNode parentNode) async { static void loadComponent(String? fieldName, OutlineNode parentNode) {
if (fieldName == null || fieldName.isEmpty) return; if (fieldName == null || fieldName.isEmpty) return;
final matches = await matchComponent(fieldName); final matches = matchComponent(fieldName);
matches.forEach( matches.forEach(
(key, value) => parentNode.children.add( (key, value) => parentNode.children.add(
OutlineNode(name: key, title: value, value: 'Component', isDirectory: false, depth: 4), OutlineNode(
name: key,
title: value,
value: Constants.component,
isDirectory: false,
depth: 4,
),
), ),
); );
} }
@ -70,7 +78,13 @@ class ComponentService {
componentFieldMap.forEach((key, value) { componentFieldMap.forEach((key, value) {
if (key.contains(searchQuery) || value[0].contains(searchQuery)) { if (key.contains(searchQuery) || value[0].contains(searchQuery)) {
componentNodes.add( componentNodes.add(
OutlineNode(name: key, title: value[0], value: 'Component', isDirectory: false, depth: 4), OutlineNode(
name: key,
title: value[0],
value: Constants.component,
isDirectory: false,
depth: 4,
),
); );
} }
}); });

64
win_text_editor/lib/modules/outline/services/functions_service.dart

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:win_text_editor/framework/common/constants.dart';
import 'package:win_text_editor/framework/controllers/logger.dart'; import 'package:win_text_editor/framework/controllers/logger.dart';
import 'package:win_text_editor/modules/outline/models/outline_node.dart'; import 'package:win_text_editor/modules/outline/models/outline_node.dart';
import 'package:win_text_editor/modules/outline/services/component_service.dart'; import 'package:win_text_editor/modules/outline/services/component_service.dart';
@ -10,12 +11,14 @@ class FunctionsService {
static Map<String, List<String>> uftbusinessMap = {}; static Map<String, List<String>> uftbusinessMap = {};
// //
static Map<String, List<String>> uftatomMap = {}; static Map<String, List<String>> uftatomserviceMap = {};
static Map<String, List<String>> uftatomFunctionMap = {};
static Future<void> initFunctionsMap(String rootPath) async { static Future<void> initFunctionsMap(String rootPath) async {
await _initUftMap('uftbusiness', rootPath, uftbusinessMap, ['.uftfunction']); await _initUftMap('uftbusiness', rootPath, uftbusinessMap, ['.uftfunction']);
await _initUftMap('uftatom', rootPath, uftatomMap, ['.uftatomfunction', '.uftatomservice']); await _initUftMap('uftatom', rootPath, uftatomserviceMap, ['.uftatomservice']);
await _initUftMap('uftatom', rootPath, uftatomFunctionMap, ['.uftatomfunction']);
} }
static Future<void> _initUftMap( static Future<void> _initUftMap(
@ -78,17 +81,35 @@ class FunctionsService {
} }
} }
// //
static Future<void> loadAtom(String? fieldName, OutlineNode parentNode) async { static void loadAtomService(String? fieldName, OutlineNode parentNode) {
if (fieldName == null || fieldName.isEmpty) return; if (fieldName == null || fieldName.isEmpty) return;
uftatomMap.forEach((key, value) { uftatomserviceMap.forEach((key, value) {
if (value.contains(fieldName)) { if (value.contains(fieldName)) {
parentNode.children.add( parentNode.children.add(
OutlineNode( OutlineNode(
name: value[0], // name: value[0], //
title: key, title: key,
value: 'Atom', value: Constants.atomService,
isDirectory: false, //
depth: 4,
),
);
}
});
}
static Future<void> loadAtomFunction(String? fieldName, OutlineNode parentNode) async {
if (fieldName == null || fieldName.isEmpty) return;
uftatomFunctionMap.forEach((key, value) {
if (value.contains(fieldName)) {
parentNode.children.add(
OutlineNode(
name: value[0], //
title: key,
value: Constants.atomFunction,
isDirectory: false, // isDirectory: false, //
depth: 4, depth: 4,
), ),
@ -98,7 +119,7 @@ class FunctionsService {
} }
// //
static Future<void> loadBusiness(String? fieldName, OutlineNode parentNode) async { static void loadBusiness(String? fieldName, OutlineNode parentNode) {
if (fieldName == null || fieldName.isEmpty) return; if (fieldName == null || fieldName.isEmpty) return;
uftbusinessMap.forEach((key, value) { uftbusinessMap.forEach((key, value) {
@ -107,7 +128,7 @@ class FunctionsService {
OutlineNode( OutlineNode(
name: value[0], // name: value[0], //
title: key, title: key,
value: 'Atom', value: Constants.business,
isDirectory: false, // isDirectory: false, //
depth: 4, depth: 4,
), ),
@ -124,7 +145,26 @@ class FunctionsService {
OutlineNode( OutlineNode(
name: value[0], // name: value[0], //
title: key, title: key,
value: 'Atom', value: Constants.business,
isDirectory: false, //
depth: 4,
),
);
}
});
return nodes;
}
static List<OutlineNode> searchAtomServices(String searchQuery) {
final List<OutlineNode> nodes = [];
uftatomserviceMap.forEach((key, value) {
if (key.contains(searchQuery)) {
nodes.add(
OutlineNode(
name: value[0], //
title: key,
value: Constants.atomService,
isDirectory: false, // isDirectory: false, //
depth: 4, depth: 4,
), ),
@ -135,15 +175,15 @@ class FunctionsService {
return nodes; return nodes;
} }
static List<OutlineNode> searchAtoms(String searchQuery) { static List<OutlineNode> searchAtomFunctions(String searchQuery) {
final List<OutlineNode> nodes = []; final List<OutlineNode> nodes = [];
uftatomMap.forEach((key, value) { uftatomFunctionMap.forEach((key, value) {
if (key.contains(searchQuery)) { if (key.contains(searchQuery)) {
nodes.add( nodes.add(
OutlineNode( OutlineNode(
name: value[0], // name: value[0], //
title: key, title: key,
value: 'Atom', value: Constants.atomFunction,
isDirectory: false, // isDirectory: false, //
depth: 4, depth: 4,
), ),

32
win_text_editor/lib/modules/outline/services/outline_service.dart

@ -2,6 +2,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:jieba_flutter/analysis/jieba_segmenter.dart'; import 'package:jieba_flutter/analysis/jieba_segmenter.dart';
import 'package:win_text_editor/framework/common/constants.dart';
import 'package:win_text_editor/modules/outline/models/outline_node.dart'; import 'package:win_text_editor/modules/outline/models/outline_node.dart';
import 'package:win_text_editor/modules/outline/services/component_service.dart'; import 'package:win_text_editor/modules/outline/services/component_service.dart';
import 'package:win_text_editor/modules/outline/services/functions_service.dart'; import 'package:win_text_editor/modules/outline/services/functions_service.dart';
@ -253,7 +254,7 @@ class OutlineService {
final List<OutlineNode> uftObjectNodes = UftObjectService.searchUftObjects(searchQuery); final List<OutlineNode> uftObjectNodes = UftObjectService.searchUftObjects(searchQuery);
if (uftObjectNodes.isNotEmpty) { if (uftObjectNodes.isNotEmpty) {
final uftObjectActionNode = OutlineNode( final uftObjectActionNode = OutlineNode(
name: 'UFTTable', name: Constants.uftTable,
title: 'UFT对象(${uftObjectNodes.length})', title: 'UFT对象(${uftObjectNodes.length})',
value: 'virtualNode', value: 'virtualNode',
isDirectory: true, isDirectory: true,
@ -267,7 +268,7 @@ class OutlineService {
final List<OutlineNode> componentNodes = ComponentService.searchComponents(searchQuery); final List<OutlineNode> componentNodes = ComponentService.searchComponents(searchQuery);
if (componentNodes.isNotEmpty) { if (componentNodes.isNotEmpty) {
final componentActionNode = OutlineNode( final componentActionNode = OutlineNode(
name: 'Component', name: Constants.component,
title: '标准组件(${componentNodes.length})', title: '标准组件(${componentNodes.length})',
value: 'virtualNode', value: 'virtualNode',
isDirectory: true, isDirectory: true,
@ -281,8 +282,8 @@ class OutlineService {
final List<OutlineNode> businessNodes = FunctionsService.searchBusiness(searchQuery); final List<OutlineNode> businessNodes = FunctionsService.searchBusiness(searchQuery);
if (businessNodes.isNotEmpty) { if (businessNodes.isNotEmpty) {
final businessActionNode = OutlineNode( final businessActionNode = OutlineNode(
name: 'Business', name: Constants.business,
title: "业务(${businessNodes.length})", title: "业务函数(${businessNodes.length})",
value: 'virtualNode', value: 'virtualNode',
isDirectory: true, isDirectory: true,
depth: 3, depth: 3,
@ -292,16 +293,29 @@ class OutlineService {
} }
// //
final List<OutlineNode> atomNodes = FunctionsService.searchAtoms(searchQuery); final List<OutlineNode> atomServiceNodes = FunctionsService.searchAtomServices(searchQuery);
if (atomNodes.isNotEmpty) { if (atomServiceNodes.isNotEmpty) {
final atomActionNode = OutlineNode( final atomActionNode = OutlineNode(
name: 'Atom', name: Constants.atomService,
title: '原子(${atomNodes.length})', title: '原子服务(${atomServiceNodes.length})',
value: 'virtualNode', value: 'virtualNode',
isDirectory: true, isDirectory: true,
depth: 3, depth: 3,
); );
atomActionNode.children.addAll(atomNodes); atomActionNode.children.addAll(atomServiceNodes);
virtualNode.children.add(atomActionNode);
}
final List<OutlineNode> atomFunctionNodes = FunctionsService.searchAtomFunctions(searchQuery);
if (atomFunctionNodes.isNotEmpty) {
final atomActionNode = OutlineNode(
name: Constants.atomFunction,
title: '原子函数(${atomFunctionNodes.length})',
value: 'virtualNode',
isDirectory: true,
depth: 3,
);
atomActionNode.children.addAll(atomFunctionNodes);
virtualNode.children.add(atomActionNode); virtualNode.children.add(atomActionNode);
} }

31
win_text_editor/lib/modules/outline/services/std_field_service.dart

@ -1,5 +1,6 @@
import 'dart:io'; import 'dart:io';
import 'package:win_text_editor/framework/common/constants.dart';
import 'package:win_text_editor/framework/controllers/logger.dart'; import 'package:win_text_editor/framework/controllers/logger.dart';
import 'package:win_text_editor/modules/outline/models/outline_node.dart'; import 'package:win_text_editor/modules/outline/models/outline_node.dart';
import 'package:win_text_editor/modules/outline/services/component_service.dart'; import 'package:win_text_editor/modules/outline/services/component_service.dart';
@ -10,10 +11,11 @@ import 'package:xml/xml.dart';
class StdFieldService { class StdFieldService {
// ignore: constant_identifier_names // ignore: constant_identifier_names
static const Map<String, String> FIELD_ACTIONS = { static const Map<String, String> FIELD_ACTIONS = {
"UFTTable": "UFT对象", Constants.uftTable: "UFT对象",
"Component": "标准组件", Constants.component: "标准组件",
"Business": "业务层", Constants.business: "业务函数",
"Atom": "原子层", Constants.atomService: "原子服务",
Constants.atomFunction: "原子函数",
}; };
// //
static Map<String, String> stdfieldMap = {}; static Map<String, String> stdfieldMap = {};
@ -42,19 +44,22 @@ class StdFieldService {
} }
// //
static Future<void> _loadFieldActions(OutlineNode dirNode) async { static void _loadFieldActions(OutlineNode dirNode) {
switch (dirNode.name) { switch (dirNode.name) {
case 'UFTTable': case Constants.uftTable:
await UftObjectService.loadUftObject(dirNode.value, dirNode); UftObjectService.loadUftObject(dirNode.value, dirNode);
break; break;
case 'Component': case Constants.component:
await ComponentService.loadComponent(dirNode.value, dirNode); ComponentService.loadComponent(dirNode.value, dirNode);
break; break;
case 'Business': case Constants.business:
await FunctionsService.loadBusiness(dirNode.value, dirNode); FunctionsService.loadBusiness(dirNode.value, dirNode);
break; break;
case 'Atom': case Constants.atomService:
await FunctionsService.loadAtom(dirNode.value, dirNode); FunctionsService.loadAtomService(dirNode.value, dirNode);
break;
case Constants.atomFunction:
FunctionsService.loadAtomFunction(dirNode.value, dirNode);
break; break;
default: default:
Logger().error("操作节点类型不支持: ${dirNode.value}"); Logger().error("操作节点类型不支持: ${dirNode.value}");

13
win_text_editor/lib/modules/outline/services/uft_object_service.dart

@ -1,6 +1,7 @@
import 'dart:io'; import 'dart:io';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'package:win_text_editor/framework/common/constants.dart';
import 'package:win_text_editor/framework/controllers/logger.dart'; import 'package:win_text_editor/framework/controllers/logger.dart';
import 'package:win_text_editor/modules/outline/models/outline_node.dart'; import 'package:win_text_editor/modules/outline/models/outline_node.dart';
import 'package:xml/xml.dart'; import 'package:xml/xml.dart';
@ -60,7 +61,7 @@ class UftObjectService {
} }
// UFT对象 // UFT对象
static Future<void> loadUftObject(String? fieldName, OutlineNode parentNode) async { static void loadUftObject(String? fieldName, OutlineNode parentNode) {
if (fieldName == null || fieldName.isEmpty) return; if (fieldName == null || fieldName.isEmpty) return;
uftObjectMap.forEach((key, value) { uftObjectMap.forEach((key, value) {
@ -69,7 +70,7 @@ class UftObjectService {
OutlineNode( OutlineNode(
name: value[0], name: value[0],
title: key, title: key,
value: 'UFTTable', value: Constants.uftTable,
isDirectory: false, // isDirectory: false, //
depth: 4, depth: 4,
), ),
@ -85,7 +86,13 @@ class UftObjectService {
if (key.contains(searchQuery) || if (key.contains(searchQuery) ||
path.basenameWithoutExtension(value[0]).contains(searchQuery)) { path.basenameWithoutExtension(value[0]).contains(searchQuery)) {
searchNodes.add( searchNodes.add(
OutlineNode(name: value[0], title: key, value: 'UFTTable', isDirectory: false, depth: 4), OutlineNode(
name: value[0],
title: key,
value: Constants.uftTable,
isDirectory: false,
depth: 4,
),
); );
} }
}); });

10
win_text_editor/lib/modules/outline/widgets/outline_explorer.dart

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:win_text_editor/framework/common/constants.dart';
import 'package:win_text_editor/framework/controllers/file_provider.dart'; import 'package:win_text_editor/framework/controllers/file_provider.dart';
import 'package:win_text_editor/framework/services/file_path_manager.dart'; import 'package:win_text_editor/framework/services/file_path_manager.dart';
import 'package:win_text_editor/modules/outline/controllers/outline_provider.dart'; import 'package:win_text_editor/modules/outline/controllers/outline_provider.dart';
@ -172,14 +173,15 @@ class _OutlineExplorerState extends State<OutlineExplorer> {
return; return;
} }
switch (outlineNode.value) { switch (outlineNode.value) {
case "UFTTable": case Constants.uftTable:
case "Business": case Constants.business:
case "Atom": case Constants.atomFunction:
case Constants.atomService:
if (widget.onFileDoubleTap != null) { if (widget.onFileDoubleTap != null) {
widget.onFileDoubleTap!(outlineNode.name, null); widget.onFileDoubleTap!(outlineNode.name, null);
} }
break; break;
case "Component": case Constants.component:
if (widget.onFileDoubleTap != null && fileProvider.rootPath != null) { if (widget.onFileDoubleTap != null && fileProvider.rootPath != null) {
widget.onFileDoubleTap!( widget.onFileDoubleTap!(
'${fileProvider.rootPath}\\metadata\\component.xml', '${fileProvider.rootPath}\\metadata\\component.xml',

11
win_text_editor/lib/shared/components/code_generation_components.dart

@ -1,6 +1,7 @@
// shared/components/code_generation_components.dart // shared/components/code_generation_components.dart
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:win_text_editor/framework/common/constants.dart';
import 'package:win_text_editor/modules/outline/models/outline_node.dart'; import 'package:win_text_editor/modules/outline/models/outline_node.dart';
class CodeGenerationRadioItem extends StatelessWidget { class CodeGenerationRadioItem extends StatelessWidget {
@ -118,11 +119,13 @@ class CodeGenerationSection extends StatelessWidget {
if (outlineNode.depth < 3) { if (outlineNode.depth < 3) {
return false; return false;
} }
switch (outlineNode.value) { switch (outlineNode.value) {
case "UFTTable": case Constants.uftTable:
case "Business": case Constants.business:
case "Atom": case Constants.atomFunction:
case "Component": case Constants.atomService:
case Constants.component:
return true; // return true; //
default: default:
return false; // return false; //

Loading…
Cancel
Save