Package floobits.actions

Source Code of floobits.actions.FollowMode

package floobits.actions;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import floobits.FloobitsPlugin;
import floobits.common.EditorEventHandler;
import floobits.common.interfaces.IContext;
import floobits.common.protocol.handlers.FlooHandler;
import floobits.utilities.Flog;
import org.jdesktop.swingx.action.ActionManager;

public class FollowMode extends IsJoinedAction {
    public void actionPerformed(AnActionEvent e, EditorEventHandler editorEventHandler) {
        editorEventHandler.follow();
    }

    @Override
    public void update(AnActionEvent e) {
        super.update(e);
        FloobitsPlugin floobitsPlugin;
        FlooHandler flooHandler;
        floobitsPlugin = FloobitsPlugin.getInstance(e.getProject());
        if (floobitsPlugin == null) {
            Flog.log("No floobits plugin, aborting update.");
            return;
        }
        flooHandler = floobitsPlugin.context.getFlooHandler();
        if (flooHandler == null) {
            return;
        }
        boolean mode = flooHandler.editorEventHandler.state.getFollowing();
        e.getPresentation().setText(String.format("%s follow mode", mode ? "Disable" : "Enable"));
    }
}
TOP

Related Classes of floobits.actions.FollowMode

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.