Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 230945 Details for
Bug 364046
[regression] Perspective switcher does not allow to reorder prespectives
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
partial patch
flipPerspective.patch (text/plain), 4.86 KB, created by
Piotr Aniola
on 2013-05-14 10:39:01 EDT
(
hide
)
Description:
partial patch
Filename:
MIME Type:
Creator:
Piotr Aniola
Created:
2013-05-14 10:39:01 EDT
Size:
4.86 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FlipPerspectiveWithNextHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FlipPerspectiveWithNextHandler.java >new file mode 100644 >index 0000000..a38dd3c >--- /dev/null >+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FlipPerspectiveWithNextHandler.java >@@ -0,0 +1,64 @@ >+/******************************************************************************* >+ * Copyright (c) 2013 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal; >+ >+import java.util.List; >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.e4.core.di.annotations.Execute; >+import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; >+import org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack; >+import org.eclipse.e4.ui.model.application.ui.basic.MWindow; >+import org.eclipse.e4.ui.workbench.modeling.EModelService; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+ >+/** >+ * @since 3.5 >+ * >+ */ >+public class FlipPerspectiveWithNextHandler extends AbstractHandler { >+ >+ /** >+ * @throws ExecutionException >+ */ >+ @Execute >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ MPerspectiveStack perspectiveStack = findPerspectiveStack(event); >+ MPerspective selectedPerspective = perspectiveStack.getSelectedElement(); >+ List<MPerspective> perspectives = perspectiveStack.getChildren(); >+ int selectedIndex = perspectives.indexOf(selectedPerspective); >+ int maxIndex = perspectives.size() - 1; >+ try { >+ if (selectedIndex < maxIndex) { >+ int nextIndex = selectedIndex + 1; >+ MPerspective nextPerspective = perspectives.remove(nextIndex); >+ perspectives.add(selectedIndex, nextPerspective); >+ } >+ } catch (Exception e) { >+ System.out.println(e); >+ } >+ return null; >+ } >+ >+ private MPerspectiveStack findPerspectiveStack(ExecutionEvent event) { >+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); >+ MWindow model = (MWindow) window.getService(MWindow.class); >+ EModelService modelService = (EModelService) window.getService(EModelService.class); >+ List<MPerspectiveStack> perspectiveStacks = modelService.findElements(model, null, >+ MPerspectiveStack.class, null); >+ return perspectiveStacks.get(0); >+ } >+ >+} >diff --git a/bundles/org.eclipse.ui/plugin.properties b/bundles/org.eclipse.ui/plugin.properties >index 805e299..c6735ad 100644 >--- a/bundles/org.eclipse.ui/plugin.properties >+++ b/bundles/org.eclipse.ui/plugin.properties >@@ -189,6 +189,7 @@ > command.nextPage.description = Switch to the next page > command.nextPerspective.description = Switch to the next perspective > command.nextPerspective.name = Next Perspective >+command.flipPerspectiveWithNext.name = Flip current perspective with the next one > command.nextSubTab.name = Next Sub-Tab > command.nextSubTab.description = Switch to the next sub-tab > command.nextTab.name = Next Tab >diff --git a/bundles/org.eclipse.ui/plugin.xml b/bundles/org.eclipse.ui/plugin.xml >index 9445139..f4d4736 100644 >--- a/bundles/org.eclipse.ui/plugin.xml >+++ b/bundles/org.eclipse.ui/plugin.xml >@@ -102,6 +102,10 @@ > </extension> > > <extension point="org.eclipse.ui.bindings"> >+ <key >+ commandId="org.eclipse.ui.perspectives.FlipPerspectiveWithNext" >+ sequence="M1+M2+F11" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" /> > <key > commandId="org.eclipse.ui.newWizard" > sequence="M1+N" >@@ -1102,6 +1106,9 @@ > categoryId="org.eclipse.ui.category.window" > id="org.eclipse.ui.window.nextPerspective" /> > <command >+ id="org.eclipse.ui.perspectives.FlipPerspectiveWithNext" >+ name="%command.flipPerspectiveWithNext.name"/> >+ <command > name="%command.previousPerspective.name" > description="%command.previousPerspective.description" > categoryId="org.eclipse.ui.category.window" >@@ -1934,6 +1941,9 @@ > </extension> > <extension > point="org.eclipse.ui.handlers"> >+ <handler >+ class= "org.eclipse.ui.internal.FlipPerspectiveWithNextHandler" >+ commandId="org.eclipse.ui.perspectives.FlipPerspectiveWithNext"/> > <handler > class="org.eclipse.ui.internal.ActivateEditorHandler" > commandId="org.eclipse.ui.window.activateEditor">
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 364046
: 230945