Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html /
 
 package org.eclipse.xtext.ui.editor.outline.impl;
 
import  org.eclipse.jface.text.source.ISourceViewer;

Author(s):
Jan Koehnlein - Initial contribution and API
Since:
2.2
public class OutlineNodeElementOpener {
	public void open(IOutlineNode node, ISourceViewer textViewer) {
		if (node != null) {
			ITextRegion textRegion = node.getSignificantTextRegion();
			if (textRegion != null && textRegion != .) {
				int offset = textRegion.getOffset();
				int length = textRegion.getLength();
				textViewer.setRangeIndication(offsetlengthtrue);
				textViewer.revealRange(offsetlength);
				textViewer.setSelectedRange(offsetlength);
else {
					public void process(EObject statethrows Exception {
						openEObject(state);
					}
				});
			}
		}
	}
	protected void openEObject(EObject state) {
		URI uri = EcoreUtil.getURI(state);
		.open(uritrue);
	}
New to GrepCode? Check out our FAQ X