IDEA-164993 Support for macOS special character (emoji) insertion popover

This commit is contained in:
Dmitry Batrak
2017-02-02 15:59:03 +03:00
parent 85885990b7
commit 7de51ce97b
5 changed files with 54 additions and 1 deletions
@@ -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);
});
}
}
@@ -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
action.TogglePresentationMode.enter=Enter Presentation Mode
action.EmojiAndSymbols.description=Input special characters using macOS system palette
@@ -336,6 +336,8 @@
</group>
</group>
<reference ref="TemplateParametersNavigation"/>
<separator/>
<action id="EmojiAndSymbols" class="com.intellij.ide.actions.MacEmojiAndSymbolsInputAction"/>
</group>
<!-- View -->
@@ -589,4 +589,8 @@
<action id="EditorMatchBrace">
<keyboard-shortcut first-keystroke="control M" replace-all="true"/>
</action>
<action id="EmojiAndSymbols">
<keyboard-shortcut first-keystroke="control meta SPACE"/>
</action>
</keymap>
@@ -385,4 +385,8 @@
<keyboard-shortcut first-keystroke="meta alt MULTIPLY" second-keystroke="5"/>
<keyboard-shortcut first-keystroke="meta alt MULTIPLY" second-keystroke="NUMPAD5"/>
</action>
<action id="EmojiAndSymbols">
<keyboard-shortcut first-keystroke="control meta SPACE"/>
</action>
</keymap>