@Override
public void valueChanged(TreeSelectionEvent e) {
	
	Object obj = ((DefaultMutableTreeNode)(e.getPath().getLastPathComponent())). getUserObject();
	
	if (obj.equals(oldTreeObject)) {
		//oldTreeObject=null;
		return;
	}
		else oldTreeObject = obj;
	
	String quote =null;
	int index=0;
	
	if (obj instanceof EndNodeObject ){
		quote	= ((EndNodeObject)obj).getString();
		index	 =((EndNodeObject)obj).getOffset();	
		
	}
	//String quote = e.getPath().getLastPathComponent().toString();
	else{	
		quote =  obj.toString();
		if (quote!=null && quote.startsWith("#") ){
			String indexStr = quote.substring(1,quote.indexOf("::") ) ;
			index = Integer.parseInt(indexStr);
		}
	}
		//////////////test for text positioning in scroll pane////////////////////////
		JViewport viewport = (JViewport) textPane.getParent();
		
		currentASection =	  aDoc.getASectionThatStartsAt(index);
		if (currentASection!=null) {
			int offset =  currentASection.getMiddleOffset();
			int start  =  currentASection.getStartOffset();
			int end    =  currentASection.getEndOffset();
			
			Rectangle rect;
			
			
			textPane.removeCaretListener(this);
			textPane.getCaret().setDot(end);
			textPane.getCaret().moveDot(start);			
			textPane.addCaretListener(this);
			
			commentField.getCaret().removeChangeListener(this);
			
			aspectPanel.setPanelEnabled(false);
			AData data = aDoc.getAData(currentASection);
	    	aspectPanel.setPanelEnabled(true);
	    	setContols(data);
	    	
			commentField.getCaret().addChangeListener(this);

//			textPane.getCaret().setDot(offset);			
			
			try {
				rect = textPane.modelToView(offset);
				//System.out.println("offset = "+offset+" rectangle = "+rect);
				viewport.scrollRectToVisible(rect);
				textPane.grabFocus();
				
			} catch (BadLocationException e1) {
				//
				System.out.println(" error setting model to view :: bad location");
			}
			
		} else ; //System.out.println(" Не найдена секция");
	   		////////////////////////////////////////////	
	
		
	

}