use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.
the class MorphingAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
myDesigner.getToolProvider().execute(() -> {
List<RadComponent> newComponents = new ArrayList<>();
for (RadComponent component : myComponents) {
RadComponent newComponent = component.morphingTo(myTarget);
if (newComponent != null) {
newComponents.add(newComponent);
}
}
myArea.setSelection(newComponents);
}, "Run Morphing action", true);
}
use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.
the class SelectionTool method handleButtonDown.
@Override
protected void handleButtonDown(int button) {
if (myState == STATE_INIT) {
myState = STATE_DRAG;
deactivateTracker();
if (handleTracker()) {
return;
}
if (!myArea.isTree()) {
InputTool tracker = myArea.findTargetTool(myCurrentScreenX, myCurrentScreenY);
if (tracker != null) {
setTracker(tracker);
if (tracker instanceof ResizeTracker) {
myArea.showSelection(false);
}
return;
}
}
RadComponent component = myArea.findTarget(myCurrentScreenX, myCurrentScreenY, null);
if (component == null || component.isBackground()) {
if (!myArea.isTree()) {
MarqueeTracker tracker = new MarqueeTracker();
// Allow marquee dragging within the root (background) layout, and if you click
// without dragging, select that background component
tracker.setSelectBackground(component != null && component.isBackground());
setTracker(tracker);
}
} else {
Point location = component.convertPoint(myArea.getNativeComponent(), myCurrentScreenX, myCurrentScreenY);
setTracker(component.getDragTracker(location, myInputEvent, myArea.isTree()));
}
}
}
use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.
the class CommonEditActionsProvider method updateSelectionBeforeDelete.
public static void updateSelectionBeforeDelete(EditableArea area, RadComponent component, List<RadComponent> excludes) {
try {
isDeleting = true;
RadComponent newSelection = getNewSelection(component, excludes);
if (newSelection == null) {
area.deselectAll();
} else {
area.select(newSelection);
}
} finally {
isDeleting = false;
}
}
use of com.intellij.designer.model.RadComponent in project intellij-community by JetBrains.
the class CommonEditActionsProvider method isCopyEnabled.
@Override
public boolean isCopyEnabled(@NotNull DataContext dataContext) {
if (myDesigner.getInplaceEditingLayer().isEditing()) {
return false;
}
List<RadComponent> selection = getArea(dataContext).getSelection();
if (selection.isEmpty()) {
return false;
}
RadComponent rootComponent = myDesigner.getRootComponent();
if (rootComponent instanceof IComponentCopyProvider) {
IComponentCopyProvider copyProvider = (IComponentCopyProvider) rootComponent;
return copyProvider.isCopyEnabled(selection);
}
return true;
}
use of com.intellij.designer.model.RadComponent 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);
}
Aggregations