void (@NotNull final AnActionEvent e) { final ArrayList<RadComponent> selectedComponents = FormEditingUtil.getSelectedComponents(myEditor); final JComponent rootContainerDelegee = myEditor.getRootContainer().getDelegee(); if(selectedComponents.size() == 0){ moveToFirstComponent(rootContainerDelegee); return; } RadComponent selectedComponent = myEditor.getSelectionLead(); if (selectedComponent == null || !selectedComponents.contains(selectedComponent)) { selectedComponent = selectedComponents.get(0); } if (moveSelectionByGrid(selectedComponent) || myMoveToLast) { return; } // 1. We need to get coordinates of all editor's component in the same // coordinate system. For example, in the RadRootContainer rootContainerDelegee's coordinate system. final ArrayList<RadComponent> components = new ArrayList<>(); final ArrayList<Point> points = new ArrayList<>(); final RadComponent selectedComponent1 = selectedComponent; FormEditingUtil.iterate( myEditor.getRootContainer(), new FormEditingUtil.ComponentVisitor<RadComponent>() { @Override public boolean visit(final RadComponent component) { if (component instanceof RadAtomicComponent) { if(selectedComponent1.equals(component)){ return true; } if (!FormEditingUtil.isComponentSwitchedInView(component)) { return true; } components.add(component); final JComponent _delegee = component.getDelegee(); final Point p = SwingUtilities.convertPoint( _delegee, new Point(0, 0), rootContainerDelegee ); p.x += _delegee.getWidth() / 2; p.y += _delegee.getHeight() / 2; points.add(p); } return true; } } ); if(components.size() == 0){ return; } // 2. final Point source = SwingUtilities.convertPoint( selectedComponent.getDelegee(), new Point(0, 0), rootContainerDelegee ); source.x += selectedComponent.getDelegee().getWidth() / 2; source.y += selectedComponent.getDelegee().getHeight() / 2; int min = Integer.MAX_VALUE; int nextSelectedIndex = -1; for(int i = points.size() - 1; i >= 0; i--){ final int distance = calcDistance(source, points.get(i)); if(distance < min){ min = distance; nextSelectedIndex = i; } } if(min == Integer.MAX_VALUE){ return; } final RadComponent component = components.get(nextSelectedIndex); selectOrExtend(component); }