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

The following examples show how to use org.eclipse.xtext.ui.editor.outline.impl.OutlinePage. 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: AbstractOutlineWorkbenchTest.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
protected void openOutlineView() throws PartInitException, InterruptedException {
	outlineView = editor.getEditorSite().getPage().showView("org.eclipse.ui.views.ContentOutline");
	executeAsyncDisplayJobs();
	Object adapter = editor.getAdapter(IContentOutlinePage.class);
	assertTrue(adapter instanceof OutlinePage);
	outlinePage = new SyncableOutlinePage((OutlinePage) 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);
}
 
Example #2
Source File: OutlineWithEditorLinker.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public void activate(OutlinePage outlinePage) {
	this.outlinePage = outlinePage;
	treeViewer = outlinePage.getTreeViewer();
	treeListener = new TreeListener();
	treeViewer.addPostSelectionChangedListener(treeListener);
	treeViewer.addDoubleClickListener(treeListener);
	textViewer = outlinePage.getSourceViewer();
	textListener = new TextListener();
	ISelectionProvider textSelectionProvider = textViewer.getSelectionProvider();
	if (textSelectionProvider instanceof IPostSelectionProvider)
		((IPostSelectionProvider) textSelectionProvider).addPostSelectionChangedListener(textListener);
	else
		textSelectionProvider.addSelectionChangedListener(textListener);
}
 
Example #3
Source File: AbstractOutlineWorkbenchTest.java    From xsemantics with Eclipse Public License 1.0 5 votes vote down vote up
protected TreeViewer getOutlineTreeViewer() throws PartInitException {
	document = editor.getDocument();
	outlineView = editor.getEditorSite().getPage()
			.showView("org.eclipse.ui.views.ContentOutline");
	executeAsyncDisplayJobs();
	Object adapter = editor.getAdapter(IContentOutlinePage.class);
	assertTrue(adapter instanceof OutlinePage);
	outlinePage = (OutlinePage) adapter;
	TreeViewer treeViewer = outlinePage.getTreeViewer();

	awaitForTreeViewer(treeViewer);

	assertTrue(treeViewer.getInput() instanceof IOutlineNode);
	return treeViewer;
}
 
Example #4
Source File: AbstractFilterOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void deregister(OutlinePage outlinePage) {
	super.deregister(outlinePage);
	if (filter != null) {
		outlineFilterAndSorter.removeFilter(getFilter());
		filter = null;
	}
	outlineFilterAndSorter = null;
	treeViewer = null;
}
 
Example #5
Source File: AbstractFilterOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void register(OutlinePage outlinePage) {
	super.register(outlinePage);
	outlineFilterAndSorter = outlinePage.getFilterAndSorter();
	outlineFilterAndSorter.addFilter(getFilter());
	treeViewer = outlinePage.getTreeViewer();
}
 
Example #6
Source File: IOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void register(OutlinePage outlinePage) {
	for(IOutlineContribution contribution: contributions)
		contribution.register(outlinePage);
	TreeViewer treeViewer = outlinePage.getTreeViewer();
	if(!treeViewer.getTree().isDisposed()) 
		treeViewer.refresh();
}
 
Example #7
Source File: LinkWithEditorOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void deregister(OutlinePage outlinePage) {
	super.deregister(outlinePage);
	OutlineWithEditorLinker outlineWithEditorLinker = page2linker.remove(outlinePage);
	if (outlineWithEditorLinker != null) {
		outlineWithEditorLinker.deactivate();
		preferenceStore.removePropertyChangeListener(outlineWithEditorLinker);
	}
}
 
Example #8
Source File: LinkWithEditorOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void register(OutlinePage outlinePage) {
	super.register(outlinePage);
	OutlineWithEditorLinker outlineWithEditorLinker = outlineWithEditorLinkerProvider.get();
	outlineWithEditorLinker.activate(outlinePage);
	outlineWithEditorLinker.setLinkingEnabled(isPropertySet());
	preferenceStore = getPreferenceStoreAccess().getPreferenceStore();
	preferenceStore.addPropertyChangeListener(outlineWithEditorLinker);
	page2linker.put(outlinePage, outlineWithEditorLinker);
}
 
Example #9
Source File: SortOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void register(OutlinePage outlinePage) {
	super.register(outlinePage);
	outlineFilterAndSorter = outlinePage.getFilterAndSorter();
	this.treeViewer = outlinePage.getTreeViewer();
	outlineFilterAndSorter.setComparator(comparator);
}
 
Example #10
Source File: SyncableOutlinePage.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
protected void treeUpdated() {
	try {
		Method method = OutlinePage.class.getDeclaredMethod("treeUpdated");
		method.setAccessible(true);
		method.invoke(page);
	} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
			| InvocationTargetException e) {
		e.printStackTrace();
	}
	syncer.signal();
}
 
Example #11
Source File: SyncableOutlinePage.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
public void resetSyncer() throws InterruptedException {
	try {
		Method method = OutlinePage.class.getDeclaredMethod("getRefreshJob");
		method.setAccessible(true);
		OutlineRefreshJob refreshPageJob = (OutlineRefreshJob) method.invoke(page);
		refreshPageJob.join();
		syncer.start();
	} catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
			| InvocationTargetException e) {
		e.printStackTrace();
	}
}
 
Example #12
Source File: SortOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void deregister(OutlinePage outlinePage) {
	outlineFilterAndSorter = null;
	treeViewer = null;
	super.deregister(outlinePage);
}
 
Example #13
Source File: AbstractToggleOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void register(OutlinePage outlinePage) {
	IToolBarManager toolBarManager = outlinePage.getSite().getActionBars().getToolBarManager();
	toolBarManager.add(getAction());
	addPropertyChangeListener();
}
 
Example #14
Source File: AbstractToggleOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void deregister(OutlinePage outlinePage) {
	removePropertyChangeListener();
}
 
Example #15
Source File: DefaultUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IContentOutlinePage> bindIContentOutlinePage() {
	return OutlinePage.class;
}
 
Example #16
Source File: HideReturnTypesContribution.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void deregister(OutlinePage outlinePage) {
	this.treeViewer = null;
	super.deregister(outlinePage);
}
 
Example #17
Source File: HideReturnTypesContribution.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void register(OutlinePage outlinePage) {
	super.register(outlinePage);
	this.treeViewer= outlinePage.getTreeViewer();
}
 
Example #18
Source File: IOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void deregister(OutlinePage outlinePage) {
	for(IOutlineContribution contribution: contributions)
		contribution.deregister(outlinePage);
}
 
Example #19
Source File: SwitchOutlineModeContribution.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void register(OutlinePage outlinePage) {
	super.register(outlinePage);
	this.outlinePage = outlinePage;
}
 
Example #20
Source File: SwitchOutlineModeContribution.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void deregister(OutlinePage outlinePage) {
	super.deregister(outlinePage);
	this.outlinePage = null;
}
 
Example #21
Source File: SyncableOutlinePage.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
SyncableOutlinePage(OutlinePage page) {
	this.page = page;
}
 
Example #22
Source File: IOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 votes vote down vote up
void register(OutlinePage outlinePage); 
Example #23
Source File: IOutlineContribution.java    From xtext-eclipse with Eclipse Public License 2.0 votes vote down vote up
void deregister(OutlinePage outlinePage);