Skip to content

Commit

Permalink
ACT & UI: Add "Show Setting" action for Cargo
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Chernyavsky authored and mchernyavsky committed Sep 13, 2019
1 parent 2a811cc commit 320ef03
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/kotlin/org/rust/ide/actions/CargoEditSettingsAction.kt
@@ -0,0 +1,23 @@
/*
* Use of this source code is governed by the MIT license that can be
* found in the LICENSE file.
*/

package org.rust.ide.actions

import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.options.ShowSettingsUtil
import com.intellij.openapi.project.DumbAware

class CargoEditSettingsAction : AnAction(), DumbAware {

override fun update(e: AnActionEvent) {
super.update(e)
e.presentation.isEnabledAndVisible = e.project != null
}

override fun actionPerformed(e: AnActionEvent) {
ShowSettingsUtil.getInstance().showSettingsDialog(e.project, "Cargo")
}
}
8 changes: 8 additions & 0 deletions src/main/resources/META-INF/core.xml
Expand Up @@ -980,6 +980,12 @@
icon="AllIcons.Actions.Collapseall"
use-shortcut-of="CollapseAll"/>

<action id="Cargo.ShowSettings"
class="org.rust.ide.actions.CargoEditSettingsAction" text="Cargo Settings"
description="Edit Cargo settings for the current project"
icon="AllIcons.General.Settings">
</action>

<group id="Rust.Cargo">
<reference id="Cargo.RefreshCargoProject"/>
<reference id="Cargo.AttachCargoProject"/>
Expand All @@ -991,6 +997,8 @@
<separator/>
<reference id="Cargo.ExpandAll"/>
<reference id="Cargo.CollapseAll"/>
<separator/>
<reference id="Cargo.ShowSettings"/>
</group>

</actions>
Expand Down

0 comments on commit 320ef03

Please sign in to comment.