use of org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler in project titan.EclipsePlug-ins by eclipse.
the class ExecuteSectionDropTargetListener method drop.
@Override
public void drop(final DropTargetEvent event) {
if (ExecuteItemTransfer.getInstance().isSupportedType(event.currentDataType)) {
if (event.item != null && viewer.getInput() != null) {
ExecuteSectionHandler executeSectionHandler = (ExecuteSectionHandler) viewer.getInput();
ExecuteItem element = (ExecuteItem) event.item.getData();
ExecuteItem[] items = (ExecuteItem[]) event.data;
int baseindex = executeSectionHandler.getExecuteitems().indexOf(element);
final ParseTree parent = executeSectionHandler.getLastSectionRoot();
ConfigTreeNodeUtilities.removeChild(parent, element.getRoot());
ConfigTreeNodeUtilities.addChild(parent, element.getRoot(), baseindex);
if (items.length > 0) {
for (int i = 0; i < items.length - 1; i++) {
executeSectionHandler.getExecuteitems().add(++baseindex, items[i]);
}
executeSectionHandler.getExecuteitems().add(++baseindex, items[items.length - 1]);
}
viewer.refresh(true);
editor.setDirty();
}
}
}
Aggregations