diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ToggleDistractionFreeModeAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ToggleDistractionFreeModeAction.java new file mode 100644 index 000000000000..52b45132db29 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/ide/actions/ToggleDistractionFreeModeAction.java @@ -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(); + } +} diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index ecc6739bae32..b2d8090fd0a1 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -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 diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 534ee28fe40b..47ed5ff657f1 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -314,6 +314,7 @@ +