private int getItemIndexByElementName(String elementName) {
        int result = -1;
        Item [] items = tree.getItems();
        for(int i = 0; i < items.length; i++) {
            if(items[i].getText().equals(elementName)) {
                return i;
            }
        }
        return result;
    }