mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
toggle distraction free mode action
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* 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.intellij.ide.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.registry.RegistryValue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ToggleDistractionFreeModeAction extends AnAction implements DumbAware {
|
||||
private static final String key = "editor.distraction.free.mode";
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
RegistryValue value = Registry.get(key);
|
||||
boolean selected = value.asBoolean();
|
||||
e.getPresentation().setText(selected ? "Exit Distraction Free Mode" : "Enter Distraction Free Mode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
RegistryValue value = Registry.get(key);
|
||||
value.setValue(!value.asBoolean());
|
||||
EditorFactory.getInstance().refreshAllEditors();
|
||||
}
|
||||
}
|
||||
@@ -797,6 +797,8 @@ action.TogglePresentationMode.text.enter=Enter Presentation mode
|
||||
action.TogglePresentationMode.text.exit=Exit Presentation mode
|
||||
action.TogglePresentationMode.text=Toggle Presentation mode
|
||||
action.TogglePresentationMode.description=Toggle Presentation mode
|
||||
action.ToggleDistractionFreeMode.text=Toggle Distraction Free mode
|
||||
action.ToggleDistractionFreeMode.description=Toggle Distraction Free mode
|
||||
action.ToggleFullScreen.text.enter=Enter Full Screen
|
||||
action.ToggleFullScreen.text.exit=Exit Full Screen
|
||||
action.ToggleFullScreen.text=Toggle Full Screen mode
|
||||
|
||||
@@ -314,6 +314,7 @@
|
||||
<group id="ToggleFullScreenGroup">
|
||||
<separator/>
|
||||
<action id="TogglePresentationMode" class="com.intellij.ide.actions.TogglePresentationModeAction"/>
|
||||
<action id="ToggleDistractionFreeMode" class="com.intellij.ide.actions.ToggleDistractionFreeModeAction"/>
|
||||
<action id="ToggleFullScreen" class="com.intellij.ide.actions.ToggleFullScreenAction"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user