MCPcopy Create free account
hub / github.com/DTStack/molecule / SearchController

Class SearchController

src/controller/search/search.tsx:42–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41@singleton()
42export class SearchController extends Controller implements ISearchController {
43 private readonly activityBarService: IActivityBarService;
44 private readonly sidebarService: ISidebarService;
45 private readonly searchService: ISearchService;
46 private readonly builtinService: IBuiltinService;
47
48 constructor() {
49 super();
50 this.activityBarService = container.resolve(ActivityBarService);
51 this.sidebarService = container.resolve(SidebarService);
52 this.searchService = container.resolve(SearchService);
53 this.builtinService = container.resolve(BuiltinService);
54 }
55
56 public initView() {
57 const {
58 builtInSearchActivityItem,
59 builtInHeaderToolbar,
60 builtInSearchAddons,
61 builtInReplaceAddons,
62 } = this.builtinService.getModules();
63 if (builtInSearchActivityItem) {
64 const SearchPanelView = connect(
65 this.searchService,
66 SearchPanel,
67 this
68 );
69
70 const searchSidePane = {
71 id: builtInSearchActivityItem.id,
72 title: 'SEARCH',
73 render() {
74 return <SearchPanelView />;
75 },
76 };
77
78 this.searchService.setState({
79 headerToolBar: builtInHeaderToolbar || [],
80 searchAddons: builtInSearchAddons || [],
81 replaceAddons: builtInReplaceAddons || [],
82 });
83
84 this.sidebarService.add(searchSidePane);
85 this.activityBarService.add(builtInSearchActivityItem);
86 }
87 }
88
89 public validateValue = (
90 value: string,
91 callback: (err: void | Error) => void
92 ) => {
93 const { isRegex } = this.searchService.getState();
94 if (isRegex) {
95 try {
96 new RegExp(value);
97 return callback();
98 } catch (e) {
99 if (e instanceof Error) {

Callers

nothing calls this directly

Calls 11

getStateMethod · 0.80
setValidateInfoMethod · 0.80
setSearchValueMethod · 0.80
setReplaceValueMethod · 0.80
toggleCaseSensitiveMethod · 0.80
toggleWholeWordMethod · 0.80
toggleRegexMethod · 0.80
togglePreserveCaseMethod · 0.80
emitMethod · 0.80
toggleModeMethod · 0.80
getConstantsMethod · 0.65

Tested by

no test coverage detected