From 7de51ce97bb6e61b2301e327a1d0acd702deda1d Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Thu, 2 Feb 2017 15:57:52 +0300 Subject: [PATCH] IDEA-164993 Support for macOS special character (emoji) insertion popover --- .../MacEmojiAndSymbolsInputAction.java | 41 +++++++++++++++++++ .../src/messages/ActionsBundle.properties | 4 +- .../src/idea/PlatformActions.xml | 2 + .../src/keymaps/Mac OS X 10.5+.xml | 4 ++ .../src/keymaps/Mac OS X.xml | 4 ++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 platform/platform-impl/src/com/intellij/ide/actions/MacEmojiAndSymbolsInputAction.java diff --git a/platform/platform-impl/src/com/intellij/ide/actions/MacEmojiAndSymbolsInputAction.java b/platform/platform-impl/src/com/intellij/ide/actions/MacEmojiAndSymbolsInputAction.java new file mode 100644 index 000000000000..2ee46950ef8e --- /dev/null +++ b/platform/platform-impl/src/com/intellij/ide/actions/MacEmojiAndSymbolsInputAction.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2017 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.actionSystem.Presentation; +import com.intellij.openapi.util.SystemInfo; +import com.intellij.ui.mac.foundation.Foundation; +import com.intellij.ui.mac.foundation.ID; + +public class MacEmojiAndSymbolsInputAction extends AnAction { + @Override + public void update(AnActionEvent e) { + Presentation presentation = e.getPresentation(); + presentation.setEnabledAndVisible(SystemInfo.isMac); + presentation.setText("Emoji & Symbols", false); + } + + @Override + public void actionPerformed(AnActionEvent e) { + if (!SystemInfo.isMac) return; + Foundation.executeOnMainThread(false, false, () -> { + ID app = Foundation.invoke("NSApplication", "sharedApplication"); + Foundation.invoke(app, "orderFrontCharacterPalette:", (Object)null); + }); + } +} diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index 93699b7408bc..165569c91132 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -1575,4 +1575,6 @@ action.TabsPlacementNone.text=None action.ToggleDistractionFreeMode.enter=Enter Distraction Free Mode action.ToggleDistractionFreeMode.exit=Exit Distraction Free Mode action.TogglePresentationMode.exit=Exit Presentation Mode -action.TogglePresentationMode.enter=Enter Presentation Mode \ No newline at end of file +action.TogglePresentationMode.enter=Enter Presentation Mode + +action.EmojiAndSymbols.description=Input special characters using macOS system palette \ No newline at end of file diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index dcdc0deb920e..da06a0ffa4e7 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -336,6 +336,8 @@ + + diff --git a/platform/platform-resources/src/keymaps/Mac OS X 10.5+.xml b/platform/platform-resources/src/keymaps/Mac OS X 10.5+.xml index 9701210b5f7e..b7da42d88a01 100644 --- a/platform/platform-resources/src/keymaps/Mac OS X 10.5+.xml +++ b/platform/platform-resources/src/keymaps/Mac OS X 10.5+.xml @@ -589,4 +589,8 @@ + + + + \ No newline at end of file diff --git a/platform/platform-resources/src/keymaps/Mac OS X.xml b/platform/platform-resources/src/keymaps/Mac OS X.xml index 69957d343633..247e1c6255c3 100644 --- a/platform/platform-resources/src/keymaps/Mac OS X.xml +++ b/platform/platform-resources/src/keymaps/Mac OS X.xml @@ -385,4 +385,8 @@ + + + +