Search in sources :

Example 11 with BooleanValueStyle

use of org.eclipse.gmf.runtime.notation.BooleanValueStyle in project statecharts by Yakindu.

the class InlineSubdiagramRefactoring method internalExecute.

@SuppressWarnings("unchecked")
@Override
protected void internalExecute() {
    BooleanValueStyle inlineStyle = getInlineStyle(getContextObject());
    if (inlineStyle == null) {
        inlineStyle = createInlineStyle();
        getContextObject().getStyles().add(inlineStyle);
    }
    inlineStyle.setBooleanValue(true);
    View contextView = getContextObject();
    State contextElement = (State) contextView.getElement();
    Diagram diagramToInline = DiagramPartitioningUtil.getSubDiagram(contextElement);
    View containerView = ViewUtil.getChildBySemanticHint(contextView, SemanticHints.STATE_FIGURE_COMPARTMENT);
    while (diagramToInline.getChildren().size() > 0) {
        containerView.insertChild((View) diagramToInline.getChildren().get(0));
    }
    while (diagramToInline.getEdges().size() > 0) {
        containerView.getDiagram().insertEdge((Edge) diagramToInline.getEdges().get(0));
    }
    getResource().getContents().remove(diagramToInline);
}
Also used : BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle) State(org.yakindu.sct.model.sgraph.State) View(org.eclipse.gmf.runtime.notation.View) Diagram(org.eclipse.gmf.runtime.notation.Diagram)

Aggregations

BooleanValueStyle (org.eclipse.gmf.runtime.notation.BooleanValueStyle)11 State (org.yakindu.sct.model.sgraph.State)3 EObject (org.eclipse.emf.ecore.EObject)2 Diagram (org.eclipse.gmf.runtime.notation.Diagram)2 StateEditPart (org.yakindu.sct.ui.editor.editparts.StateEditPart)2 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)1 ViewDescriptor (org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor)1 EObjectAdapter (org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter)1 Node (org.eclipse.gmf.runtime.notation.Node)1 ShapeStyle (org.eclipse.gmf.runtime.notation.ShapeStyle)1 View (org.eclipse.gmf.runtime.notation.View)1 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 ISelection (org.eclipse.jface.viewers.ISelection)1 RGB (org.eclipse.swt.graphics.RGB)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1