Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
preview editor: open settings from toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
YannCebron committed Sep 24, 2021
1 parent f7ef1e0 commit c817009
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
## [Unreleased]
### Added

- Open Settings from preview editor toolbar

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@

package com.yanncebron.intellipikchr.editor

import com.intellij.openapi.actionSystem.ActionGroup
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.fileEditor.TextEditor
import com.intellij.openapi.fileEditor.TextEditorWithPreview

class PikchrEditorWithPreview(editor: TextEditor, preview: PikchrPreviewFileEditor) :
TextEditorWithPreview(editor, preview, "Pikchr Split Editor", Layout.SHOW_EDITOR_AND_PREVIEW)
TextEditorWithPreview(editor, preview, "Pikchr Split Editor", Layout.SHOW_EDITOR_AND_PREVIEW) {
override fun createRightToolbarActionGroup(): ActionGroup? {
return ActionManager.getInstance().getAction("PikchrEditorRightToolbarGroup") as ActionGroup?
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2021 The Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.yanncebron.intellipikchr.settings

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.options.ShowSettingsUtil
import com.intellij.openapi.project.DumbAwareAction

class IntelliPikchrOpenSettingsAction : DumbAwareAction() {

override fun actionPerformed(e: AnActionEvent) {
ShowSettingsUtil.getInstance().showSettingsDialog(
e.project,
IntelliPikchrSettingsConfigurable::class.java
)
}
}
8 changes: 8 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,12 @@
<listener topic="com.intellij.ide.ui.LafManagerListener"
class="com.yanncebron.intellipikchr.editor.PikchrEditorLafListener"/>
</applicationListeners>

<actions>
<group id="PikchrEditorRightToolbarGroup">
<action id="PikchrOpenSettings"
class="com.yanncebron.intellipikchr.settings.IntelliPikchrOpenSettingsAction"
icon="AllIcons.General.Settings"/>
</group>
</actions>
</idea-plugin>
3 changes: 3 additions & 0 deletions src/main/resources/messages/IntelliPikchr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ settings.preview.adapt.dark.color=Adapt to dark color scheme
settings.preview.adapt.dark.color.comment=Automatically invert colors to make them better visible
settings.preview.custom.css=Custom CSS:
settings.preview.custom.css.comment=Specify custom CSS to style preview

action.PikchrOpenSettings.text=Settings
action.PikchrOpenSettings.description=Open IntelliPikchr settings

0 comments on commit c817009

Please sign in to comment.