package net.bitpot.railways.models.routes;

import com.intellij.openapi.module.Module;
import net.bitpot.railways.gui.RailwaysIcons;
import net.bitpot.railways.models.Route;
import net.bitpot.railways.models.requestMethods.RequestMethod;

import javax.swing.*;

/**
 * @author Basil Gren
 *         on 14.12.2014.
 */
public class EngineRoute extends Route {

    private String engineClass;

    public EngineRoute(Module myModule, RequestMethod requestMethod,
                       String routePath, String routeName, String engineClass) {
        super(myModule, requestMethod, routePath, routeName);

        this.engineClass = engineClass;
    }


    @Override
    public String getQualifiedActionTitle() {
        return engineClass;
    }


    @Override
    public Icon getActionIcon() {
        return RailwaysIcons.NODE_MOUNTED_ENGINE;
    }
}

@@ -230,16 +230,183 @@
 tMethod;
+%0Aimport net.bitpot.railways.utils.RailwaysPsiUtils;%0Aimport net.bitpot.railways.utils.RailwaysUtils;%0Aimport org.jetbrains.plugins.ruby.ruby.lang.psi.holders.RContainer;
 %0A%0Aimport
@@ -1013,11 +1013,295 @@
 E;%0A    %7D
+%0A%0A    %0A    @Override%0A    public void navigate(boolean requestFocus) %7B%0A        RContainer container = RailwaysPsiUtils.%0A                findClassOrModule(engineClass, getModule().getProject());%0A        %0A        if (container != null)%0A            container.navigate(requestFocus);%0A    %7D
 %0A%7D%0A

Implement navigation to engine class.