【问题标题】:Eclipse HotKey: how to switch between tabs?Eclipse HotKey:如何在选项卡之间切换?
【发布时间】:2011-01-20 21:34:51
【问题描述】:

如何在 Eclipse 中打开的窗口之间切换?有Ctrl+F6,但它问我要哪个,但我想像浏览器中的选项卡或操作系统中的窗口一样切换它(Cmd kbd>/Win+Tab) 没有从列表中选择文件。如何在 Eclipse 中做这件简单的事情?

我尝试为事件分配热键:

  • 向前
  • 转发历史记录
  • 下一页

但它没有按我想要的方式工作。

【问题讨论】:

  • 在我的回答中添加了特定于操作系统的快捷方式,但您无法重新定义它们。
  • 我也有这个问题。我在 Mac 上,没有向上/向下翻页键。

标签: eclipse tabs hotkeys


【解决方案1】:
  • CTRL+E(用于编辑器列表)
  • CTRL+F6(用于通过列表切换到下一个编辑器)
    您可以为“下一个编辑器”键分配另一个快捷方式。

是两个官方快捷方式,但它们都涉及显示列表。

CTRL+Page Up / CTRL+Page Down 可以在不显示列表的情况下循环浏览编辑器。

最后一组快捷键的有趣之处在于:
它们没有列在要定义的 Eclipse Keys 快捷键中。
它们可以从多页编辑器继承,使它们成为操作系统特定的快捷方式


关于 Mac OS (OSX) 上的快捷方式,Matt Ball 在 2011 年 9 月抱怨无法重新映射 CTRL+Page Up/CTRL+向下翻页:

这让我发疯,无法像在 OS X 中的几乎所有其他选项卡式程序中那样翻阅打开的选项卡(-Left-)。

嗯,2012 年 3 月,Arthur 回复:

,我刚刚下载了最新版本的 Eclipse (3.7+)。我已经能够将“上一个/下一个选项卡”绑定到 (-Left-Right ) 在编辑器中,我敢肯定我以前做不到。
所以我猜他们听到了你的声音。
它的工作方式与您预期的一样,标签从左到右,反之亦然,而不是基于历史记录或类似的废话。

Matt Ball 确认:

哇哦,选择“Editing Java Source”确实有效
现在,不幸的是,这意味着如果我导航到非 Java 文件(JSP、XML、JS 等),我就是 SOL。
解决方法是为这对“复制命令”,并选择我想要的所有“时间”
到目前为止,它至少可以很好地处理 Java 和 JSP 文件。
这是一个需要设置的主要 PITA,但它只是一次性的。

他的exported preferences are available here 供你试用。
导入后,您应该会看到所有相关类型的文档:

【讨论】:

  • 在 OSX 上,将前两个键盘操作的 CTRL 替换为 CMD。但是您仍然需要使用 CTRL 和 PgUp 或 PgDown 来循环浏览编辑器。我刚刚在尝试以下一些建议时发现了另一组有用的 KB 快捷方式:您可以使用 ALT+Up 或 ALT+Down 移动整行代码。
  • 现在不可能在 Indigo 中重新映射 CTRL+Page Up/CTRL+Page Down,是吗?它让我发疯,无法像在 OS X 中几乎所有其他选项卡式程序(⌘-Left⌘-Right)中那样翻阅打开的选项卡。
  • 在非扩展 OSX 键盘上:默认为 fn+ctrl+up_arrow / down_arrow。
  • @MДΓΓБДLL 在 OS X 上,我刚刚下载了最新版本的 Eclipse。在编辑器中,我已经能够将“上一个/下一个选项卡”绑定到(⌘-左和⌘-右),我敢肯定我以前做不到。所以我猜他们听到了你的声音。它可以按您的预期工作,标签从左到右,反之亦然,而不是基于历史记录或类似的废话。
  • @MДΓΓБДLL 哎哟......我想我应该说我在 Eclipse 上为C/C++。对不起,我没有想到。它不适用于“编辑 Java 源”吗?如果那可以减轻您的痛苦,那么当我在最右边的选项卡上时,⌘-Right 不会带我到最左边的选项卡...另外,我遇​​到了非常烦人的“错误错误”(显示错误但一切都完美编译)自更新以来。希望你也不要这样!
【解决方案2】:

如果您转到首选项(例如窗口→首选项)并查看常规→键

然后搜索“Next Tab”和“Previous Tab”,就可以重新映射了。

【讨论】:

  • 我添加了“下一个选项卡”->“Ctrl + Tab”“上一个选项卡”->“Ctrl + Shift + Tab”就像在 Firefox 中一样
  • 这并不完全正确。这只是按照它们在标签栏上出现的顺序循环浏览标签,而不是最近切换到的顺序。
  • 效果很好,除了 Android 布局编辑器,它似乎吸收/忽略了这些命令。它总是一些东西!
  • @Hafthor:我习惯了 Notepad++,所以我希望 Ctrl+Tab 在 last active 选项卡/编辑器之间切换。为此,请从“下一个编辑器”中删除默认的 Ctrl+F6,并从“上一个编辑器”命令中删除默认的 Ctrl+Shift+F6,然后为这些命令插入 Ctrl+Tab 和 Ctrl+Shift+Tab。请注意,出于某种原因,我不得不 remove 旧命令(在我更改键的其他情况下我不需要这样做),但很高兴它现在可以工作了!此外,在玩耍时,Eclipse (Juno) 表现得很奇怪,我无法使用任何常用或更改的组合键切换选项卡,但重新启动解决了这个问题。
  • 我添加了“下一个选项卡”->“Ctrl + Tab”“上一个选项卡”->“Ctrl + Shift + Tab”就像在 Visual Studio 中一样
【解决方案3】:

在操作系统中像 Windows 一样切换(转到最后一个有焦点的窗口

CTRL-F6 在 Eclipse 中,如 ALT-TAB(在 Windows 上),显示可用的选项卡/窗口列表(如果您保持 CTRL / ALT 键按下)并突出显示您松开此键时将跳转到的那个。您不必选择窗口。如果您想一次遍历多个选项卡,请按住 CTRL 按钮并点击 TAB 按钮。这与 Windows 上的 ALT-TAB 行为相同。

在这个意义上,CTRL-SHIFT-F6在eclipse中就是 ALT-SHIFT-TAB 模拟。就个人而言,我将 Eclipse 中的这些绑定更改为类似于 Visual Studio。 IE。 CTRL-TABCTRL-SHIFT-TAB 我这样做:

Window>Preferences>General>Keys

然后设置“下一个编辑器”=Ctrl+Tab和“上一个编辑器”=Ctrl+Shift+Tab。在设置新绑定之前不要忘记点击“Unbind Command”。

像浏览器一样切换(转到当前标签右侧的标签

这是CTRL-PageDown向右走,CTRL-PageUp 向左走。令人沮丧的是,当您到达选项卡列表的末尾(比如最右边的选项卡)然后尝试再次向右移动时,Eclipse 不会像大多数浏览器那样循环到第一个选项卡(最左边)。

【讨论】:

  • 这是该主题中最被低估的答案。特别是因为 Juno 更改了哪些选项卡显示为纯列表,而不是最近使用的编辑器。
  • 这在 90% 的时间里都有效。如果您的鼠标光标恰好位于弹出选项卡列表的位置,则会失败。光标前面弹出的不幸标签都会被选中。
  • Eclipse 3.6.2 版在 100% 的时间内工作,无论鼠标在哪里。毕竟,Eclipse 的自然行为重新映射到不同的键!虽然没有尝试过古老的 Eclipse 版本......
  • 您不必取消绑定“下一个编辑器”命令。只需点击“复制命令”并编辑副本并将其绑定到CTRL-TAB
  • 解绑提醒是关键。在eclipse 2019-03中,原来的命令被移除后才生效,好像不再支持多绑定了。
【解决方案4】:

您可以使用 ALT+Left 转到上一个选项卡,或使用 ALT+Right 转到转发。但是,此方法使用类似于历史记录的选项卡切换,因此它将转到您打开的上一个选项卡,如果您“返回”一次或多次,则前进。有点奇怪,我知道,但它有效。您始终可以通过单击每个选项卡一次来“重置”历史记录。

【讨论】:

  • 当有历史记录的动作时无效,比如去同一个类中的方法定义。
  • 这曾经很有用,对于 eclipse helios 这就像 SiN 提到的那样工作
  • 我真的很喜欢这种行为,比如转到方法定义,这是在浏览大量文件时来回切换的有用方式。
  • 这在编辑窗口之间来回循环时非常有用。我喜欢将屏幕一分为二,其他方法只循环 1 个选项卡分组,(ctrl-F6 除外,但我觉得很麻烦)。
【解决方案5】:
  • Right 侧移:Ctrl + page Down
  • Left 侧移:CTRL + page Up

附加

  • 获取打开的标签列表:Ctrl + F6

Eclipse 其他快捷方式

【讨论】:

    【解决方案6】:

    CTRL + F6 很好用。如果你想切换到下一个/上一个标签,你需要做 CTRL+Page Down / CTRL+Page Up kbd>.

    【讨论】:

    • 是的,我经常用这个。但是,当编辑器提出多个视图时(例如,当您处理XMLproperties 文件时),它会在不同视图之间切换,并且您无法再在选项卡之间切换:(
    • "CTRL + F6 很好用。"在 Windows 中的 Eclipse Photon 上,这里什么都不做。
    【解决方案7】:

    默认为 Ctrl + F6。您可以通过转到 Window 首选项 来更改它。我通常将其更改为 Ctrl + Tab,这与我们在浏览器和其他东西中切换选项卡时使用的相同。

    【讨论】:

    • 我不是反对者,但我质疑您使用 Eclipse Indigo 在 Windows Vista 上将键绑定与 Ctrl + Tab 映射在一起的能力。这是不可能的!如果我按 Tab,它只会改变按钮和下拉列表的焦点。
    • @tom_mai78101 抱歉,我不知道 Windows Vista 存在这个问题。您可以尝试选择不同的映射,尽管它在 XP 中是成功的。
    【解决方案8】:

    自定义 KeyBinding 序列示例: CTRL + TAB 使用 Eclipse RCP 在可见模块或编辑器之间切换 Forward 方向。

    你按 CTRL + TAB 第二次打开 另一个编辑器并使用 RCP Eclipse 关闭以前的编辑器。

    package rcp_demo.Toolbar;
    
    import org.eclipse.core.commands.AbstractHandler;
    import org.eclipse.core.commands.ExecutionEvent;
    import org.eclipse.core.commands.ExecutionException;
    import org.eclipse.ui.IEditorReference;
    import org.eclipse.ui.IWorkbenchPage;
    import org.eclipse.ui.IWorkbenchWindow;
    import org.eclipse.ui.PartInitException;
    import org.eclipse.ui.handlers.HandlerUtil;
    import rcp_demo.Editor.EmployeeEditor;
    import rcp_demo.Editor.EmployeeEditorInput;
    import rcp_demo.Editor.ProductEditor;
    import rcp_demo.Editor.ProductEditorInput;
    import rcp_demo.Editor.UserEditor;
    import rcp_demo.Editor.UserEditorInput;
    
    public class Forward_Editor extends AbstractHandler{
    
        static String Editor_name;  //  Active Editor name store in Temporary 
        static int cnt;             //  close editor count this variable
        @Override
        public Object execute(ExecutionEvent event) throws ExecutionException {
    
            IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
            IWorkbenchPage page = window.getActivePage();
    
            UserEditorInput std_input = new UserEditorInput();
            EmployeeEditorInput emp_input=new EmployeeEditorInput();
            ProductEditorInput product_input=new ProductEditorInput();
    
            IEditorReference[] editors = page.getEditorReferences();
    
            //Blank Editor Window to execute..
            if(editors.length==0)
            {
                //First time close editor can open Student_Editor
                if(cnt==1 && Editor_name.equals("Student_Editor"))
                {
                    try {
                        page.openEditor(emp_input, EmployeeEditor.Id);
                        cnt=1;
                        Editor_name=page.getActiveEditor().getTitle();
                        System.out.println("EMP>>Len:: "+editors.length+"..EDi::"+Editor_name);
                    } catch (PartInitException e) {
                        e.printStackTrace();
                    }       
                }
                //First time close editor can open Employee_Editor
                else if(cnt==1 && Editor_name.equals("Employee_Editor"))
                {
                    try {
                        page.openEditor(product_input,ProductEditor.ID);
                        cnt=1;
                        Editor_name=page.getActiveEditor().getTitle();
                        System.out.println("PRO>>Len:: "+editors.length+"..EDi::"+Editor_name); 
                    } catch (PartInitException e) {e.printStackTrace();
                    }
                }
                //First time close editor can open Product_Editor
                else if(cnt==1 && Editor_name.equals("Product_Editor"))
                {
                    try {
                        page.openEditor(std_input, UserEditor.ID);
                        System.out.println("student Editor open");
                        cnt=1;
                        Editor_name=page.getActiveEditor().getTitle();
                        System.out.println("Close::"+Editor_name);
                    } catch (PartInitException e) {
                        e.printStackTrace();
                    }
                }
                //First Time call // empty editors 
                else{
                    try {
                        page.openEditor(std_input, UserEditor.ID);
                        System.out.println("student Editor open");
                        Editor_name=page.getActiveEditor().getTitle();
                    } catch (PartInitException e) {
                        e.printStackTrace();
                    }
                }
            }//End if condition
    
            //AvtiveEditor(Student_Editor) close to open Employee Editor
            else if(page.getActiveEditor().getTitle().equals("Student_Editor"))
            {
                try {
                    //page.closeAllEditors(true);
                    page.closeEditor(page.getActiveEditor(), true);
                    page.openEditor(emp_input, EmployeeEditor.Id);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("EMP>>Len:: "+editors.length+"..EDi::"+Editor_name);
                } catch (PartInitException e) {
                    e.printStackTrace();
                }
            }
            //AvtiveEditor(Employee_Editor) close to open Product Editor
            else if(page.getActiveEditor().getTitle().equals("Employee_Editor"))
            {
                try {
                    page.closeAllEditors(true);
                    page.openEditor(product_input,ProductEditor.ID);
    
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("PRO>>Len:: "+editors.length+"..EDi::"+Editor_name);
    
                } catch (PartInitException e) {
                    e.printStackTrace();
                }
            }
            //AvtiveEditor(Product_Editor) close to open Student Editor
            else if(page.getActiveEditor().getTitle().equals("Product_Editor"))
            {
                try {
                    page.closeAllEditors(true);
                    page.openEditor(std_input, UserEditor.ID);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("stud>>Len:: "+editors.length+"..EDi::"+Editor_name);
                } catch (PartInitException e) {
                    e.printStackTrace();
                }
            }
            //by default open Student Editor
            else 
            {
                try {
                    page.closeAllEditors(true);
                    page.openEditor(std_input, UserEditor.ID);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("stud_else>>Len:: "+editors.length+"..EDi::"+Editor_name);
                } catch (PartInitException e) {
                    e.printStackTrace();
                }
            }
            return null;
        }
    }
    
    >Custom KeyBinding sequence example : <kbd> SHIFT + TAB </kbd> to switch between visilble Modules or Editors **Backword** direction using Eclipse RCP.
    
    
    package rcp_demo.Toolbar;
    
    import org.eclipse.core.commands.AbstractHandler;
    import org.eclipse.core.commands.ExecutionEvent;
    import org.eclipse.core.commands.ExecutionException;
    import org.eclipse.ui.IEditorReference;
    import org.eclipse.ui.IWorkbenchPage;
    import org.eclipse.ui.IWorkbenchWindow;
    import org.eclipse.ui.PartInitException;
    import org.eclipse.ui.handlers.HandlerUtil;
    import rcp_demo.Editor.EmployeeEditor;
    import rcp_demo.Editor.EmployeeEditorInput;
    import rcp_demo.Editor.ProductEditor;
    import rcp_demo.Editor.ProductEditorInput;
    import rcp_demo.Editor.UserEditor;
    import rcp_demo.Editor.UserEditorInput;
    
    public class Backword_Editor extends AbstractHandler{
    
        static String Editor_name;   // Active Editor name store in Temporary 
        static int cnt;
    
        @Override
        public Object execute(ExecutionEvent event) throws ExecutionException {
    
            IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
            IWorkbenchPage page = window.getActivePage();
            //Three object create in EditorInput 
            UserEditorInput std_input = new UserEditorInput();
            EmployeeEditorInput emp_input=new EmployeeEditorInput();
            ProductEditorInput product_input=new ProductEditorInput();
    
            IEditorReference[] editors = page.getEditorReferences();
            System.out.println("Length : "+editors.length);
    
            if(editors.length==0)
            {
                //First time close editor can open Student_Editor
                if(cnt==1 && Editor_name.equals("Product_Editor"))
                {
                    try {
                        page.openEditor(emp_input, EmployeeEditor.Id);
                        cnt=1;
                        Editor_name=page.getActiveEditor().getTitle();
                        System.out.println("EMP>>Len:: "+editors.length+"..EDi::"+Editor_name);
                    } catch (PartInitException e) {
                        e.printStackTrace();
                    }               
                }
                //First time close editor can open Employee_Editor
                else if(cnt==1 && Editor_name.equals("Employee_Editor"))
                {
                    try {
                        page.openEditor(std_input, UserEditor.ID);
                        cnt=1;
                        Editor_name=page.getActiveEditor().getTitle();
                        System.out.println("Student>>Len:: "+editors.length+"..student::"+Editor_name);
    
                    } catch (PartInitException e) {
                        e.printStackTrace();
                    }
                }
                //First time close editor can open Product_Editor
                else if(cnt==1 && Editor_name.equals("Student_Editor"))
                {
                            try {
                                page.openEditor(product_input,ProductEditor.ID);
                                cnt=1;
                                Editor_name=page.getActiveEditor().getTitle();
                                System.out.println("PRO>>Len:: "+editors.length+"..EDi::"+Editor_name);
    
                            } catch (PartInitException e) {
                                e.printStackTrace();
                            }
                } 
                //First Time or empty editors to check this condition
                else{
                    try {
                        page.openEditor(product_input,ProductEditor.ID);
                        System.out.println("product Editor open");
                    } catch (PartInitException e) {
                        e.printStackTrace();
                    }
                }
            }
            //AvtiveEditor(Product_Editor) close to open Employee Editor
            else if(page.getActiveEditor().getTitle().equals("Product_Editor"))
            {
                System.out.println("Product:: "+page.getActiveEditor().getTitle());
                try {
                    page.closeAllEditors(true);
                    page.openEditor(emp_input, EmployeeEditor.Id);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("Employee Editor open");
                } catch (PartInitException e) {
                    e.printStackTrace();
                }
            }
            //AvtiveEditor(Employee_Editor) close to open Student Editor
            else if(page.getActiveEditor().getTitle().equals("Employee_Editor"))
            {
                System.out.println("Emp:: "+page.getActiveEditor().getTitle());
                try {
                    page.closeAllEditors(true);
                    page.openEditor(std_input, UserEditor.ID);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("student Editor open");
                } catch (PartInitException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            //AvtiveEditor(Student_Editor) close to open Product Editor
            else if(page.getActiveEditor().getTitle().equals("Student_Editor"))
            {
                System.out.println("Product:: "+page.getActiveEditor().getTitle());
                try {
                    page.closeAllEditors(true);
                    page.openEditor(product_input,ProductEditor.ID);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("product Editor open");
                } catch (PartInitException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            //by default open Student Editor
            else 
            {
                try {
                    page.closeAllEditors(true);
                    page.openEditor(product_input,ProductEditor.ID);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("product Editor open");
                } catch (PartInitException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return null;
        }
    }
    

    自定义 KeyBinding 序列示例: SHIFT + TAB 使用 Eclipse RCP 在可见模块或编辑器 Backword 方向之间切换。

    package rcp_demo.Toolbar;
    
    import org.eclipse.core.commands.AbstractHandler;
    import org.eclipse.core.commands.ExecutionEvent;
    import org.eclipse.core.commands.ExecutionException;
    import org.eclipse.ui.IEditorReference;
    import org.eclipse.ui.IWorkbenchPage;
    import org.eclipse.ui.IWorkbenchWindow;
    import org.eclipse.ui.PartInitException;
    import org.eclipse.ui.handlers.HandlerUtil;
    import rcp_demo.Editor.EmployeeEditor;
    import rcp_demo.Editor.EmployeeEditorInput;
    import rcp_demo.Editor.ProductEditor;
    import rcp_demo.Editor.ProductEditorInput;
    import rcp_demo.Editor.UserEditor;
    import rcp_demo.Editor.UserEditorInput;
    
    public class Backword_Editor extends AbstractHandler{
    
        static String Editor_name;   // Active Editor name store in Temporary 
        static int cnt;
    
        @Override
        public Object execute(ExecutionEvent event) throws ExecutionException {
    
            IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
            IWorkbenchPage page = window.getActivePage();
            //Three object create in EditorInput 
            UserEditorInput std_input = new UserEditorInput();
            EmployeeEditorInput emp_input=new EmployeeEditorInput();
            ProductEditorInput product_input=new ProductEditorInput();
    
            IEditorReference[] editors = page.getEditorReferences();
            System.out.println("Length : "+editors.length);
    
            if(editors.length==0)
            {
                //First time close editor can open Student_Editor
                if(cnt==1 && Editor_name.equals("Product_Editor"))
                {
                    try {
                        page.openEditor(emp_input, EmployeeEditor.Id);
                        cnt=1;
                        Editor_name=page.getActiveEditor().getTitle();
                        System.out.println("EMP>>Len:: "+editors.length+"..EDi::"+Editor_name);
                    } catch (PartInitException e) {
                        e.printStackTrace();
                    }               
                }
                //First time close editor can open Employee_Editor
                else if(cnt==1 && Editor_name.equals("Employee_Editor"))
                {
                    try {
                        page.openEditor(std_input, UserEditor.ID);
                        cnt=1;
                        Editor_name=page.getActiveEditor().getTitle();
                        System.out.println("Student>>Len:: "+editors.length+"..student::"+Editor_name);
    
                    } catch (PartInitException e) {
                        e.printStackTrace();
                    }
                }
                //First time close editor can open Product_Editor
                else if(cnt==1 && Editor_name.equals("Student_Editor"))
                {
                            try {
                                page.openEditor(product_input,ProductEditor.ID);
                                cnt=1;
                                Editor_name=page.getActiveEditor().getTitle();
                                System.out.println("PRO>>Len:: "+editors.length+"..EDi::"+Editor_name);
    
                            } catch (PartInitException e) {
                                e.printStackTrace();
                            }
                } 
                //First Time or empty editors to check this condition
                else{
                    try {
                        page.openEditor(product_input,ProductEditor.ID);
                        System.out.println("product Editor open");
                    } catch (PartInitException e) {
                        e.printStackTrace();
                    }
                }
            }
            //AvtiveEditor(Product_Editor) close to open Employee Editor
            else if(page.getActiveEditor().getTitle().equals("Product_Editor"))
            {
                System.out.println("Product:: "+page.getActiveEditor().getTitle());
                try {
                    page.closeAllEditors(true);
                    page.openEditor(emp_input, EmployeeEditor.Id);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("Employee Editor open");
                } catch (PartInitException e) {
                    e.printStackTrace();
                }
            }
            //AvtiveEditor(Employee_Editor) close to open Student Editor
            else if(page.getActiveEditor().getTitle().equals("Employee_Editor"))
            {
                System.out.println("Emp:: "+page.getActiveEditor().getTitle());
                try {
                    page.closeAllEditors(true);
                    page.openEditor(std_input, UserEditor.ID);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("student Editor open");
                } catch (PartInitException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            //AvtiveEditor(Student_Editor) close to open Product Editor
            else if(page.getActiveEditor().getTitle().equals("Student_Editor"))
            {
                System.out.println("Product:: "+page.getActiveEditor().getTitle());
                try {
                    page.closeAllEditors(true);
                    page.openEditor(product_input,ProductEditor.ID);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("product Editor open");
                } catch (PartInitException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            //by default open Student Editor
            else 
            {
                try {
                    page.closeAllEditors(true);
                    page.openEditor(product_input,ProductEditor.ID);
                    cnt=1;
                    Editor_name=page.getActiveEditor().getTitle();
                    System.out.println("product Editor open");
                } catch (PartInitException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return null;
        }
    }
    

    按键顺序

    M1 表示 CTRL

    M2 表示 SHIFT

    插件.xml


    <extension point="org.eclipse.ui.commands">
            <command
                    defaultHandler="rcp_demo.Toolbar.Forward_Editor"
                    id="RCP_Demo.Toolbar.Forward_editor_open_cmd"
                    name="Forward_Editor">
            </command>
            <command
                    defaultHandler="rcp_demo.Toolbar.Backword_Editor"
                    id="RCP_Demo.Toolbar.backwards_editor_open_cmd"
                    name="Backword_Editor">
            </command>
        </extension>
    <extension point="org.eclipse.ui.bindings">
            <key
                    commandId="RCP_Demo.Toolbar.Forward_editor_open_cmd"
                    schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
                    sequence="M1+TAB">
            </key>  
            <key
                    commandId="RCP_Demo.Toolbar.backwards_editor_open_cmd"
                    schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
                    sequence="M2+TAB">
            </key>              
    </extension>
    

    【讨论】:

      【解决方案9】:

      3 行 AutoHotKey 脚本(无论如何在 Windows 上):

      #IfWinActive ahk_class SWT_Window0
      ^+Tab::^PgUp
      ^Tab::^PgDn
      

      把它放在你的启动文件夹中(保存为 *.ahk,必须安装 AutoHotKey),Eclipse 选项卡现在将像 Chrome 或 Firefox 一样工作。

      【讨论】:

        【解决方案10】:

        返回上一个标签的快捷键

        Alt + LeftArrow 返回。

        【讨论】:

          【解决方案11】:

          解决了!!

          将方案更改为 Microsoft Visual Studio

          Window>Preferences>General>Keys

          查找方案下拉菜单

          我的eclipse版本:

          面向 Web 开发人员的 Eclipse Java EE IDE。

          版本:Juno Service Release 1 内部版本号:20120920-0800

          【讨论】:

            【解决方案12】:

            没有人会读到我的答案,但无论如何...如果您使用的是 Mac OS X,您会喜欢在 Eclipse 中使用多点触控手势进行历史导航:http://sourceforge.net/apps/mediawiki/eclipsemultitch/

            【讨论】:

            • 我阅读了 所有 个条目 every single day ;) 而且“Eclipse Multi-Touch”看起来不错,所以 +1。但它自 2010 年以来似乎不活跃。它是否仍能与最近的 Eclipse 4.x(如 Juno)一起使用?
            【解决方案13】:

            在 Windows 上,如果您有 5 键鼠标,则可以使用前进和后退来代替 ALT+LeftALT+Right

            【讨论】:

              【解决方案14】:

              一种方法是使用VI Plugin,然后您只需执行 :n(和 :N)即可在文件之间切换。

              我就是这么做的。

              【讨论】:

                【解决方案15】:

                您可以在 Preferences -> General -> Keys 中设置热键(或者在 Preferences 对话框顶部的过滤器字段中输入“keys”。

                选择“键”部分后,找到“下一个选项卡”和“上一个选项卡”并通过单击“绑定”字段然后输入您的热键为它们分配您自己的热键。

                点击应用或确定以完成该过程。

                【讨论】:

                  【解决方案16】:

                  如果您只想在当前和以前的选项卡选择之间切换,使用 CTRL + F6 将来回切换。要导航到历史记录中更早的选项卡,您需要在编辑器窗口打开时使用 UP / DOWN 键。这适用于 Helios (Eclipse 3.6);不确定这是否适用于旧版本的 Eclipse。

                  【讨论】:

                    【解决方案17】:

                    我引用 VonC 的回应,添加一些内容。

                    • Ctrl+PgUp(PgDn) 在当前堆栈中的选项卡之间切换(编辑器和视图)
                    • Ctrl+E 使用过滤列表在当前堆栈中的选项卡之间切换
                    • Ctrl+F6 切换编辑器,不管哪个栈
                    • Ctrl+F7 切换视图,不管哪个栈

                    另外,Bug 206299 可以使用 Ctrl+Tab 而不是 Ctrl+PgUp(PgDn)。

                    • 由于这会破坏可访问性,用户应该为此设置首选项。在 Oomph 安装期间,欢迎问卷中可能应该有一个问题。

                    如果不满意,您可以从 Window > Preferences > General > Keys 为自己分配 Key Binding。

                    【讨论】:

                      【解决方案18】:

                      由于某种原因,我的 Eclipse 设置已损坏,因此我不得不手动编辑文件 /.plugins/org.eclipse.e4.workbench/workbench.xmi

                      我之前一定已经将 Ctrl+Tab 设置为类似浏览器的选项卡切换,即使重置 Eclipse 首选项中的所有键绑定也不会摆脱快捷方式(它们也没有显示在任何地方)。我打开了上面提到的文件并删除了标记为&lt;tags&gt;type:user&lt;/tags&gt;&lt;bindings&gt;元素,这些元素与无效的快捷方式相关。

                      【讨论】:

                        【解决方案19】:

                        从右到左:ctrl+ shift + 9ctrl + shift + Page Upctrl + Page Up

                        从左到右:ctrl + shift + 3ctrl + shift + Page Downctrl + Page Down

                        【讨论】:

                          【解决方案20】:

                          按住 CTRL 并按 F6 直到找到所需的编辑器,然后松开。 UI 不如窗口选择漂亮,但功能是一样的。

                          【讨论】:

                            【解决方案21】:

                            在 SLES12 机器上,您可以使用 Ctrl+PageUpCtrl+PageDown 在选项卡之间导航默认。您始终可以通过浏览“常规”类别下的“键”部分从“首选项”窗口更改这些键。 上面的 Victor 和 VonC 很好地解释了这个过程。

                            【讨论】:

                              【解决方案22】:

                              如何在 Eclipse 中切换打开的窗口

                              CTRL+F7 在这里工作 - Windows 上的 Eclipse Photon。

                              【讨论】:

                                【解决方案23】:

                                由于某种原因,仅添加新绑定似乎不起作用(eclipse 2021-06)。

                                改为:

                                • 使用Copy Command克隆Next TabPrevious Tab
                                • 将“时间”更改为In Windows
                                • 添加您的新绑定
                                • Apply and Close

                                @Gillfish 在对另一个答案的评论中提到了这一点,但我认为最好明确提出解决方案。

                                【讨论】:

                                  猜你喜欢
                                  • 1970-01-01
                                  • 2023-03-13
                                  • 1970-01-01
                                  • 1970-01-01
                                  • 1970-01-01
                                  • 1970-01-01
                                  • 1970-01-01
                                  • 1970-01-01
                                  相关资源
                                  最近更新 更多