فهرست منبع

Refactored context menu actions into command handlers.

tomqc86@googlemail.com 12 سال پیش
والد
کامیت
37bf908b81

+ 107 - 49
plugins/org.yakindu.sct.ui.editor/plugin.xml

@@ -787,54 +787,114 @@
       </extension>
    
    <!-- context menu contribution -->
-     <extension point="org.eclipse.ui.commands">
-	<command description="Change Flow Kind" id="org.yakindu.sct.ui.editor.Entry" name="Change Entry Kind">
+<extension point="org.eclipse.ui.commands">
+ 	<command
+       defaultHandler="org.yakindu.sct.ui.editor.commands.SetInitialEntryKindCommand"
+       id="org.yakindu.sct.ui.editor.commands.SetInitialEntryKindCommand"
+       name="Set Initial Entry Kind">
 	</command>
+ 	<command
+       defaultHandler="org.yakindu.sct.ui.editor.commands.SetDeepHistoryEntryKindCommand"
+       id="org.yakindu.sct.ui.editor.commands.SetDeepHistoryEntryKindCommand"
+       name="Set Deep History Entry Kind">
+ 	</command>
+ 	<command
+       defaultHandler="org.yakindu.sct.ui.editor.commands.SetShallowHistoryEntryKindCommand"
+       id="org.yakindu.sct.ui.editor.commands.SetShallowHistoryEntryKindCommand"
+       name="Set Shallow History Entry Kind">
+ 	</command>
+ 	<command
+       defaultHandler="org.yakindu.sct.ui.editor.commands.ToggleSubRegionLayoutCommand"
+       id="org.yakindu.sct.ui.editor.commands.ToggleSubRegionLayoutCommand"
+       name="Toggle Subregion Layout">
+ 	</command>
 </extension>
-   <extension point="org.eclipse.ui.popupMenus">
-      <objectContribution
-            adaptable="false"
-            id="org.yakindu.sct.ui.editor.Entry"
-            objectClass="org.yakindu.sct.ui.editor.editparts.EntryEditPart">
-         <menu 
-            id="Entry" label="Change Entry Kind" path="additions"> 
-            <separator name="group1"/>
-         </menu>
-          <action
-               class="org.yakindu.sct.ui.editor.actions.SetDeepHistoryEntryKindCommand"
-               definitionId="org.yakindu.sct.ui.editor.Entry"
-               id="org.yakindu.sct.ui.editor.DeepHistory"
-               label="DeepHistory"
-               menubarPath="Entry/group1">
-         </action>
-           <action
-               class="org.yakindu.sct.ui.editor.actions.SetShallowHistoryEntryKindCommand"
-               definitionId="org.yakindu.sct.ui.editor.Entry"
-               id="org.yakindu.sct.ui.editor.ShallowHistory"
-               label="ShallowHistory"
-               menubarPath="Entry/group1">
-         </action>
-           <action
-               class="org.yakindu.sct.ui.editor.actions.SetInitialEntryKindCommand"
-               definitionId="org.yakindu.sct.ui.editor.Entry"
-               id="org.yakindu.sct.ui.editor.Initial"
-               label="Initial"
-               menubarPath="Entry/group1">
-         </action>
-      </objectContribution>       
-      <objectContribution
-            adaptable="false"
-            id="org.yakindu.sct.ui.editor.regionLayout"
-            objectClass="org.yakindu.sct.ui.editor.editparts.StateEditPart">
-          <action
-               class="org.yakindu.sct.ui.editor.actions.ToggleSubRegionLayoutCommand"
-               definitionId="org.yakindu.sct.ui.editor.regionLayout"
-               id="org.yakindu.sct.ui.editor.regionLayout.toggle"
-               label="Toggle subregion alignment"
-               menubarPath="additions">
-         </action>    
-      </objectContribution>           
-</extension>
+
+<extension
+       point="org.eclipse.ui.menus">
+    <menuContribution
+          allPopups="false"
+          locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu">
+       <menu
+             id="changeEntryKindMenu"
+             label="Change Entry Kind">
+          <command
+                commandId="org.yakindu.sct.ui.editor.commands.SetInitialEntryKindCommand"
+                label="Initial"
+                style="push">
+             <visibleWhen
+                   checkEnabled="false">
+                <reference
+                      definitionId="oneEntrySelected">
+                </reference>
+             </visibleWhen>
+          </command>
+          <command
+                commandId="org.yakindu.sct.ui.editor.commands.SetDeepHistoryEntryKindCommand"
+                label="Deep History"
+                style="push">
+             <visibleWhen
+                   checkEnabled="false">
+                <reference
+                      definitionId="oneEntrySelected">
+                </reference>
+             </visibleWhen>
+          </command>
+          <command
+                commandId="org.yakindu.sct.ui.editor.commands.SetShallowHistoryEntryKindCommand"
+                label="Shallow History"
+                style="push">
+             <visibleWhen
+                   checkEnabled="false">
+                <reference
+                      definitionId="oneEntrySelected">
+                </reference>
+             </visibleWhen>
+          </command>
+       </menu>
+       <command
+             commandId="org.yakindu.sct.ui.editor.commands.ToggleSubRegionLayoutCommand"
+             label="Toggle Subregion Alignment"
+             style="push">
+          <visibleWhen
+                checkEnabled="false">
+             <with
+                   variable="selection">
+                <iterate
+                      ifEmpty="false"
+                      operator="and">
+                   <instanceof
+                         value="org.yakindu.sct.ui.editor.editparts.StateEditPart">
+                   </instanceof>
+                </iterate>
+             </with>
+          </visibleWhen>
+       </command>
+    </menuContribution>
+ </extension>
+ 
+ <extension
+       point="org.eclipse.core.expressions.definitions">
+    <definition
+          id="oneEntrySelected">
+       <with
+             variable="selection">
+          <and>
+             <count
+                   value="1">
+             </count>
+             <iterate
+                   ifEmpty="false"
+                   operator="and">
+                <instanceof
+                      value="org.yakindu.sct.ui.editor.editparts.EntryEditPart">
+                </instanceof>
+             </iterate>
+          </and>
+       </with>
+    </definition>
+ </extension>
+
 
 <!-- Patched Clipboard support -->
  <extension
@@ -844,8 +904,6 @@
             nsURI="http://www.eclipse.org/gmf/runtime/1.0.2/notation"
             priority="medium">
       </factory>
-   </extension>
-   
+   </extension>   
    
-
 </plugin>

+ 0 - 27
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/actions/SetDeepHistoryEntryKindCommand.java

@@ -1,27 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.editor.actions;
-
-import org.yakindu.sct.model.sgraph.EntryKind;
-
-/**
- * 
- * @author andreas muelder
- * 
- */
-public class SetDeepHistoryEntryKindCommand extends ChangeEntryKindCommand {
-
-	@Override
-	public EntryKind getEntryKind() {
-		return EntryKind.DEEP_HISTORY;
-	}
-
-}

+ 0 - 27
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/actions/SetInitialEntryKindCommand.java

@@ -1,27 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.editor.actions;
-
-import org.yakindu.sct.model.sgraph.EntryKind;
-
-/**
- * 
- * @author andreas muelder
- * 
- */
-public class SetInitialEntryKindCommand extends ChangeEntryKindCommand {
-
-	@Override
-	public EntryKind getEntryKind() {
-		return EntryKind.INITIAL;
-	}
-
-}

+ 0 - 27
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/actions/SetShallowHistoryEntryKindCommand.java

@@ -1,27 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.editor.actions;
-
-import org.yakindu.sct.model.sgraph.EntryKind;
-
-/**
- * 
- * @author andreas muelder
- * 
- */
-public class SetShallowHistoryEntryKindCommand extends ChangeEntryKindCommand {
-
-	@Override
-	public EntryKind getEntryKind() {
-		return EntryKind.SHALLOW_HISTORY;
-	}
-
-}

+ 11 - 0
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/commands/SetDeepHistoryEntryKindCommand.java

@@ -0,0 +1,11 @@
+package org.yakindu.sct.ui.editor.commands;
+
+import org.yakindu.sct.model.sgraph.EntryKind;
+
+public class SetDeepHistoryEntryKindCommand extends SetEntryKindCommand {
+
+	public EntryKind getEntryKind() {
+		return EntryKind.DEEP_HISTORY;
+	}
+
+}

+ 65 - 82
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/actions/ChangeEntryKindCommand.java

@@ -1,82 +1,65 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.editor.actions;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IActionDelegate;
-import org.yakindu.sct.model.sgraph.Entry;
-import org.yakindu.sct.model.sgraph.EntryKind;
-import org.yakindu.sct.model.sgraph.SGraphPackage;
-import org.yakindu.sct.ui.editor.editparts.EntryEditPart;
-
-/**
- * Abstract base class for {@link IActionDelegate} that change the entry kind of
- * an Entry.
- * 
- * @author andreas muelder
- * 
- */
-public abstract class ChangeEntryKindCommand implements IActionDelegate {
-
-	private Entry entry;
-
-	public abstract EntryKind getEntryKind();
-
-	/**
-	 * Unwraps the given selection
-	 * 
-	 * @param selection
-	 * @return
-	 */
-	public Entry unwrap(ISelection selection) {
-		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-		Object firstElement = structuredSelection.getFirstElement();
-		if (firstElement == null)
-			return null;
-		return ((EntryEditPart) firstElement).resolveSemanticElement();
-	}
-
-	public void run(IAction action) {
-
-		if (entry == null)
-			return;
-		SetValueCommand setCommand = new SetValueCommand(new SetRequest(entry,
-				SGraphPackage.Literals.ENTRY__KIND, getEntryKind()));
-		IOperationHistory history = OperationHistoryFactory
-				.getOperationHistory();
-		try {
-			history.execute(setCommand, new NullProgressMonitor(), null);
-		} catch (ExecutionException e) {
-			e.printStackTrace();
-		}
-	}
-
-	public void selectionChanged(IAction action, ISelection selection) {
-		entry = unwrap(selection);
-		if (entry == null)
-			return;
-		if (entry.getKind().equals(getEntryKind())) {
-			action.setEnabled(false);
-			action.setChecked(true);
-		} else {
-			action.setEnabled(true);
-			action.setChecked(false);
-		}
-	}
-}
+package org.yakindu.sct.ui.editor.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.yakindu.sct.model.sgraph.Entry;
+import org.yakindu.sct.model.sgraph.EntryKind;
+import org.yakindu.sct.model.sgraph.SGraphPackage;
+import org.yakindu.sct.ui.editor.editparts.EntryEditPart;
+
+public abstract class SetEntryKindCommand extends AbstractHandler {
+
+	private Entry entry;
+	
+	public abstract EntryKind getEntryKind();
+	
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		entry = unwrap(HandlerUtil.getCurrentSelection(event));
+		
+		if (entry == null)
+			return null;
+		SetValueCommand setCommand = new SetValueCommand(new SetRequest(entry,
+				SGraphPackage.Literals.ENTRY__KIND, getEntryKind()));
+		IOperationHistory history = OperationHistoryFactory
+				.getOperationHistory();
+		try {
+			history.execute(setCommand, new NullProgressMonitor(), null);
+		} catch (ExecutionException e) {
+			e.printStackTrace();
+		}
+		
+		return null;
+	}
+	
+	/**
+	 * Unwraps the given selection
+	 * 
+	 * @param selection
+	 * @return
+	 */
+	public Entry unwrap(ISelection selection) {
+		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+		Object firstElement = structuredSelection.getFirstElement();
+		if (firstElement == null)
+			return null;
+		return ((EntryEditPart) firstElement).resolveSemanticElement();
+	}
+	
+	@Override
+	public boolean isEnabled() {
+		ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection();
+		entry = unwrap(selection);
+		return !entry.getKind().equals(getEntryKind());
+	}
+
+}

+ 11 - 0
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/commands/SetInitialEntryKindCommand.java

@@ -0,0 +1,11 @@
+package org.yakindu.sct.ui.editor.commands;
+
+import org.yakindu.sct.model.sgraph.EntryKind;
+
+public class SetInitialEntryKindCommand extends SetEntryKindCommand {
+
+	public EntryKind getEntryKind() {
+		return EntryKind.INITIAL;
+	}
+	
+}

+ 12 - 0
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/commands/SetShallowHistoryEntryKindCommand.java

@@ -0,0 +1,12 @@
+package org.yakindu.sct.ui.editor.commands;
+
+import org.yakindu.sct.model.sgraph.EntryKind;
+
+public class SetShallowHistoryEntryKindCommand extends SetEntryKindCommand {
+
+	@Override
+	public EntryKind getEntryKind() {
+		return EntryKind.SHALLOW_HISTORY;
+	}
+
+}

+ 119 - 135
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/actions/ToggleSubRegionLayoutCommand.java

@@ -1,135 +1,119 @@
-/**
- * Copyright (c) 2010 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are 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
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.editor.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.common.core.command.CommandResult;
-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
-import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
-import org.eclipse.gmf.runtime.notation.NotationFactory;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IActionDelegate;
-import org.yakindu.sct.ui.editor.editparts.StateEditPart;
-
-/**
- * Action that toggles the alignment flag in the notation view element
- * 
- * @author andreas muelder
- * @author terfloth
- * 
- */
-public class ToggleSubRegionLayoutCommand implements IActionDelegate {
-
-	private View view;
-
-	public void run(IAction arg0) {
-		TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(view);
-		ToggleCommand toggleCommand = new ToggleCommand(editingDomain, view);
-		
-		try {
-			OperationHistoryFactory.getOperationHistory().execute(toggleCommand, new NullProgressMonitor(), null);
-		} catch (ExecutionException e) {
-			e.printStackTrace();
-		}
-
-	}
-
-	protected View unwrap(ISelection selection) {
-		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-		Object firstElement = structuredSelection.getFirstElement();
-		if (firstElement == null)
-			return null;
-		return ((StateEditPart) firstElement).getNotationView();
-	}
-
-	public void selectionChanged(IAction arg0, ISelection selection) {
-		view = unwrap(selection);
-	}
-
-	
-	/**
-	 * GMF command class...
-	 * 
-	 * @author terfloth
-	 */
-	protected static class ToggleCommand extends AbstractTransactionalCommand {
-		
-		protected static final String TOGGLE_REGION_ALIGNMENT = "Toggle Region Alignment";
-
-		protected View view; 
-		
-		public ToggleCommand(TransactionalEditingDomain editingDomain, View view) {
-			super(editingDomain, TOGGLE_REGION_ALIGNMENT, null);
-			this.view = view;
-		}
-
-	    @SuppressWarnings({ "rawtypes", "unchecked" })
-		public List getAffectedFiles() {
-	    	
-	        if (view != null) {
-	            List result = new ArrayList();
-	            IFile file = WorkspaceSynchronizer.getFile(view.eResource());
-	            
-	            if (file != null) {
-	                result.add(file);
-	            }
-	            return result;
-	        }
-	        
-	        return super.getAffectedFiles();
-	    }
-
-		/** 
-		 * Executes the command that switches the subregion layout orientation.
-		 */
-		@SuppressWarnings("unchecked")
-		protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
-	            IAdaptable info)
-	        throws ExecutionException {
-	        
-			BooleanValueStyle style = (BooleanValueStyle) view
-					.getStyle(NotationPackage.Literals.BOOLEAN_VALUE_STYLE);
-			
-			if (style == null) {
-				style = NotationFactory.eINSTANCE.createBooleanValueStyle();
-				style.setBooleanValue(true);
-				view.getStyles().add(style);
-			} else {
-				style.setBooleanValue(! style.isBooleanValue());
-			}
-			
-			return CommandResult.newOKCommandResult(view);
-		}
-
-		/* (non-Javadoc)
-		 * @see org.eclipse.gmf.runtime.common.core.command.ICommand#getLabel()
-		 */
-		public String getLabel() {
-			return TOGGLE_REGION_ALIGNMENT;
-		}
-		
-	}
-}
+package org.yakindu.sct.ui.editor.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.yakindu.sct.ui.editor.editparts.StateEditPart;
+
+public class ToggleSubRegionLayoutCommand extends AbstractHandler {
+
+	private View view;
+	
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		view = unwrap(HandlerUtil.getCurrentSelection(event));
+		
+		TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(view);
+		ToggleCommand toggleCommand = new ToggleCommand(editingDomain, view);
+		
+		try {
+			OperationHistoryFactory.getOperationHistory().execute(toggleCommand, new NullProgressMonitor(), null);
+		} catch (ExecutionException e) {
+			e.printStackTrace();
+		}
+		
+		return null;
+	}
+	
+
+	protected View unwrap(ISelection selection) {
+		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+		Object firstElement = structuredSelection.getFirstElement();
+		if (firstElement == null)
+			return null;
+		return ((StateEditPart) firstElement).getNotationView();
+	}
+	
+	/**
+	 * GMF command class...
+	 * 
+	 * @author terfloth
+	 */
+	protected static class ToggleCommand extends AbstractTransactionalCommand {
+		
+		protected static final String TOGGLE_REGION_ALIGNMENT = "Toggle Region Alignment";
+
+		protected View view; 
+		
+		public ToggleCommand(TransactionalEditingDomain editingDomain, View view) {
+			super(editingDomain, TOGGLE_REGION_ALIGNMENT, null);
+			this.view = view;
+		}
+
+	    @SuppressWarnings({ "rawtypes", "unchecked" })
+		public List getAffectedFiles() {
+	    	
+	        if (view != null) {
+	            List result = new ArrayList();
+	            IFile file = WorkspaceSynchronizer.getFile(view.eResource());
+	            
+	            if (file != null) {
+	                result.add(file);
+	            }
+	            return result;
+	        }
+	        
+	        return super.getAffectedFiles();
+	    }
+
+		/** 
+		 * Executes the command that switches the subregion layout orientation.
+		 */
+		@SuppressWarnings("unchecked")
+		protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+	            IAdaptable info)
+	        throws ExecutionException {
+	        
+			BooleanValueStyle style = (BooleanValueStyle) view
+					.getStyle(NotationPackage.Literals.BOOLEAN_VALUE_STYLE);
+			
+			if (style == null) {
+				style = NotationFactory.eINSTANCE.createBooleanValueStyle();
+				style.setBooleanValue(true);
+				view.getStyles().add(style);
+			} else {
+				style.setBooleanValue(! style.isBooleanValue());
+			}
+			
+			return CommandResult.newOKCommandResult(view);
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.gmf.runtime.common.core.command.ICommand#getLabel()
+		 */
+		public String getLabel() {
+			return TOGGLE_REGION_ALIGNMENT;
+		}
+		
+	}
+
+}