shortcutplugin.java.svn-base

来自「开源项目openfire的完整源程序」· SVN-BASE 代码 · 共 53 行

SVN-BASE
53
字号
/** * $Revision$ * $Date$ * * Copyright (C) 1999-2005 Jive Software. All rights reserved. * This software is the proprietary information of Jive Software. Use is subject to license terms. */package org.jivesoftware.sparkimpl.plugin.chat;import org.jivesoftware.smack.packet.Message;import org.jivesoftware.spark.SparkManager;import org.jivesoftware.spark.plugin.Plugin;import org.jivesoftware.spark.ui.TranscriptWindow;import org.jivesoftware.spark.ui.TranscriptWindowInterceptor;import org.jivesoftware.spark.util.ModelUtil;import java.awt.Color;/** * The ShortcutPlugin is used to handle IRC-style shortcuts. */public class ShortcutPlugin implements Plugin, TranscriptWindowInterceptor {    public void initialize() {        // Add TranscriptWindowInterceptor        SparkManager.getChatManager().addTranscriptWindowInterceptor(this);    }    public void shutdown() {    }    public boolean canShutDown() {        return false;    }    public void uninstall() {    }    public boolean isMessageIntercepted(TranscriptWindow window, String userid, Message message) {        String body = message.getBody();        if (ModelUtil.hasLength(body) && body.startsWith("/me ")) {            body = body.replaceAll("/me", userid);            window.insertNotificationMessage(body, Color.MAGENTA);            return true;        }        return false;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?