/** * On right-click on an emote, open the appropriate context menu. * * @param e */ private void openContextMenu(MouseEvent e) { if (e.isPopupTrigger()) { EmoticonImage emote = ((EmoteLabel)e.getSource()).emote; JPopupMenu m = new EmoteContextMenu(emote, contextMenuListener); m.show(e.getComponent(), e.getX(), e.getY()); } }
addItem("cheer","Cheering Emote"); } else { addItem("code", StringUtil.shortenTo(emote.code, 40, 28)); if (emote.type == Emoticon.Type.EMOJI && emote.stringId != null) { addItem("codeEmoji", emote.stringId); addItem("emoteImage", emoteImage.getSizeString(), ICON_IMAGE); if (emote.numericId != Emoticon.ID_UNDEFINED) { addItem("emoteId", "ID: "+emote.numericId, ICON_WEB); addSeparator(); if (emote.type == Emoticon.Type.FFZ) { addItem("ffzlink", "FrankerFaceZ Emote", ICON_WEB); } else if (emote.type == Emoticon.Type.BTTV) { addItem("bttvlink", "BetterTTV Emote", ICON_WEB); } else if (emote.type == Emoticon.Type.CUSTOM) { addItem("", "Custom Emote"); } else if (emote.type == Emoticon.Type.EMOJI) { addItem("", "Emoji ("+emote.creator+")"); addItem("emoteCreator", Language.getString("emoteCm.emoteBy", emote.creator)); addItem("", "Featured " + info); addItem("", info); addStreamSubmenu(emote); addItem("", "Not found favorite");
private void addStreamSubmenu(Emoticon emote) { if (emote.hasStreamSet() && Helper.isValidStream(emote.getStream())) { String subMenu = emote.getStream(); addItem("stream", "Twitch Stream", subMenu); addItem("join", Language.getString("userCm.join", emote.getStream()), subMenu); addSeparator(subMenu); addItem("showChannelEmotes", Language.getString("emoteCm.showEmotes"), subMenu); } }
setLiveStreamsWindowIcons(); EmoteContextMenu.setEmoteManager(emoticons); emotesDialog = new EmotesDialog(this, emoticons, this, contextMenuListener); GuiUtil.installEscapeCloseOperation(emotesDialog);
m = new EmoteContextMenu(emoteImage, contextMenuListener);