code: private void selectQueryNode(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_selectQueryNode
      	String currentQuery = "";
      	
      	DefaultMutableTreeNode node = (DefaultMutableTreeNode) evt.getPath().getLastPathComponent();
          if (node instanceof QueryTreeElement) {
              QueryTreeElement queryElement = (QueryTreeElement)node;
              currentQuery = queryElement.getQuery();
              currentId = queryElement;
              
              TreeNode parent = queryElement.getParent();
              if (parent == null || parent.toString().equals("")) {
                  fireQueryChanged("", currentQuery, currentId.getID());
              }
              else {
                  fireQueryChanged(parent.toString(), currentQuery, currentId.getID());
              }
          }
          else if (node instanceof QueryGroupTreeElement) {
              QueryGroupTreeElement groupElement = (QueryGroupTreeElement)node;
              currentId = null;
              currentQuery = null;
              fireQueryChanged(groupElement.toString(), "", "");
          }
          else if (node == null) {
              currentId = null;
              currentQuery = null;
          }
      }
docs: </editor-fold>//GEN-END:initComponents