Java Code Examples for org.eclipse.xtext.ui.editor.outline.IOutlineTreeProvider#ModeAware

The following examples show how to use org.eclipse.xtext.ui.editor.outline.IOutlineTreeProvider#ModeAware . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenEditorTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test public void testOpenFromOutline() throws Exception {
	XtextEditor bazXtendEditor = workbenchTestHelper.openEditor("outlinetest/Baz.xtend",
			"package outlinetest class Baz extends Foo { int baz }");
	IOutlineTreeProvider.ModeAware tp = (IOutlineTreeProvider.ModeAware) treeProvider;
	tp.setCurrentMode(tp.getOutlineModes().get(1));
	IOutlineNode outlineRoot = treeProvider.createRoot(bazXtendEditor.getDocument());
	IOutlineNode bazNode = outlineRoot.getChildren().get(1);
	assertEquals("Baz - outlinetest", bazNode.getText().toString());
	assertTrue(bazNode.getChildren().size() > 2);
	IOutlineNode baz = bazNode.getChildren().get(0);
	assertEquals("baz : int - Baz", baz.getText().toString());
	outlineNodeElementOpener.open(baz, bazXtendEditor.getInternalSourceViewer());
	assertActiveEditor("org.eclipse.xtend.core.Xtend", "Baz.xtend", "baz");
	IOutlineNode foo = bazNode.getChildren().get(1);
	assertEquals("foo : int - Foo", foo.getText().toString());
	outlineNodeElementOpener.open(foo, bazXtendEditor.getInternalSourceViewer());
	assertActiveEditor("org.eclipse.xtend.core.Xtend", "Foo.xtend", "foo");
	IOutlineNode bar = bazNode.getChildren().get(2);
	assertEquals("bar : int - Bar", bar.getText().toString());
	outlineNodeElementOpener.open(bar, bazXtendEditor.getInternalSourceViewer());
	assertActiveEditor(JavaUI.ID_CU_EDITOR, "Bar.java", "bar");
}
 
Example 2
Source File: QuickOutlinePopup.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.2
 */
protected void setInfoText() {
	if (treeProvider instanceof IOutlineTreeProvider.ModeAware) {
		setInfoText("Press '" + invokingKeystrokeFormatted + "' to "
				+ ((IOutlineTreeProvider.ModeAware) treeProvider).getNextMode().getDescription());
	} else {
		setInfoText(Messages.QuickOutlinePopup_pressESC);
	}
}
 
Example 3
Source File: QuickOutlinePopup.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.2
 */
protected void changeOutlineMode() {
	if (treeProvider instanceof IOutlineTreeProvider.ModeAware) {
		IOutlineTreeProvider.ModeAware modeTreeProvider = (IOutlineTreeProvider.ModeAware) treeProvider;
		OutlineMode nextMode = modeTreeProvider.getNextMode();
		modeTreeProvider.setCurrentMode(nextMode);
		setInfoText();
		setInput(document);
	}
}
 
Example 4
Source File: N4JSUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/** Outline modes for showing inherited members or not */
public Class<? extends IOutlineTreeProvider.ModeAware> bindIOutlineTreeProvider_ModeAware() {
	return N4JSOutlineModes.class;
}
 
Example 5
Source File: AbstractMultiModeOutlineTreeProvider.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public void setModeAware(IOutlineTreeProvider.ModeAware modeAware) {
	this.modeAware = modeAware;
}
 
Example 6
Source File: XtendUiModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IOutlineTreeProvider.ModeAware> bindIOutlineTreeProvider_ModeAware() {
	return XtendOutlineModes.class;
}