Search in sources :

Example 1 with ExecuteSectionHandler

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();
        }
    }
}
Also used : ExecuteItem(org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler.ExecuteItem) ExecuteSectionHandler(org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Aggregations

ParseTree (org.antlr.v4.runtime.tree.ParseTree)1 ExecuteSectionHandler (org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler)1 ExecuteItem (org.eclipse.titan.common.parsers.cfg.indices.ExecuteSectionHandler.ExecuteItem)1