use of com.intellij.designer.designSurface.EditOperation in project intellij-community by JetBrains.
the class ResizeTracker method executeCommand.
private void executeCommand() {
if (myExecuteEnabled) {
List<EditOperation> operations = new ArrayList<>();
for (EditOperation operation : getOperations()) {
if (operation.canExecute()) {
operations.add(operation);
}
}
myToolProvider.execute(operations, DesignerBundle.message("command.tool_operation"));
}
}
use of com.intellij.designer.designSurface.EditOperation in project intellij-community by JetBrains.
the class ResizeTracker method getOperations.
private List<EditOperation> getOperations() {
if (myOperations == null) {
myContext.setComponents(new ArrayList<>(myArea.getSelection()));
myOperations = new ArrayList<>();
for (RadComponent component : myContext.getComponents()) {
EditOperation operation;
RadComponent parent = component.getParent();
if (parent == null) {
operation = myArea.processRootOperation(myContext);
} else {
operation = parent.getLayout().processChildOperation(myContext);
}
if (operation != null) {
myOperations.add(operation);
operation.setComponent(component);
}
}
}
return myOperations;
}
use of com.intellij.designer.designSurface.EditOperation in project intellij-community by JetBrains.
the class TreeDropListener method updateTargetUnderMouse.
private void updateTargetUnderMouse() {
if (myContext.getComponents().isEmpty()) {
return;
}
final List<RadComponent> excludeComponents = new ArrayList<>(myContext.getComponents());
if (!myContext.isCreate()) {
for (RadComponent component : myContext.getComponents()) {
component.accept(new RadComponentVisitor() {
@Override
public void endVisit(RadComponent component) {
excludeComponents.add(component);
}
}, true);
}
}
final EditOperation[] operation = new EditOperation[1];
ComponentTargetFilter filter = new ComponentTargetFilter() {
@Override
public boolean preFilter(RadComponent component) {
return myContext.isCreate() || !excludeComponents.contains(component);
}
@Override
public boolean resultFilter(RadComponent target) {
if (!myContext.isCreate()) {
if (myContext.getComponents().get(0).getParent() == target) {
myContext.setType(OperationContext.MOVE);
} else {
myContext.setType(OperationContext.ADD);
}
}
if (myTarget == target) {
return true;
}
RadLayout layout = target.getLayout();
if (layout != null) {
operation[0] = layout.processChildOperation(myContext);
}
return operation[0] != null;
}
};
Point location = getLocation();
RadComponent target = myArea.findTarget(location.x, location.y, filter);
if (target != myTarget) {
if (myTargetOperation != null) {
eraseFeedback();
}
myTarget = target;
myTargetOperation = operation[0];
}
if (target == null) {
if (!myContext.isCreate()) {
myContext.setType(null);
}
} else {
myTargetOperation.setComponents(myContext.getComponents());
}
}
Aggregations