Author: dvinnichek
Date: 2010-11-04 05:27:53 -0400 (Thu, 04 Nov 2010)
New Revision: 26244
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBundleAsELHandler.java
Log:
show bundle's messages as EL expressions on all opened vpe pages by clicking 'show
bundle's messages as EL expressions' button on toolbar
(
https://jira.jboss.org/browse/JBIDE-7383)
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBundleAsELHandler.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBundleAsELHandler.java 2010-11-04
08:33:27 UTC (rev 26243)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBundleAsELHandler.java 2010-11-04
09:27:53 UTC (rev 26244)
@@ -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;
@@ -65,22 +66,31 @@
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_RESOURCE_BUNDLES_USAGE_AS_EL);
+
+ IEditorReference[] openedEditors = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage()
+ .getEditorReferences();
+ for (IEditorReference openedEditor : openedEditors) {
+ IEditorPart editor = openedEditor.getEditor(true);
+ toggleShowBundleAsEl(editor, toggleState);
+ }
+ }
+
+ private void toggleShowBundleAsEl(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_RESOURCE_BUNDLES_USAGE_AS_EL);
-
/*
* Update bundle messages.
*/