Commit ebbebb41 authored by lianahus's avatar lianahus

added save to the action (wip)

parent 4e9299bd
...@@ -105,10 +105,10 @@ class PluginManagerComponent extends ViewPlugin { ...@@ -105,10 +105,10 @@ class PluginManagerComponent extends ViewPlugin {
async registerFlattener (event) { async registerFlattener (event) {
if (!this.appManager.isActive('solidity')) { await this.appManager.activatePlugin('solidity') } if (!this.appManager.isActive('solidity')) { await this.appManager.activatePlugin('solidity') }
const compiledSuccessfully = await this.call('solidity', 'compileFile', event) const compiledSuccessfully = await this.call('solidity', 'compileFile', event)
const reporCompileIssue = () => { const reporCompileIssue = async () => {
this.call('fileManager', 'open', event.path[0]) this.call('fileManager', 'open', event.path[0])
addToolTip('Cannot flatten the file. Please make sure it is compiling successfully.') addToolTip('Cannot flatten the file. Please make sure it is compiling successfully.')
this.call('menuicons', 'select', 'solidity') await this.call('menuicons', 'select', 'solidity')
} }
setTimeout(async () => { setTimeout(async () => {
if (compiledSuccessfully) { if (compiledSuccessfully) {
...@@ -116,8 +116,9 @@ class PluginManagerComponent extends ViewPlugin { ...@@ -116,8 +116,9 @@ class PluginManagerComponent extends ViewPlugin {
if (!res) { if (!res) {
reporCompileIssue() reporCompileIssue()
} else { } else {
this.call('menuicons', 'select', 'flattener1') await this.call('menuicons', 'select', 'flattener1')
await this.call('flattener1', 'flatten', res) const path = await this.call('flattener1', 'flattenAndSave', res)
await this.call('fileManager', 'open', path)
} }
} else { } else {
reporCompileIssue() reporCompileIssue()
...@@ -125,8 +126,8 @@ class PluginManagerComponent extends ViewPlugin { ...@@ -125,8 +126,8 @@ class PluginManagerComponent extends ViewPlugin {
}, 1000) }, 1000)
} }
onActivation () { async onActivation () {
this.call('filePanel', 'registerContextMenuItem', { await this.call('filePanel', 'registerContextMenuItem', {
id: 'pluginManager', id: 'pluginManager',
name: 'registerFlattener', name: 'registerFlattener',
label: 'Flatten', label: 'Flatten',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment