Bug 55968 [misc] segmented view does not work with new methods
i2004-03-24+plugin export - add a new method into a class by typing: public void test() {[enter] - the closing bracket is made automatically and the cursor is placed in the method - press "show source of selected element only" - observed behavior: the selected segment is the whole class rather than the method in which the cursor was
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitEditor.java
JavaPlugin.log(e.getStatus());
				clear();
			}
		}
		/**
		 * Return offset recomputed from stored visual properties.  
		 * 
		 * @return Offset in the document
		 */
		public int getOffset() {
			try {
				IJavaElement newElement= getElement();
				if (newElement == null)
					return -1;
				
				IDocument document= getSourceViewer().getDocument();
				int newElementLine= -1;
				if (newElement instanceof IMember) {
					ISourceRange range= ((IMember) newElement).getNameRange();
					if (range != null)
						newElementLine= document.getLineOfOffset(range.getOffset());
				}
				if (newElementLine == -1)
					newElementLine= document.getLineOfOffset(getOffset(newElement));
				if (newElementLine == -1)
					return -1;
				int newLine= fLine + newElementLine - fElementLine;
				if (newLine < 0 || newLine >= document.getNumberOfLines())
					return -1;
				int maxColumn= document.getLineLength(newLine);