Search in sources :

Example 1 with TestportParameterSectionHandler

use of org.eclipse.titan.common.parsers.cfg.indices.TestportParameterSectionHandler in project titan.EclipsePlug-ins by eclipse.

the class TestportParameterSectionDropTargetListener method drop.

@Override
public void drop(final DropTargetEvent event) {
    if (TestportParameterTransfer.getInstance().isSupportedType(event.currentDataType)) {
        if (event.item != null && viewer.getInput() != null) {
            TestportParameterSectionHandler testportParameterSectionHandler = (TestportParameterSectionHandler) viewer.getInput();
            TestportParameter element = (TestportParameter) event.item.getData();
            TestportParameter[] items = (TestportParameter[]) event.data;
            int baseindex = testportParameterSectionHandler.getTestportParameters().indexOf(element);
            final ParseTree parent = testportParameterSectionHandler.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++) {
                    testportParameterSectionHandler.getTestportParameters().add(++baseindex, items[i]);
                }
                testportParameterSectionHandler.getTestportParameters().add(++baseindex, items[items.length - 1]);
            }
            viewer.refresh(true);
            editor.setDirty();
        }
    }
}
Also used : TestportParameter(org.eclipse.titan.common.parsers.cfg.indices.TestportParameterSectionHandler.TestportParameter) TestportParameterSectionHandler(org.eclipse.titan.common.parsers.cfg.indices.TestportParameterSectionHandler) ParseTree(org.antlr.v4.runtime.tree.ParseTree)

Aggregations

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