Author: mareshkau
Date: 2010-11-10 05:44:19 -0500 (Wed, 10 Nov 2010)
New Revision: 26404
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowOptionAbstractHandler.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBorderHandler.java
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/ShowNonVisualTagsHandler.java
Log:
https://jira.jboss.org/browse/JBIDE-7531
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath 2010-11-10 10:35:55 UTC
(rev 26403)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath 2010-11-10 10:44:19 UTC
(rev 26404)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry exported="true" kind="lib"
path="lib/jhighlight-1.0.jar"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib"
path="lib/jhighlight-1.0.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBorderHandler.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBorderHandler.java 2010-11-10
10:35:55 UTC (rev 26403)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBorderHandler.java 2010-11-10
10:44:19 UTC (rev 26404)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Copyright (c) 2007-2010 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -11,85 +11,24 @@
package org.jboss.tools.vpe.handlers;
-import java.util.Map;
-
-import org.eclipse.core.commands.Command;
-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.handlers.HandlerUtil;
-import org.eclipse.ui.menus.UIElement;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.vpe.editor.VpeController;
/**
* Handler for ShowBorder
*/
-public class ShowBorderHandler extends VisualPartAbstractHandler {
+public class ShowBorderHandler extends ShowOptionAbstractHandler {
public static final String COMMAND_ID =
"org.jboss.tools.vpe.commands.showBorderCommand"; //$NON-NLS-1$
- /**
- * the command has been executed, so extract extract the needed information
- * from the application context.
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- boolean oldToggleState = HandlerUtil.toggleCommandState(event
- .getCommand());
- JspEditorPlugin
- .getDefault()
- .getPreferenceStore()
- .setValue(IVpePreferencesPage.SHOW_BORDER_FOR_UNKNOWN_TAGS,
- !oldToggleState);
-
- Command command = event.getCommand();
- ICommandService commandService = (ICommandService) PlatformUI
- .getWorkbench().getService(ICommandService.class);
- commandService.refreshElements(command.getId(), null);
-
- return null;
+ @Override
+ public String getPreferenceKey() {
+ return IVpePreferencesPage.SHOW_BORDER_FOR_UNKNOWN_TAGS;
}
- public void updateElement(UIElement element, Map parameters) {
- super.updateElement(element, parameters);
- boolean toggleState = JspEditorPlugin.getDefault().getPreferenceStore()
- .getBoolean(IVpePreferencesPage.SHOW_BORDER_FOR_UNKNOWN_TAGS);
-
- IEditorReference[] openedEditors = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage()
- .getEditorReferences();
- for (IEditorReference openedEditor : openedEditors) {
- IEditorPart editor = openedEditor.getEditor(true);
- toggleShowBorder(editor, toggleState);
- }
- }
-
- private void toggleShowBorder(IEditorPart editor, boolean toggleState) {
-
- if (!(editor instanceof JSPMultiPageEditor)) {
- return;
- }
-
- JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) editor;
- VpeController vpeController = (VpeController) jspEditor
- .getVisualEditor().getController();
- if (vpeController == null) {
- return;
- }
-
- /*
- * Set new value to VpeVisualDomBuilder.
- */
+ @Override
+ protected void toogleShow(VpeController vpeController, boolean state) {
vpeController.getVisualBuilder().setShowBorderForUnknownTags(
- toggleState);
- /*
- * Update VPE
- */
- vpeController.visualRefresh();
+ state);
+
}
}
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-10
10:35:55 UTC (rev 26403)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowBundleAsELHandler.java 2010-11-10
10:44:19 UTC (rev 26404)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Copyright (c) 2007-2010 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -11,86 +11,24 @@
package org.jboss.tools.vpe.handlers;
-import java.util.Map;
-
-import org.eclipse.core.commands.Command;
-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.handlers.HandlerUtil;
-import org.eclipse.ui.menus.UIElement;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.vpe.editor.VpeController;
/**
* Handler for ShowBundleAsEL
*/
-public class ShowBundleAsELHandler extends VisualPartAbstractHandler {
+public class ShowBundleAsELHandler extends ShowOptionAbstractHandler {
public static final String COMMAND_ID =
"org.jboss.tools.vpe.commands.showBundleAsELCommand"; //$NON-NLS-1$
- /**
- * the command has been executed, so extract extract the needed information
- * from the application context.
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- boolean oldToggleState = HandlerUtil.toggleCommandState(event
- .getCommand());
- JspEditorPlugin
- .getDefault()
- .getPreferenceStore()
- .setValue(
- IVpePreferencesPage.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL,
- !oldToggleState);
-
- Command command = event.getCommand();
- ICommandService commandService = (ICommandService) PlatformUI
- .getWorkbench().getService(ICommandService.class);
- commandService.refreshElements(command.getId(), null);
-
- return null;
+ @Override
+ public String getPreferenceKey() {
+ return IVpePreferencesPage.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL;
}
- public void updateElement(UIElement element, Map parameters) {
- super.updateElement(element, parameters);
- 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) editor;
- VpeController vpeController = (VpeController) jspEditor
- .getVisualEditor().getController();
- if (vpeController == null) {
- return;
- }
-
- /*
- * Update bundle messages.
- */
+ @Override
+ protected void toogleShow(VpeController vpeController,
+ boolean state) {
vpeController.getPageContext().getBundle()
- .updateShowBundleUsageAsEL(toggleState);
- vpeController.visualRefresh();
+ .updateShowBundleUsageAsEL(state);
}
}
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-10
10:35:55 UTC (rev 26403)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowNonVisualTagsHandler.java 2010-11-10
10:44:19 UTC (rev 26404)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Copyright (c) 2007-2010 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -11,85 +11,23 @@
package org.jboss.tools.vpe.handlers;
-import java.util.Map;
-
-import org.eclipse.core.commands.Command;
-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.handlers.HandlerUtil;
-import org.eclipse.ui.menus.UIElement;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.vpe.editor.VpeController;
/**
* Handler for ShowNonVisualTags
*/
-public class ShowNonVisualTagsHandler extends VisualPartAbstractHandler {
+public class ShowNonVisualTagsHandler extends ShowOptionAbstractHandler {
public static final String COMMAND_ID =
"org.jboss.tools.vpe.commands.showNonVisualTagsCommand"; //$NON-NLS-1$
- /**
- * the command has been executed, so extract extract the needed information
- * from the application context.
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- boolean oldToggleState = HandlerUtil.toggleCommandState(event
- .getCommand());
- JspEditorPlugin
- .getDefault()
- .getPreferenceStore()
- .setValue(IVpePreferencesPage.SHOW_NON_VISUAL_TAGS,
- !oldToggleState);
-
- Command command = event.getCommand();
- ICommandService commandService = (ICommandService) PlatformUI
- .getWorkbench().getService(ICommandService.class);
- commandService.refreshElements(command.getId(), null);
-
- return null;
+ @Override
+ protected void toogleShow(VpeController vpeController,
+ boolean state) {
+ vpeController.getVisualBuilder().setShowInvisibleTags(state);
}
- public void updateElement(UIElement element, Map parameters) {
- super.updateElement(element, parameters);
- 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);
- }
+ @Override
+ public String getPreferenceKey() {
+ return IVpePreferencesPage.SHOW_NON_VISUAL_TAGS;
}
-
- private void toggleShowNonVisualElements(IEditorPart editor,
- boolean toggleState) {
-
- if (!(editor instanceof JSPMultiPageEditor)) {
- return;
- }
-
- JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) editor;
- VpeController vpeController = (VpeController) jspEditor
- .getVisualEditor().getController();
- if (vpeController == null) {
- return;
- }
-
- /*
- * Change flag
- */
- vpeController.getVisualBuilder().setShowInvisibleTags(toggleState);
- /*
- * Update VPE
- */
- vpeController.visualRefresh();
- }
}
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowOptionAbstractHandler.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowOptionAbstractHandler.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/ShowOptionAbstractHandler.java 2010-11-10
10:44:19 UTC (rev 26404)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.handlers;
+
+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.handlers.HandlerUtil;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
+
+/**
+ * @author mareshkau
+ *
+ */
+public abstract class ShowOptionAbstractHandler extends VisualPartAbstractHandler{
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ boolean toggleState = !HandlerUtil.toggleCommandState(event
+ .getCommand());
+
+ JspEditorPlugin
+ .getDefault()
+ .getPreferenceStore()
+ .setValue(getPreferenceKey(),
+ toggleState);
+
+ IEditorReference[] openedEditors = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage()
+ .getEditorReferences();
+ for (IEditorReference openedEditor : openedEditors) {
+ IEditorPart editor = openedEditor.getEditor(true);
+ toggleShowOption(editor, toggleState);
+ }
+ return null;
+ }
+ private void toggleShowOption(IEditorPart editor, boolean toggleState) {
+
+ if (!(editor instanceof JSPMultiPageEditor)) {
+ return;
+ }
+
+ JSPMultiPageEditor jspEditor = (JSPMultiPageEditor) editor;
+ VpeController vpeController = (VpeController) jspEditor
+ .getVisualEditor().getController();
+ if (vpeController == null) {
+ return;
+ }
+
+ /*
+ * Set new value to VpeVisualDomBuilder.
+ */
+ toogleShow(vpeController,toggleState);
+ /*
+ * Update VPE
+ */
+ vpeController.visualRefresh();
+ }
+ public abstract String getPreferenceKey();
+ /**
+ * Here should be changed appropriate property in visual builder
+ * @param vpeVisualDomBuilder
+ * @param state
+ */
+ protected abstract void toogleShow(VpeController vpeController, boolean state);
+}