Author: dvinnichek
Date: 2010-11-04 03:57:56 -0400 (Thu, 04 Nov 2010)
New Revision: 26242
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowNonVisualTagsHandler.java
Log:
show non-visual tags on all opened vpe pages by clicking 'show non-visual tags'
button on toolbar (
https://jira.jboss.org/browse/JBIDE-7383)
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowNonVisualTagsHandler.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowNonVisualTagsHandler.java 2010-11-04
07:41:25 UTC (rev 26241)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowNonVisualTagsHandler.java 2010-11-04
07:57:56 UTC (rev 26242)
@@ -18,6 +18,7 @@
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.commands.IElementUpdater;
@@ -64,18 +65,29 @@
public void updateElement(UIElement element, Map parameters) {
- IEditorPart activeEditor = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (!(activeEditor instanceof JSPMultiPageEditor)) {
+ boolean toggleState = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getBoolean(IVpePreferencesPage.SHOW_NON_VISUAL_TAGS);
+
+ IEditorReference[] openedEditors = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage()
+ .getEditorReferences();
+ for (IEditorReference openedEditor : openedEditors) {
+ IEditorPart editor = openedEditor.getEditor(true);
+ toggleShowNonVisualElements(editor, toggleState);
+ }
+ }
+
+ private void toggleShowNonVisualElements(IEditorPart editor,
+ boolean toggleState) {
+
+ if (!(editor instanceof JSPMultiPageEditor)) {
return;
}
- JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) activeEditor;
+ JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) editor;
VpeController vpeController = (VpeController) jspEditor
.getVisualEditor().getController();
- boolean toggleState = JspEditorPlugin.getDefault().getPreferenceStore()
- .getBoolean(IVpePreferencesPage.SHOW_NON_VISUAL_TAGS);
/*
* Change flag
*/