|
|
|
@ -71,7 +71,7 @@ const css = csjs` |
|
|
|
|
const profile = { |
|
|
|
|
name: 'pluginManager', |
|
|
|
|
displayName: 'Plugin manager', |
|
|
|
|
methods: [], |
|
|
|
|
methods: ['registerFlattener'], |
|
|
|
|
events: [], |
|
|
|
|
icon: 'assets/img/pluginManager.webp', |
|
|
|
|
description: 'Start/stop services, modules and plugins', |
|
|
|
@ -102,6 +102,41 @@ class PluginManagerComponent extends ViewPlugin { |
|
|
|
|
return this.appManager.actives.includes(name) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async registerFlattener (event) { |
|
|
|
|
if (!this.appManager.isActive('solidity')) { await this.appManager.activatePlugin('solidity') } |
|
|
|
|
const compiledSuccessfully = await this.call('solidity', 'compileFile', event) |
|
|
|
|
const reporCompileIssue = () => { |
|
|
|
|
this.call('fileManager', 'open', event.path[0]) |
|
|
|
|
addToolTip('Cannot flatten the file. Please make sure it is compiling successfully.') |
|
|
|
|
this.call('menuicons', 'select', 'solidity') |
|
|
|
|
} |
|
|
|
|
setTimeout(async () => { |
|
|
|
|
if (compiledSuccessfully) { |
|
|
|
|
const res = await this.call('solidity', 'getCompilationResult') |
|
|
|
|
if (!res) { |
|
|
|
|
reporCompileIssue() |
|
|
|
|
} else { |
|
|
|
|
this.call('menuicons', 'select', 'flattener1') |
|
|
|
|
await this.call('flattener1', 'flatten', res) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
reporCompileIssue() |
|
|
|
|
} |
|
|
|
|
}, 1000) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onActivation () { |
|
|
|
|
this.call('filePanel', 'registerContextMenuItem', { |
|
|
|
|
id: 'pluginManager', |
|
|
|
|
name: 'registerFlattener', |
|
|
|
|
label: 'Flatten', |
|
|
|
|
type: [], |
|
|
|
|
extension: ['.sol'], |
|
|
|
|
path: [], |
|
|
|
|
pattern: [] |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
activateP(name) { |
|
|
|
|
this.appManager.activatePlugin(name) |
|
|
|
|
_paq.push(['trackEvent', 'manager', 'activate', name]) |
|
|
|
|