[jbosstools-commits] JBoss Tools SVN: r42650 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe: handlers and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Jul 19 09:48:24 EDT 2012


Author: dmaliarevich
Date: 2012-07-19 09:48:24 -0400 (Thu, 19 Jul 2012)
New Revision: 42650

Modified:
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java
Log:
https://issues.jboss.org/browse/JBIDE-12344 - Rotate editor's handler should fire the changed event, VpeController code adjustments.

Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java	2012-07-19 10:57:07 UTC (rev 42649)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java	2012-07-19 13:48:24 UTC (rev 42650)
@@ -1830,23 +1830,25 @@
 	public void refreshCommands(){
 		ICommandService commandService = (ICommandService) 
 				editPart.getSite().getService(ICommandService.class);
-		for (String commandId : getVpeCategoryCommands()) {
-			/*
-			 * https://issues.jboss.org/browse/JBIDE-12290
-			 * In eclipse 4.2 commandService could be null.
-			 */
-			if (commandService != null) {
+		/*
+		 * https://issues.jboss.org/browse/JBIDE-12290
+		 * In eclipse 4.2 commandService could be null.
+		 */
+		if (commandService != null) {
+			for (String commandId : getVpeCategoryCommands()) {
 				commandService.refreshElements(commandId, null);
 			} 
 		}
 	}
 
 	private List<String> getVpeCategoryCommands() {
-		ICommandService commandService = (ICommandService) PlatformUI
-				.getWorkbench().getService(ICommandService.class);
-		
-		//init VPE Commands List if its has not been initialized
+		/*
+		 * initialize  VPE Commands List 
+		 * if its has not been initialized yet
+		 */
 		if (vpeCategoryCommands == null) {
+			ICommandService commandService = (ICommandService) 
+					editPart.getSite().getService(ICommandService.class);
 			vpeCategoryCommands = new ArrayList<String>();
 			Command [] definedCommands = commandService.getDefinedCommands();
 			for (Command command : definedCommands) {
@@ -1860,7 +1862,6 @@
 				}
 			}
 		}
-		
 		return vpeCategoryCommands;
 	}	
 

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	2012-07-19 10:57:07 UTC (rev 42649)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/handlers/RotateEditorsHandler.java	2012-07-19 13:48:24 UTC (rev 42650)
@@ -19,8 +19,8 @@
 import org.eclipse.core.commands.Command;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.HandlerEvent;
 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.PlatformUI;
@@ -137,6 +137,13 @@
 		element.setIcon(VpePlugin.imageDescriptorFromPlugin(
 				VpePlugin.PLUGIN_ID, layoutIcons.get(orientation)));
 		element.setTooltip(layoutNamesAndTooltips.get(orientation));
+		/*
+		 * https://issues.jboss.org/browse/JBIDE-12344
+		 * Listeners should get this event and update the icons state.
+		 * This method is overridden from VisualPartAbstractHandler, 
+		 *  so should fire the event also.
+		 */
+		fireHandlerChanged(new HandlerEvent(this, true, false));
 	}
 
 	private void rotateEditor(IEditorPart editor, String orientation) {



More information about the jbosstools-commits mailing list