Author: dvinnichek
Date: 2010-11-03 13:26:50 -0400 (Wed, 03 Nov 2010)
New Revision: 26233
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java
Log:
rotate all opened editors by clicking 'rotate editors' button on toolbar
(
https://jira.jboss.org/browse/JBIDE-7383)
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java 2010-11-03
17:19:40 UTC (rev 26232)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java 2010-11-03
17:26:50 UTC (rev 26233)
@@ -23,6 +23,9 @@
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -145,17 +148,24 @@
* Call <code>filContainer()</code> from VpeEditorPart to redraw
* CustomSashForm with new layout.
*/
- IEditorPart activeEditor = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (activeEditor instanceof JSPMultiPageEditor) {
- JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) activeEditor;
+ IEditorReference[] openedEditors = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getEditorReferences();
+ for (IEditorReference openedEditor : openedEditors) {
+ IEditorPart editor = openedEditor.getEditor(true);
+ rotateEditor(editor, orientation);
+ }
+ }
+
+ private void rotateEditor(IEditorPart editor, String orientation) {
+ if (editor instanceof JSPMultiPageEditor) {
+ JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) editor;
VpeController vpeController = (VpeController) jspEditor
.getVisualEditor().getController();
- //if called in initialization time, vpe controller is null
- //added by Maksim Areshkau
- if(vpeController!=null)
- vpeController.getPageContext().getEditPart()
- .fillContainer(true, orientation);
+ // if called in initialization time, vpe controller is null
+ // added by Maksim Areshkau
+ if (vpeController != null)
+ vpeController.getPageContext().getEditPart()
+ .fillContainer(true, orientation);
}
}
}