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