Search in sources :

Example 1 with StateEditPart

use of org.yakindu.sct.ui.editor.editparts.StateEditPart in project statecharts by Yakindu.

the class ToggleSubRegionLayoutCommand method unwrap.

protected View unwrap(ISelection selection) {
    IStructuredSelection structuredSelection = (IStructuredSelection) selection;
    Object firstElement = structuredSelection.getFirstElement();
    if (firstElement == null)
        return null;
    return ((StateEditPart) firstElement).getNotationView();
}
Also used : StateEditPart(org.yakindu.sct.ui.editor.editparts.StateEditPart) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 2 with StateEditPart

use of org.yakindu.sct.ui.editor.editparts.StateEditPart 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)

Example 3 with StateEditPart

use of org.yakindu.sct.ui.editor.editparts.StateEditPart in project statecharts by Yakindu.

the class StateCompartmentCanonicalEditPolicy method getSemanticChildrenList.

@SuppressWarnings("rawtypes")
@Override
protected List getSemanticChildrenList() {
    StateEditPart parent = (StateEditPart) getHost().getParent();
    BooleanValueStyle isInline = GMFNotationUtil.getBooleanValueStyle(parent.getNotationView(), INLINE_STYLE);
    if (isInline == null || isInline.isBooleanValue())
        return getSemanticHost().getRegions();
    return Collections.EMPTY_LIST;
}
Also used : StateEditPart(org.yakindu.sct.ui.editor.editparts.StateEditPart) BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle)

Example 4 with StateEditPart

use of org.yakindu.sct.ui.editor.editparts.StateEditPart in project statecharts by Yakindu.

the class AbstractStateRefactoringHandler method setContext.

@Override
public void setContext(AbstractRefactoring<State> refactoring, ISelection selection) {
    StateEditPart element = (StateEditPart) getFirstElement(selection);
    if (element == null) {
        refactoring.setContextObjects(Collections.<State>emptyList());
    } else {
        State state = element.resolveSemanticElement();
        refactoring.setContextObjects(Lists.newArrayList(state));
    }
}
Also used : StateEditPart(org.yakindu.sct.ui.editor.editparts.StateEditPart) State(org.yakindu.sct.model.sgraph.State)

Aggregations

StateEditPart (org.yakindu.sct.ui.editor.editparts.StateEditPart)4 BooleanValueStyle (org.eclipse.gmf.runtime.notation.BooleanValueStyle)2 ViewDescriptor (org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 State (org.yakindu.sct.model.sgraph.State)1