Search in sources :

Example 1 with BooleanValueStyle

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

the class ExtractSubdiagramRefactoring method isExecutable.

@Override
public boolean isExecutable() {
    EObject element = getContextObject().getElement();
    if (!(element instanceof State)) {
        return false;
    }
    State state = (State) element;
    BooleanValueStyle inlineStyle = getInlineStyle(getContextObject());
    return super.isExecutable() && state.isComposite() && (inlineStyle == null || inlineStyle.isBooleanValue());
}
Also used : BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle) State(org.yakindu.sct.model.sgraph.State) EObject(org.eclipse.emf.ecore.EObject)

Example 2 with BooleanValueStyle

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

the class CreateSubdiagramCommand method isEnabled.

@Override
public boolean isEnabled() {
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow == null)
        return false;
    ISelection selection = activeWorkbenchWindow.getActivePage().getSelection();
    if (selection == null)
        return false;
    Node unwrap = unwrap(selection);
    if (unwrap == null) {
        return false;
    }
    State state = (State) unwrap.getElement();
    if (state == null || state.isComposite())
        return false;
    BooleanValueStyle inlineStyle = DiagramPartitioningUtil.getInlineStyle(unwrap);
    if (inlineStyle != null && !inlineStyle.isBooleanValue())
        return false;
    return super.isEnabled();
}
Also used : BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) State(org.yakindu.sct.model.sgraph.State) Node(org.eclipse.gmf.runtime.notation.Node) ISelection(org.eclipse.jface.viewers.ISelection)

Example 3 with BooleanValueStyle

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

the class DiagramPartitioningUtil method createInlineDefinitionSectionStyle.

/**
 * creates a new style for diagam inlining
 */
public static BooleanValueStyle createInlineDefinitionSectionStyle() {
    BooleanValueStyle result = NotationFactory.eINSTANCE.createBooleanValueStyle();
    result.setName(INLINE_DEFINITION_SECTION_STYLE);
    result.setBooleanValue(false);
    return result;
}
Also used : BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle)

Example 4 with BooleanValueStyle

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

the class DiagramPartitioningUtil method createInlineStyle.

/**
 * creates a new style for diagam inlining
 */
public static BooleanValueStyle createInlineStyle() {
    BooleanValueStyle result = NotationFactory.eINSTANCE.createBooleanValueStyle();
    result.setName(INLINE_STYLE);
    result.setBooleanValue(true);
    return result;
}
Also used : BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle)

Example 5 with BooleanValueStyle

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

the class StateCompartmentCreationEditPolicy method getCreateCommand.

@Override
protected Command getCreateCommand(CreateViewRequest request) {
    StateEditPart parent = (StateEditPart) getHost().getParent();
    BooleanValueStyle isInline = GMFNotationUtil.getBooleanValueStyle(parent.getNotationView(), DiagramPartitioningUtil.INLINE_STYLE);
    if (isInline != null && !isInline.isBooleanValue())
        return UnexecutableCommand.INSTANCE;
    List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors();
    for (ViewDescriptor viewDescriptor : viewDescriptors) {
        String semanticHint = viewDescriptor.getSemanticHint();
        if (ViewType.NOTE.equals(semanticHint) || ViewType.NOTEATTACHMENT.equals(semanticHint) || ViewType.TEXT.equals(semanticHint)) {
            return UnexecutableCommand.INSTANCE;
        }
    }
    return super.getCreateCommand(request);
}
Also used : StateEditPart(org.yakindu.sct.ui.editor.editparts.StateEditPart) BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle) ViewDescriptor(org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor)

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