Explorar el Código

enable Show Documentation Action on Transition Label

Andreas Mülder hace 13 años
padre
commit
eae56ea5cf

+ 5 - 1
plugins/org.yakindu.sct.ui.editor/plugin.xml

@@ -879,7 +879,7 @@
        </command>
        <command
              commandId="org.yakindu.sct.ui.editor.commands.ToggleShowDocumentation"
-             label="Toggle Documentation"
+             label="Show / Hide Documentation"
              style="push">
           <visibleWhen
                 checkEnabled="false">
@@ -891,6 +891,9 @@
                    <or>
                       <instanceof
                             value="org.yakindu.sct.ui.editor.editparts.TransitionEditPart">
+                      </instanceof>
+                        <instanceof
+                            value="org.yakindu.sct.ui.editor.editparts.TransitionExpressionEditPart">
                       </instanceof>
                       <instanceof
                             value="org.yakindu.sct.ui.editor.editparts.StateEditPart">
@@ -898,6 +901,7 @@
                       <instanceof
                             value="org.yakindu.sct.ui.editor.editparts.StatechartTextEditPart">
                       </instanceof>
+                      
                    </or>
                 </iterate>
              </with>

+ 8 - 1
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/commands/ToggleShowDocumentationCommand.java

@@ -16,6 +16,7 @@ import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.commands.operations.OperationHistoryFactory;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
 import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
 import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
 import org.eclipse.gmf.runtime.notation.NotationFactory;
@@ -84,6 +85,12 @@ public class ToggleShowDocumentationCommand extends AbstractHandler {
 		Object firstElement = structuredSelection.getFirstElement();
 		if (firstElement == null)
 			return null;
-		return ((IGraphicalEditPart) firstElement).getNotationView();
+		IGraphicalEditPart editPart = (IGraphicalEditPart) firstElement;
+		if (editPart instanceof IPrimaryEditPart)
+			return editPart.getNotationView();
+		else {
+			return ((IGraphicalEditPart) editPart.getParent())
+					.getNotationView();
+		}
 	}
 }