Search in sources :

Example 1 with MetaModel

use of com.intellij.designer.model.MetaModel in project intellij-community by JetBrains.

the class WrapInAction method fill.

public static void fill(DesignerEditorPanel designer, DefaultActionGroup group, EditableArea area) {
    List<RadComponent> selection = area.getSelection();
    if (selection.isEmpty()) {
        return;
    }
    Set<RadComponent> parents = RadComponent.getParents(selection);
    if (parents.size() != 1) {
        return;
    }
    RadComponent parent = parents.iterator().next();
    if (selection.size() > 1) {
        RadLayout layout = parent.getLayout();
        if (layout != null && !layout.isWrapIn(selection)) {
            return;
        }
    }
    WrapInProvider provider = designer.getWrapInProvider();
    if (provider == null) {
        return;
    }
    List<MetaModel> models = provider.getModels();
    if (models.isEmpty()) {
        return;
    }
    DefaultActionGroup wrapGroup = new DefaultActionGroup("Wrap In", true);
    for (MetaModel wrapModel : models) {
        wrapGroup.add(new WrapInAction(designer, area, provider, parent, selection, wrapModel));
    }
//group.add(wrapGroup); // XXX
}
Also used : MetaModel(com.intellij.designer.model.MetaModel) RadLayout(com.intellij.designer.model.RadLayout) RadComponent(com.intellij.designer.model.RadComponent) WrapInProvider(com.intellij.designer.model.WrapInProvider) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 2 with MetaModel

use of com.intellij.designer.model.MetaModel in project intellij-community by JetBrains.

the class MorphingAction method fill.

public static void fill(DesignerEditorPanel designer, DefaultActionGroup group, EditableArea area) {
    List<RadComponent> selection = area.getSelection();
    if (selection.isEmpty()) {
        return;
    }
    MetaModel model = null;
    for (RadComponent component : selection) {
        if (model == null) {
            model = component.getMetaModel();
        } else if (model != component.getMetaModel()) {
            return;
        }
    }
    if (model == null) {
        return;
    }
    List<MetaModel> models = model.getMorphingModels();
    if (models.isEmpty()) {
        return;
    }
    DefaultActionGroup morphingGroup = new DefaultActionGroup("Morphing", true);
    for (MetaModel morphingModel : models) {
        morphingGroup.add(new MorphingAction(designer, area, selection, morphingModel));
    }
    group.add(morphingGroup);
}
Also used : MetaModel(com.intellij.designer.model.MetaModel) RadComponent(com.intellij.designer.model.RadComponent) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Aggregations

MetaModel (com.intellij.designer.model.MetaModel)2 RadComponent (com.intellij.designer.model.RadComponent)2 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)2 RadLayout (com.intellij.designer.model.RadLayout)1 WrapInProvider (com.intellij.designer.model.WrapInProvider)1