use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.
the class SelectSameTypeAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
RadComponent rootComponent = myArea.getRootComponent();
if (rootComponent != null) {
final List<RadComponent> selection = myArea.getSelection();
final List<RadComponent> components = new ArrayList<>();
rootComponent.accept(new RadComponentVisitor() {
@Override
public void endVisit(RadComponent component) {
if (!component.isBackground()) {
for (RadComponent selected : selection) {
if (selected.isSameType(component)) {
components.add(component);
break;
}
}
}
}
}, true);
myArea.setSelection(components);
}
}
use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.
the class SelectSiblingsAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
RadComponent rootComponent = myArea.getRootComponent();
if (rootComponent != null) {
final Set<RadComponent> parents = RadComponent.getParents(myArea.getSelection());
final List<RadComponent> components = new ArrayList<>();
rootComponent.accept(new RadComponentVisitor() {
@Override
public void endVisit(RadComponent component) {
if (parents.contains(component.getParent())) {
components.add(component);
}
}
}, true);
myArea.setSelection(components);
}
}
use of com.intellij.designer.model.RadComponent 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
}
use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.
the class ComponentTree method extractComponent.
@Nullable
public RadComponent extractComponent(Object value) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
Object userObject = node.getUserObject();
if (myDesigner != null && userObject instanceof TreeNodeDescriptor) {
TreeNodeDescriptor descriptor = (TreeNodeDescriptor) userObject;
Object element = descriptor.getElement();
if (element instanceof RadComponent) {
return (RadComponent) element;
}
}
return null;
}
use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.
the class TreeEditOperation method isTarget.
public static boolean isTarget(RadComponent container, OperationContext context) {
Point location = context.getLocation();
RadComponent target = context.getArea().findTarget(location.x, location.y, null);
if (target == container) {
FeedbackTreeLayer layer = context.getArea().getFeedbackTreeLayer();
return !layer.isBeforeLocation(target, location.x, location.y) && !layer.isAfterLocation(target, location.x, location.y);
}
return true;
}
Aggregations