return result;
}
-
- private class LayoutTarget implements SwitchTarget {
- public ActionCallback switchTo(boolean requestFocus) {
- return null;
- }
-
- public boolean isVisible() {
- return false;
- }
-
- public RelativeRectangle getRectangle() {
- return null;
- }
- }
}
public abstract class SwitchAction extends AnAction implements DumbAware {
+ protected SwitchAction() {
+ setEnabledInModalContext(true);
+ }
+
@Override
public void update(AnActionEvent e) {
SwitchingSession session = getSession(e);
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.IdeFocusManager;
+import com.intellij.openapi.wm.IdeFrame;
import com.intellij.util.Alarm;
+import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public boolean dispatchKeyEvent(KeyEvent e) {
if (mySession != null && !mySession.isFinished()) return false;
+
+ Component c = e.getComponent();
+ Component frame = UIUtil.findUltimateParent(c);
+ if (frame instanceof IdeFrame) {
+ if (((IdeFrame)frame).getProject() != myProject) return false;
+ }
+
if (e.getID() != KeyEvent.KEY_PRESSED) {
if (myWaitingForAutoInitSession) {
cancelWaitingForAutoInit();
import com.intellij.openapi.util.ActionCallback;
import com.intellij.ui.awt.RelativeRectangle;
+import java.awt.*;
+
public interface SwitchTarget {
ActionCallback switchTo(boolean requestFocus);
boolean isVisible();
RelativeRectangle getRectangle();
+ Component getComponent();
}
Disposer.register(this, eachPainter);
myRootComponent = myProvider.getComponent();
- myGlassPane.addPainter(myRootComponent, eachPainter, this);
+ myGlassPane.addPainter(each.getComponent(), eachPainter, this);
myPainters.put(each, eachPainter);
}
}
private SwitchTarget getNextTarget(Direction direction) {
+ if (myTargets.size() == 1) {
+ return getSelection();
+ }
+
List<Point> points = new ArrayList<Point>();
Point selected = null;
Map<SwitchTarget, Point> target2Point = new HashMap<SwitchTarget, Point>();
return new RelativeRectangle(label.getParent(), b);
}
+ public Component getComponent() {
+ return myInfo2Label.get(myInfo);
+ }
+
@Override
public Object[] getEqualityObjects() {
return new Object[] {myInfo};
public RelativeRectangle getRectangle() {
return new RelativeRectangle(myButton.getParent(), myButton.getBounds());
}
+
+ public Component getComponent() {
+ return myButton;
+ }
}
public SwitchTarget getCurrentTarget() {
public RelativeRectangle getRectangleFor(Content content) {
return null;
}
+
+ @Override
+ public Component getComponentFor(Content content) {
+ return null;
+ }
}
public abstract void showContentPopup(ListPopup listPopup);
public abstract RelativeRectangle getRectangleFor(Content content);
+
+ public abstract Component getComponentFor(Content content);
+
}
ContentTabLabel label = myContent2Tabs.get(content);
return new RelativeRectangle(label.getParent(), label.getBounds());
}
+
+ public Component getComponentFor(Content content) {
+ return myContent2Tabs.get(content);
+ }
}
return myTabsLayout.getRectangleFor(myContent);
}
+ public Component getComponent() {
+ return myManager.getComponent();
+ }
+
@Override
public Object[] getEqualityObjects() {
return new Object[] {myContent};
<keyboard-shortcut first-keystroke="meta P"/>
</action>
+ <action id="SwitchUp">
+ <keyboard-shortcut first-keystroke="control alt UP"/>
+ </action>
+
+ <action id="SwitchDown">
+ <keyboard-shortcut first-keystroke="control alt DOWN"/>
+ </action>
+
+ <action id="SwitchLeft">
+ <keyboard-shortcut first-keystroke="control alt LEFT"/>
+ </action>
+
+ <action id="SwitchRight">
+ <keyboard-shortcut first-keystroke="control alt RIGHT"/>
+ </action>
<action id="NextSplitter">
<keyboard-shortcut first-keystroke="alt TAB"/>
<action id="PreviousEditorTab">
<keyboard-shortcut first-keystroke="control shift LEFT"/>
</action>
-
- <action id="SwitchUp">
- <keyboard-shortcut first-keystroke="control alt UP"/>
- </action>
-
- <action id="SwitchDown">
- <keyboard-shortcut first-keystroke="control alt DOWN"/>
- </action>
-
- <action id="SwitchLeft">
- <keyboard-shortcut first-keystroke="control alt LEFT"/>
- </action>
-
- <action id="SwitchRight">
- <keyboard-shortcut first-keystroke="control alt RIGHT"/>
- </action>
-
<action id="EditorPreviousWord">
<keyboard-shortcut first-keystroke="alt LEFT"/>
</action>
</action>
+ <action id="SwitchUp">
+ <keyboard-shortcut first-keystroke="control alt UP"/>
+ </action>
+
+ <action id="SwitchDown">
+ <keyboard-shortcut first-keystroke="control alt DOWN"/>
+ </action>
+
+ <action id="SwitchLeft">
+ <keyboard-shortcut first-keystroke="control alt LEFT"/>
+ </action>
+
+ <action id="SwitchRight">
+ <keyboard-shortcut first-keystroke="control alt RIGHT"/>
+ </action>
+
+
<action id="NextSplitter">
<keyboard-shortcut first-keystroke="alt TAB"/>
</action>