org.eclipse.xtext.ui.editor.outline.impl.IOutlineNodeComparer Java Examples

The following examples show how to use org.eclipse.xtext.ui.editor.outline.impl.IOutlineNodeComparer. 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: OutlineNodeComparerTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void setUp() throws Exception {
	super.setUp();
	final Injector injector = TestsActivator.getInstance().getInjector("org.eclipse.xtext.ui.tests.editor.outline.OutlineTestLanguage");
	with(new ISetup() {
		@Override
		public Injector createInjectorAndDoEMFRegistration() {
			return injector;
		}
	});
	comparer = new IOutlineNodeComparer.Default();
	image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
	image2 = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
	eObject = OutlineTestFactory.eINSTANCE.createModel();

}
 
Example #2
Source File: AbstractOutlineWorkbenchTest.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setUp2() throws Exception {
	preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, N4JSActivator.ORG_ECLIPSE_N4JS_N4JS);
	comparer = new IOutlineNodeComparer.Default();

	// when using in XPECT, XPECT already creates the project structure
	if (shouldCreateProjectStructure()) {
		createProjectStructure();
	}
	//
	openXtextDocument();
	openOutlineView();
}
 
Example #3
Source File: AbstractOutlineWorkbenchTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void setUp() throws Exception {
	super.setUp();
	preferenceStore = new ScopedPreferenceStore(new InstanceScope(), getEditorId());
	comparer = new IOutlineNodeComparer.Default();
	modelAsText = "one { two {} three {} } four {}";
	file = IResourcesSetupUtil.createFile("test/test.outlinetestlanguage", modelAsText);
	editor = openEditor(file);
	document = editor.getDocument();
	outlineView = editor.getEditorSite().getPage().showView("org.eclipse.ui.views.ContentOutline");
	executeAsyncDisplayJobs();
	Object adapter = editor.getAdapter(IContentOutlinePage.class);
	assertTrue(adapter instanceof SyncableOutlinePage);
	outlinePage = (SyncableOutlinePage) adapter;
	outlinePage.resetSyncer();
	try {
		outlinePage.waitForUpdate(EXPECTED_TIMEOUT);
	} catch (TimeoutException e) {
		System.out.println("Expected timeout exceeded: "+EXPECTED_TIMEOUT);// timeout is OK here
	}
	treeViewer = outlinePage.getTreeViewer();
	assertSelected(treeViewer);
	assertExpanded(treeViewer);
	assertTrue(treeViewer.getInput() instanceof IOutlineNode);
	IOutlineNode rootNode = (IOutlineNode) treeViewer.getInput();
	List<IOutlineNode> children = rootNode.getChildren();
	assertEquals(1, children.size());
	modelNode = children.get(0);
	assertEquals(2, modelNode.getChildren().size());
	oneNode = modelNode.getChildren().get(0);
	assertEquals(2, oneNode.getChildren().size());
	twoNode = oneNode.getChildren().get(0);
	threeNode = oneNode.getChildren().get(1);
	fourNode = modelNode.getChildren().get(1);
}
 
Example #4
Source File: AbstractOutlineWorkbenchTest.java    From xsemantics with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void setUp() throws Exception {
	super.setUp();
	comparer = new IOutlineNodeComparer.Default();
	createTestJavaProject();
}