// Path: src/main/java/pl/mjedynak/idea/plugins/builder/action/handler/AbstractBuilderActionHandler.java
// public abstract class AbstractBuilderActionHandler extends EditorActionHandler {
// 
//     protected PsiHelper psiHelper;
//     private BuilderVerifier builderVerifier;
//     private BuilderFinder builderFinder;
//     protected AbstractPopupDisplayer popupDisplayer;
//     protected AbstractPopupListFactory popupListFactory;
//     protected DisplayChoosers displayChoosers;
// 
//     public AbstractBuilderActionHandler(PsiHelper psiHelper, BuilderVerifier builderVerifier, BuilderFinder builderFinder, AbstractPopupDisplayer popupDisplayer,
//                                         AbstractPopupListFactory popupListFactory, DisplayChoosers displayChoosers) {
//         this.psiHelper = psiHelper;
//         this.builderVerifier = builderVerifier;
//         this.builderFinder = builderFinder;
//         this.popupDisplayer = popupDisplayer;
//         this.popupListFactory = popupListFactory;
//         this.displayChoosers = displayChoosers;
//     }
// 
//     @Override
//     public void execute(Editor editor, DataContext dataContext) {
//         Project project = (Project) dataContext.getData(DataKeys.PROJECT.getName());
//         PsiClass psiClassFromEditor = psiHelper.getPsiClassFromEditor(editor, project);
//         prepareDisplayChoosers(editor, psiClassFromEditor, dataContext);
//         if (psiClassFromEditor != null) {
//             forwardToSpecificAction(editor, psiClassFromEditor, dataContext);
//         }
//     }
// 
//     private void prepareDisplayChoosers(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext) {
//         Project project = (Project) dataContext.getData(DataKeys.PROJECT.getName());
//         displayChoosers.setEditor(editor);
//         displayChoosers.setProject(project);
//         displayChoosers.setPsiClassFromEditor(psiClassFromEditor);
//     }
// 
//     private void forwardToSpecificAction(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext) {
//         boolean isBuilder = builderVerifier.isBuilder(psiClassFromEditor);
//         PsiClass classToGo = findClassToGo(psiClassFromEditor, isBuilder);
//         if (classToGo != null) {
//             doActionWhenClassToGoIsFound(editor, psiClassFromEditor, dataContext, isBuilder, classToGo);
//         } else {
//             doActionWhenClassToGoIsNotFound(editor, psiClassFromEditor, dataContext, isBuilder);
//         }
//     }
// 
//     private PsiClass findClassToGo(PsiClass psiClassFromEditor, boolean isBuilder) {
//         if (isBuilder) {
//             return builderFinder.findClassForBuilder(psiClassFromEditor);
//         }
//         return builderFinder.findBuilderForClass(psiClassFromEditor);
//     }
// 
//     protected abstract void doActionWhenClassToGoIsFound(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext, boolean isBuilder, PsiClass classToGo);
// 
//     protected abstract void doActionWhenClassToGoIsNotFound(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext, boolean isBuilder);
// 
// }
// 
// Path: src/main/java/pl/mjedynak/idea/plugins/builder/action/handler/GoToBuilderActionHandler.java
// public class GoToBuilderActionHandler extends AbstractBuilderActionHandler {
// 
//     public GoToBuilderActionHandler(PsiHelper psiHelper, BuilderVerifier builderVerifier, BuilderFinder builderFinder, GoToBuilderPopupDisplayer popupDisplayer, GoToBuilderPopupListFactory popupListFactory, DisplayChoosers displayChoosersRunnable) {
//         super(psiHelper, builderVerifier, builderFinder, popupDisplayer, popupListFactory, displayChoosersRunnable);
//     }
// 
//     @Override
//     protected void doActionWhenClassToGoIsFound(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext, boolean isBuilder, PsiClass classToGo) {
//         psiHelper.navigateToClass(classToGo);
//     }
// 
//     @Override
//     protected void doActionWhenClassToGoIsNotFound(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext, boolean isBuilder) {
//         if (!isBuilder) {
//             displayPopup(editor);
//         }
//     }
// 
//     @SuppressWarnings("rawtypes")
//     private void displayPopup(Editor editor) {
//         JList popupList = popupListFactory.getPopupList();
//         popupDisplayer.displayPopupChooser(editor, popupList, () -> displayChoosers.run(null));
//     }
// }
// 
// Path: src/main/java/pl/mjedynak/idea/plugins/builder/factory/GoToBuilderPopupListFactory.java
// public class GoToBuilderPopupListFactory extends AbstractPopupListFactory {
// 
//     @Override
//     @SuppressWarnings({"unchecked", "rawtypes"})
//     protected JList createList() {
//         return new JBList(singletonList(new GenerateBuilderAdditionalAction()));
//     }
// }
// 
// Path: src/main/java/pl/mjedynak/idea/plugins/builder/gui/displayer/GoToBuilderPopupDisplayer.java
// public class GoToBuilderPopupDisplayer extends AbstractPopupDisplayer {
// 
//     private static final String TITLE = "Builder not found";
// 
//     public GoToBuilderPopupDisplayer(PopupChooserBuilderFactory popupChooserBuilderFactory) {
//         super(popupChooserBuilderFactory);
//     }
// 
//     @Override
//     protected String getTitle() {
//         return TITLE;
//     }
// }


import pl.mjedynak.idea.plugins.builder.action.handler.AbstractBuilderActionHandler;
import pl.mjedynak.idea.plugins.builder.action.handler.GoToBuilderActionHandler;
import pl.mjedynak.idea.plugins.builder.factory.GoToBuilderPopupListFactory;
import pl.mjedynak.idea.plugins.builder.gui.displayer.GoToBuilderPopupDisplayer;

package pl.mjedynak.idea.plugins.builder.action;


public class GoToBuilderAction extends AbstractBuilderAction {

    static {

// Path: src/main/java/pl/mjedynak/idea/plugins/builder/action/handler/AbstractBuilderActionHandler.java
// public abstract class AbstractBuilderActionHandler extends EditorActionHandler {
// 
//     protected PsiHelper psiHelper;
//     private BuilderVerifier builderVerifier;
//     private BuilderFinder builderFinder;
//     protected AbstractPopupDisplayer popupDisplayer;
//     protected AbstractPopupListFactory popupListFactory;
//     protected DisplayChoosers displayChoosers;
// 
//     public AbstractBuilderActionHandler(PsiHelper psiHelper, BuilderVerifier builderVerifier, BuilderFinder builderFinder, AbstractPopupDisplayer popupDisplayer,
//                                         AbstractPopupListFactory popupListFactory, DisplayChoosers displayChoosers) {
//         this.psiHelper = psiHelper;
//         this.builderVerifier = builderVerifier;
//         this.builderFinder = builderFinder;
//         this.popupDisplayer = popupDisplayer;
//         this.popupListFactory = popupListFactory;
//         this.displayChoosers = displayChoosers;
//     }
// 
//     @Override
//     public void execute(Editor editor, DataContext dataContext) {
//         Project project = (Project) dataContext.getData(DataKeys.PROJECT.getName());
//         PsiClass psiClassFromEditor = psiHelper.getPsiClassFromEditor(editor, project);
//         prepareDisplayChoosers(editor, psiClassFromEditor, dataContext);
//         if (psiClassFromEditor != null) {
//             forwardToSpecificAction(editor, psiClassFromEditor, dataContext);
//         }
//     }
// 
//     private void prepareDisplayChoosers(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext) {
//         Project project = (Project) dataContext.getData(DataKeys.PROJECT.getName());
//         displayChoosers.setEditor(editor);
//         displayChoosers.setProject(project);
//         displayChoosers.setPsiClassFromEditor(psiClassFromEditor);
//     }
// 
//     private void forwardToSpecificAction(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext) {
//         boolean isBuilder = builderVerifier.isBuilder(psiClassFromEditor);
//         PsiClass classToGo = findClassToGo(psiClassFromEditor, isBuilder);
//         if (classToGo != null) {
//             doActionWhenClassToGoIsFound(editor, psiClassFromEditor, dataContext, isBuilder, classToGo);
//         } else {
//             doActionWhenClassToGoIsNotFound(editor, psiClassFromEditor, dataContext, isBuilder);
//         }
//     }
// 
//     private PsiClass findClassToGo(PsiClass psiClassFromEditor, boolean isBuilder) {
//         if (isBuilder) {
//             return builderFinder.findClassForBuilder(psiClassFromEditor);
//         }
//         return builderFinder.findBuilderForClass(psiClassFromEditor);
//     }
// 
//     protected abstract void doActionWhenClassToGoIsFound(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext, boolean isBuilder, PsiClass classToGo);
// 
//     protected abstract void doActionWhenClassToGoIsNotFound(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext, boolean isBuilder);
// 
// }
// 
// Path: src/main/java/pl/mjedynak/idea/plugins/builder/action/handler/GoToBuilderActionHandler.java
// public class GoToBuilderActionHandler extends AbstractBuilderActionHandler {
// 
//     public GoToBuilderActionHandler(PsiHelper psiHelper, BuilderVerifier builderVerifier, BuilderFinder builderFinder, GoToBuilderPopupDisplayer popupDisplayer, GoToBuilderPopupListFactory popupListFactory, DisplayChoosers displayChoosersRunnable) {
//         super(psiHelper, builderVerifier, builderFinder, popupDisplayer, popupListFactory, displayChoosersRunnable);
//     }
// 
//     @Override
//     protected void doActionWhenClassToGoIsFound(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext, boolean isBuilder, PsiClass classToGo) {
//         psiHelper.navigateToClass(classToGo);
//     }
// 
//     @Override
//     protected void doActionWhenClassToGoIsNotFound(Editor editor, PsiClass psiClassFromEditor, DataContext dataContext, boolean isBuilder) {
//         if (!isBuilder) {
//             displayPopup(editor);
//         }
//     }
// 
//     @SuppressWarnings("rawtypes")
//     private void displayPopup(Editor editor) {
//         JList popupList = popupListFactory.getPopupList();
//         popupDisplayer.displayPopupChooser(editor, popupList, () -> displayChoosers.run(null));
//     }
// }
// 
// Path: src/main/java/pl/mjedynak/idea/plugins/builder/factory/GoToBuilderPopupListFactory.java
// public class GoToBuilderPopupListFactory extends AbstractPopupListFactory {
// 
//     @Override
//     @SuppressWarnings({"unchecked", "rawtypes"})
//     protected JList createList() {
//         return new JBList(singletonList(new GenerateBuilderAdditionalAction()));
//     }
// }
// 
// Path: src/main/java/pl/mjedynak/idea/plugins/builder/gui/displayer/GoToBuilderPopupDisplayer.java
// public class GoToBuilderPopupDisplayer extends AbstractPopupDisplayer {
// 
//     private static final String TITLE = "Builder not found";
// 
//     public GoToBuilderPopupDisplayer(PopupChooserBuilderFactory popupChooserBuilderFactory) {
//         super(popupChooserBuilderFactory);
//     }
// 
//     @Override
//     protected String getTitle() {
//         return TITLE;
//     }
// }


// Path: src/main/java/pl/mjedynak/idea/plugins/builder/action/GoToBuilderAction.java
import pl.mjedynak.idea.plugins.builder.action.handler.AbstractBuilderActionHandler;
import pl.mjedynak.idea.plugins.builder.action.handler.GoToBuilderActionHandler;
import pl.mjedynak.idea.plugins.builder.factory.GoToBuilderPopupListFactory;
import pl.mjedynak.idea.plugins.builder.gui.displayer.GoToBuilderPopupDisplayer;

package pl.mjedynak.idea.plugins.builder.action;


public class GoToBuilderAction extends AbstractBuilderAction {

    static {

        picoContainer.registerComponentImplementation(GoToBuilderActionHandler.class);
