Search in sources :

Example 6 with BooleanValueStyle

use of org.eclipse.gmf.runtime.notation.BooleanValueStyle 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 7 with BooleanValueStyle

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

the class StateViewFactory method decorateView.

@SuppressWarnings("unchecked")
@Override
protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
    super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
    IAdaptable eObjectAdapter = null;
    EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
    if (eObject != null) {
        eObjectAdapter = new EObjectAdapter(eObject);
    }
    // State name
    FactoryUtils.createLabel(view, SemanticHints.STATE_NAME);
    // Text compartment
    getViewService().createNode(eObjectAdapter, view, SemanticHints.STATE_TEXT_COMPARTMENT, ViewUtil.APPEND, true, getPreferencesHint());
    // Figure compartment
    getViewService().createNode(eObjectAdapter, view, SemanticHints.STATE_FIGURE_COMPARTMENT, ViewUtil.APPEND, true, getPreferencesHint());
    // Create a boolean value style that indicates the alignment of
    // subregions
    BooleanValueStyle layout = (BooleanValueStyle) NotationFactory.eINSTANCE.createBooleanValueStyle();
    layout.setBooleanValue(true);
    layout.setName(ALIGNMENT_ORIENTATION);
    view.getStyles().add(layout);
    IPreferenceStore store = (IPreferenceStore) getPreferencesHint().getPreferenceStore();
    if (store == null) {
        return;
    }
    // Create states default styles
    ShapeStyle style = (ShapeStyle) view.getStyle(NotationPackage.Literals.SHAPE_STYLE);
    RGB fillRGB = PreferenceConverter.getColor(store, StatechartPreferenceConstants.PREF_STATE_BACKGROUND);
    style.setFillColor(FigureUtilities.RGBToInteger(fillRGB));
    RGB lineRGB = PreferenceConverter.getColor(store, StatechartPreferenceConstants.PREF_STATE_LINE);
    style.setLineColor(FigureUtilities.RGBToInteger(lineRGB));
}
Also used : BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle) IAdaptable(org.eclipse.core.runtime.IAdaptable) EObject(org.eclipse.emf.ecore.EObject) ShapeStyle(org.eclipse.gmf.runtime.notation.ShapeStyle) EObjectAdapter(org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) RGB(org.eclipse.swt.graphics.RGB)

Example 8 with BooleanValueStyle

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

the class StatechartDiagramViewFactory method createStyles.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected List createStyles(View view) {
    BooleanValueStyle inlineDefinitionSectionStyle = DiagramPartitioningUtil.createInlineDefinitionSectionStyle();
    view.getStyles().add(inlineDefinitionSectionStyle);
    return super.createStyles(view);
}
Also used : BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle)

Example 9 with BooleanValueStyle

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

the class StatechartDefinitionSection method updateInlineStyle.

protected void updateInlineStyle() {
    TransactionalEditingDomain domain = getTransactionalEditingDomain();
    Diagram diagram = getDiagram();
    BooleanValueStyle inlineStyle = DiagramPartitioningUtil.getInlineDefinitionSectionStyle(diagram);
    if (inlineStyle == null) {
        inlineStyle = DiagramPartitioningUtil.createInlineDefinitionSectionStyle();
        addInlineStyle(inlineStyle, domain);
    }
    setInlineStyleValue(inlineStyle, domain);
}
Also used : BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle) TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) Diagram(org.eclipse.gmf.runtime.notation.Diagram)

Example 10 with BooleanValueStyle

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

the class ExtractSubdiagramRefactoring method setNotationStyle.

/**
 * Sets the GMF inline {@link Style} to true
 */
@SuppressWarnings("unchecked")
protected void setNotationStyle() {
    BooleanValueStyle inlineStyle = getInlineStyle(getContextObject());
    if (inlineStyle == null) {
        inlineStyle = createInlineStyle();
        getContextObject().getStyles().add(inlineStyle);
    }
    inlineStyle.setBooleanValue(false);
}
Also used : BooleanValueStyle(org.eclipse.gmf.runtime.notation.BooleanValueStyle)

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