Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » show TreeViewer: AssertionFailedException(When adding a TreeVier to an example View I receive an AssertionFailedException)
show TreeViewer: AssertionFailedException [message #546914] Wed, 14 July 2010 11:19 Go to next message
mho is currently offline mho
Messages: 11
Registered: July 2010
Junior Member
Hi,
I created a little example RCP and with an empty View. Just to this View I wanted to add a TreeViewer. I did it with the code a the end of this posting. When starting the application I received an AssertionFailedException with the shown stacktrace. Does anyone know what I am doing wrong or what is missing in my code?
---
Code:
public class ListView extends ViewPart {

public static final String ID = "org.mho.view.ListView";
private TreeViewer treeViewer;

public ListView() {}

@Override
public void createPartControl(Composite parent)
{
parent.setLayout(new FillLayout());
treeViewer = new TreeViewer(parent);


ObservableListTreeContentProvider contentProvider = new ListContentProvider();
treeViewer.setContentProvider(contentProvider);

treeViewer.setLabelProvider(new ListLabelProvider(contentProvider
.getKnownElements()));

treeViewer.setInput(Model.getInstance());

getSite().setSelectionProvider(treeViewer);
}
...
}
---

Exception:

org.eclipse.core.runtime.AssertionFailedException: null argument:
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
at org.eclipse.jface.viewers.StructuredViewer.assertElementsNot Null(StructuredViewer.java:593)
at org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St ructuredViewer.java:990)
at org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column Viewer.java:703)
at org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren( AbstractTreeViewer.java:1332)
at org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeView er.java:391)
at org.eclipse.jface.viewers.StructuredViewer.getFilteredChildr en(StructuredViewer.java:896)
at org.eclipse.jface.viewers.AbstractTreeViewer.getSortedChildr en(AbstractTreeViewer.java:601)
at org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractT reeViewer.java:801)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren( AbstractTreeViewer.java:778)
at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeView er.java:644)
at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren( AbstractTreeViewer.java:749)
at org.eclipse.jface.viewers.AbstractTreeViewer.internalInitial izeTree(AbstractTreeViewer.java:1492)
at org.eclipse.jface.viewers.TreeViewer.internalInitializeTree( TreeViewer.java:833)
at org.eclipse.jface.viewers.AbstractTreeViewer$5.run(AbstractT reeViewer.java:1476)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelecti on(StructuredViewer.java:1422)
at org.eclipse.jface.viewers.TreeViewer.preservingSelection(Tre eViewer.java:403)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelecti on(StructuredViewer.java:1383)
at org.eclipse.jface.viewers.AbstractTreeViewer.inputChanged(Ab stractTreeViewer.java:1469)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentView er.java:274)
at org.eclipse.jface.viewers.StructuredViewer.setInput(Structur edViewer.java:1664)
at org.mho.collect.view.base.ListView.createPartControl(ListVie w.java:41)
at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR eference.java:375)
at org.eclipse.ui.internal.ViewReference.createPart(ViewReferen ce.java:229)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb enchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:31 3)
at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:52 9)
at org.eclipse.ui.internal.presentations.PresentablePart.setVis ible(PresentablePart.java:180)
at org.eclipse.ui.internal.presentations.util.PresentablePartFo lder.select(PresentablePartFolder.java:270)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd er.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresen tation.selectPart(TabbedStackPresentation.java:473)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelecti on(PartStack.java:1254)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav a:1207)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:16 06)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.ja va:647)
at org.eclipse.ui.internal.PartStack.createControl(PartStack.ja va:574)
at org.eclipse.ui.internal.PartSashContainer.createControl(Part SashContainer.java:568)
at org.eclipse.ui.internal.PerspectiveHelper.activate(Perspecti veHelper.java:272)
at org.eclipse.ui.internal.Perspective.onActivate(Perspective.j ava:981)
at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPa ge.java:2632)
at org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWind ow.java:2986)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(Workbe nchWindow.java:2967)
at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(Workben chWindow.java:771)
at org.eclipse.ui.internal.Workbench$23.runWithException(Workbe nch.java:1220)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:4041)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3660)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work benchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$31.runWithException(Workbe nch.java:1566)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run (StartupThreading.java:31)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.j ava:179)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchroniz er.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4584)
at org.eclipse.ui.internal.StartupThreading.runWithoutException s(StartupThreading.java:94)
at org.eclipse.ui.internal.Workbench.init(Workbench.java:1561)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2556)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.mho.collect.general.Application.start(Application.java:2 2)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)



Re: show TreeViewer: AssertionFailedException [message #546955 is a reply to message #546914] Wed, 14 July 2010 13:29 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5296
Registered: July 2009
Senior Member
Your list (the one you pass in setInput()) holds a NULL value

Am 14.07.10 17:19, schrieb mho:
> Hi,
> I created a little example RCP and with an empty View. Just to this View
> I wanted to add a TreeViewer. I did it with the code a the end of this
> posting. When starting the application I received an
> AssertionFailedException with the shown stacktrace. Does anyone know
> what I am doing wrong or what is missing in my code? ---
> Code: public class ListView extends ViewPart {
>
> public static final String ID = "org.mho.view.ListView"; private
> TreeViewer treeViewer;
>
> public ListView() {}
>
> @Override
> public void createPartControl(Composite parent) {
> parent.setLayout(new FillLayout());
> treeViewer = new TreeViewer(parent);
>
>
> ObservableListTreeContentProvider contentProvider = new
> ListContentProvider();
> treeViewer.setContentProvider(contentProvider);
>
> treeViewer.setLabelProvider(new ListLabelProvider(contentProvider
> .getKnownElements()));
>
> treeViewer.setInput(Model.getInstance());
>
> getSite().setSelectionProvider(treeViewer);
> }
> ...
> }
> ---
>
> Exception:
>
> org.eclipse.core.runtime.AssertionFailedException: null argument:
> at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
> at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
> at org.eclipse.jface.viewers.StructuredViewer.assertElementsNot
> Null(StructuredViewer.java:593)
> at org.eclipse.jface.viewers.StructuredViewer.getRawChildren(St
> ructuredViewer.java:990)
> at org.eclipse.jface.viewers.ColumnViewer.getRawChildren(Column
> Viewer.java:703)
> at org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren(
> AbstractTreeViewer.java:1332)
> at org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeView
> er.java:391)
> at org.eclipse.jface.viewers.StructuredViewer.getFilteredChildr
> en(StructuredViewer.java:896)
> at org.eclipse.jface.viewers.AbstractTreeViewer.getSortedChildr
> en(AbstractTreeViewer.java:601)
> at org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractT
> reeViewer.java:801)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator
> .java:70)
> at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(
> AbstractTreeViewer.java:778)
> at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeView
> er.java:644)
> at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(
> AbstractTreeViewer.java:749)
> at org.eclipse.jface.viewers.AbstractTreeViewer.internalInitial
> izeTree(AbstractTreeViewer.java:1492)
> at org.eclipse.jface.viewers.TreeViewer.internalInitializeTree(
> TreeViewer.java:833)
> at org.eclipse.jface.viewers.AbstractTreeViewer$5.run(AbstractT
> reeViewer.java:1476)
> at org.eclipse.jface.viewers.StructuredViewer.preservingSelecti
> on(StructuredViewer.java:1422)
> at org.eclipse.jface.viewers.TreeViewer.preservingSelection(Tre
> eViewer.java:403)
> at org.eclipse.jface.viewers.StructuredViewer.preservingSelecti
> on(StructuredViewer.java:1383)
> at org.eclipse.jface.viewers.AbstractTreeViewer.inputChanged(Ab
> stractTreeViewer.java:1469)
> at org.eclipse.jface.viewers.ContentViewer.setInput(ContentView
> er.java:274)
> at org.eclipse.jface.viewers.StructuredViewer.setInput(Structur
> edViewer.java:1664)
> at org.mho.collect.view.base.ListView.createPartControl(ListVie
> w.java:41)
> at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewR
> eference.java:375)
> at org.eclipse.ui.internal.ViewReference.createPart(ViewReferen
> ce.java:229)
> at org.eclipse.ui.internal.WorkbenchPartReference.getPart(Workb
> enchPartReference.java:595)
> at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:31 3)
> at org.eclipse.ui.internal.ViewPane.setVisible(ViewPane.java:52 9)
> at org.eclipse.ui.internal.presentations.PresentablePart.setVis
> ible(PresentablePart.java:180)
> at org.eclipse.ui.internal.presentations.util.PresentablePartFo
> lder.select(PresentablePartFolder.java:270)
> at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrd
> er.select(LeftToRightTabOrder.java:65)
> at org.eclipse.ui.internal.presentations.util.TabbedStackPresen
> tation.selectPart(TabbedStackPresentation.java:473)
> at org.eclipse.ui.internal.PartStack.refreshPresentationSelecti
> on(PartStack.java:1254)
> at org.eclipse.ui.internal.PartStack.setSelection(PartStack.jav
> a:1207)
> at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:16 06)
> at org.eclipse.ui.internal.PartStack.createControl(PartStack.ja
> va:647)
> at org.eclipse.ui.internal.PartStack.createControl(PartStack.ja
> va:574)
> at org.eclipse.ui.internal.PartSashContainer.createControl(Part
> SashContainer.java:568)
> at org.eclipse.ui.internal.PerspectiveHelper.activate(Perspecti
> veHelper.java:272)
> at org.eclipse.ui.internal.Perspective.onActivate(Perspective.j
> ava:981)
> at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPa
> ge.java:2632)
> at org.eclipse.ui.internal.WorkbenchWindow$27.run(WorkbenchWind
> ow.java:2986)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator
> .java:70)
> at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(Workbe
> nchWindow.java:2967)
> at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage(Workben
> chWindow.java:771)
> at org.eclipse.ui.internal.Workbench$23.runWithException(Workbe
> nch.java:1220)
> at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run
> (StartupThreading.java:31)
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
> at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr
> onizer.java:134)
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav
> a:4041)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3660)
> at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(Work
> benchAdvisor.java:803)
> at org.eclipse.ui.internal.Workbench$31.runWithException(Workbe
> nch.java:1566)
> at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run
> (StartupThreading.java:31)
> at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.j
> ava:179)
> at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchroniz
> er.java:150)
> at org.eclipse.swt.widgets.Display.syncExec(Display.java:4584)
> at org.eclipse.ui.internal.StartupThreading.runWithoutException
> s(StartupThreading.java:94)
> at org.eclipse.ui.internal.Workbench.init(Workbench.java:1561)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2556)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 27)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault
> (Realm.java:332)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work
> bench.java:663)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j
> ava:149)
> at org.mho.collect.general.Application.start(Application.java:2 2)
> at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips
> eAppHandle.java:196)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher
> .runApplication(EclipseAppLauncher.java:110)
> at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher
> .start(EclipseAppLauncher.java:79)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS
> tarter.java:369)
> at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS
> tarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 619)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
>
>
>
>
Re: show TreeViewer: AssertionFailedException [message #547087 is a reply to message #546914] Thu, 15 July 2010 10:43 Go to previous messageGo to next message
mho is currently offline mho
Messages: 11
Registered: July 2010
Junior Member
No, that's wrong. At first, I assumed that , too. But then I printed, what is passed to setInput.

System.out.println("==============" + Model.getInstance().toString());
treeViewer.setInput(Model.getInstance());

That's unusable for production purposes, but for debugging: it works! Cool
The output looks like this:

!ENTRY org.eclipse.ui 4 4 2010-07-15 11:20:44.080
!MESSAGE Part already exists in page layout: org.mho.view.ListView.
==============Item 0

!ENTRY org.eclipse.ui.workbench 4 0 2010-07-15 11:20:44.181
!MESSAGE Unable to create view ID org.mho.view.ListView: null argument:
!STACK 0
org.eclipse.core.runtime.AssertionFailedException: null argument:... blabla

Ok, you may ask, what's behind Model.getInstance()? No problem, Tom should know it, it is nearly the same code as in one of his examples on Eclipsepedia:

public static Model getInstance() {
Model root = new Model(0,null);
root.counter = 0;

Model tmp;
for( int i = 1; i < 10; i++ ) {
tmp = new Model(i, root);
root.child.add(tmp);
for( int j = 1; j < i; j++ ) {
tmp.child.add(new Model(j,tmp));
}
}

return root;
}

As quoted above there is sime output from this method and I cannot see that this may become Null in any iteration.
Any other suggestions?
Re: show TreeViewer: AssertionFailedException [message #547184 is a reply to message #547087] Thu, 15 July 2010 15:51 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5296
Registered: July 2009
Senior Member
ListContentProvider? Can you show us the code there? Or provide a
complete example so that I can reproduce locally?

Tom

Am 15.07.10 16:43, schrieb mho:
> No, that's wrong. At first, I assumed that , too. But then I printed,
> what is passed to setInput.
>
> System.out.println("==============" + Model.getInstance().toString());
> treeViewer.setInput(Model.getInstance());
>
> That's unusable for production purposes, but for debugging: it works!
> 8) The output looks like this:
>
> !ENTRY org.eclipse.ui 4 4 2010-07-15 11:20:44.080
> !MESSAGE Part already exists in page layout: org.mho.view.ListView.
> ==============Item 0
>
> !ENTRY org.eclipse.ui.workbench 4 0 2010-07-15 11:20:44.181
> !MESSAGE Unable to create view ID org.mho.view.ListView: null argument:
> !STACK 0
> org.eclipse.core.runtime.AssertionFailedException: null argument:... blabla
>
> Ok, you may ask, what's behind Model.getInstance()? No problem, Tom
> should know it, it is nearly the same code as in one of his examples on
> Eclipsepedia:
>
> public static Model getInstance() {
> Model root = new Model(0,null);
> root.counter = 0;
>
> Model tmp;
> for( int i = 1; i < 10; i++ ) {
> tmp = new Model(i, root);
> root.child.add(tmp);
> for( int j = 1; j < i; j++ ) {
> tmp.child.add(new Model(j,tmp));
> }
> }
>
> return root;
> }
>
> As quoted above there is sime output from this method and I cannot see
> that this may become Null in any iteration.
> Any other suggestions?
Re: show TreeViewer: AssertionFailedException [message #547207 is a reply to message #547184] Thu, 15 July 2010 18:40 Go to previous messageGo to next message
mho is currently offline mho
Messages: 11
Registered: July 2010
Junior Member
That's the point! The ContentProvider returns a Null value in one of its methods.I will fix this to see if it is the cause of the exception. Thank you Tom!
mho
Re: show TreeViewer: AssertionFailedException [message #547306 is a reply to message #547207] Fri, 16 July 2010 05:29 Go to previous message
mho is currently offline mho
Messages: 11
Registered: July 2010
Junior Member
Well, now I fixed the ContenProvider, and it really whas the cause! Anyhow, it doesn't run now, but this is because I twisted my model a little bit. Finally, getElements just shouldn't return Null... Cool
mho
Previous Topic:Path in ImageLoader.load() method
Next Topic:Can I put a view into the editor area?
Goto Forum:
  


Current Time: Sat Aug 30 08:26:11 EDT 2014

Powered by FUDForum. Page generated in 0.05408 seconds