use of com.intellij.designer.designSurface.tools.CreationTool in project intellij-community by JetBrains.
the class TreeDropListener method updateContext.
private void updateContext() {
myContext.setLocation(getLocation());
if (myContext.getComponents() == null) {
if (!ArrayUtil.contains(SimpleTransferable.getData(myEvent.getTransferable(), Class.class), myDragTargets)) {
myContext.setComponents(Collections.<RadComponent>emptyList());
return;
}
if (myToolProvider.getActiveTool() instanceof CreationTool) {
myContext.setType(OperationContext.CREATE);
CreationTool tool = (CreationTool) myToolProvider.getActiveTool();
try {
myContext.setComponents(Collections.singletonList(tool.getFactory().create()));
} catch (Throwable e) {
myContext.setComponents(Collections.<RadComponent>emptyList());
myToolProvider.loadDefaultTool();
}
return;
}
List<RadComponent> components = RadComponent.getPureSelection(myArea.getSelection());
RadComponent parent = null;
for (RadComponent component : components) {
if (parent == null) {
parent = component.getParent();
} else if (parent != component.getParent()) {
components = Collections.emptyList();
break;
}
}
myContext.setComponents(components);
myContext.resetMoveAddEnabled();
for (RadComponent component : components) {
component.processDropOperation(myContext);
}
}
}
Aggregations