-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#319) Settings: add the Developer Mode
- Loading branch information
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/rider/main/kotlin/me/fornever/avaloniarider/idea/editor/actions/DebugPreviewerAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package me.fornever.avaloniarider.idea.editor.actions | ||
|
||
import com.intellij.openapi.actionSystem.ActionUpdateThread | ||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import me.fornever.avaloniarider.idea.settings.AvaloniaApplicationSettings | ||
|
||
class DebugPreviewerAction : AnAction() { | ||
override fun getActionUpdateThread() = ActionUpdateThread.BGT | ||
override fun update(e: AnActionEvent) { | ||
val presentation = e.presentation | ||
if (!AvaloniaApplicationSettings.getInstance().isDeveloperModeEnabled) { | ||
presentation.isEnabledAndVisible = false | ||
return | ||
} | ||
|
||
presentation.isEnabledAndVisible = true | ||
} | ||
|
||
override fun actionPerformed(p0: AnActionEvent) { | ||
|
||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/rider/main/kotlin/me/fornever/avaloniarider/idea/settings/AvaloniaApplicationSettings.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package me.fornever.avaloniarider.idea.settings | ||
|
||
import com.intellij.openapi.components.BaseState | ||
import com.intellij.openapi.components.Service | ||
import com.intellij.openapi.components.SimplePersistentStateComponent | ||
import com.intellij.openapi.components.State | ||
import com.intellij.openapi.components.Storage | ||
import com.intellij.openapi.components.service | ||
|
||
@State(name = "AvaloniaRider", storages = [Storage("AvaloniaRider.xml")]) | ||
@Service | ||
class AvaloniaApplicationSettings : SimplePersistentStateComponent<AvaloniaApplicationState>( | ||
AvaloniaApplicationState() | ||
) { | ||
companion object { | ||
fun getInstance(): AvaloniaApplicationSettings = service() | ||
} | ||
|
||
val isDeveloperModeEnabled: Boolean | ||
get() = state.isDeveloperModeEnabled | ||
} | ||
|
||
class AvaloniaApplicationState : BaseState() { | ||
var isDeveloperModeEnabled by property(false) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters