Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » JFace TreeViewer Connected with PropertiesView
JFace TreeViewer Connected with PropertiesView [message #886257] Thu, 14 June 2012 11:09 Go to next message
Eclipse UserFriend
Hi,

I have a treeviewer showing model. I have added extension point "org.eclipse.core.runtime.adapters" and i have mentioned factory and type as well for extension point.

I have followed the tutotrial http://www.vogella.com/articles/EclipsePlugIn/article.html

but when i select any of my tree item i get the following exception and Properties views remain empty.

org.eclipse.core.runtime.AssertionFailedException: assertion failed:
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
at org.eclipse.ui.internal.views.ViewsPlugin.getAdapter(ViewsPlugin.java:106)
at org.eclipse.ui.views.properties.PropertySheetEntry.getPropertySource(PropertySheetEntry.java:465)
at org.eclipse.ui.views.properties.PropertySheetEntry.setValues(PropertySheetEntry.java:752)
at org.eclipse.ui.views.properties.PropertySheetViewer.setInput(PropertySheetViewer.java:973)
at org.eclipse.ui.views.properties.PropertySheetPage.selectionChanged(PropertySheetPage.java:510)
at org.eclipse.ui.views.properties.PropertySheet.selectionChanged(PropertySheet.java:363)
at org.eclipse.ui.internal.AbstractSelectionService.firePostSelection(AbstractSelectionService.java:179)
at org.eclipse.ui.internal.AbstractSelectionService$2.selectionChanged(AbstractSelectionService.java:71)
at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:888)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:886)
at org.eclipse.jface.viewers.StructuredViewer.handlePostSelect(StructuredViewer.java:1226)
at org.eclipse.jface.viewers.StructuredViewer$5.widgetSelected(StructuredViewer.java:1251)
at org.eclipse.jface.util.OpenStrategy.firePostSelectionEvent(OpenStrategy.java:262)
at org.eclipse.jface.util.OpenStrategy.access$5(OpenStrategy.java:256)
at org.eclipse.jface.util.OpenStrategy$3.run(OpenStrategy.java:433)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at ics.eaat.concretemodeller.main.Application.start(Application.java:20)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.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(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

Any idea why it is so?

Cheers,
Re: JFace TreeViewer Connected with PropertiesView [message #886315 is a reply to message #886257] Thu, 14 June 2012 13:45 Go to previous messageGo to next message
Eclipse UserFriend
Hello ModelGeek,

I just looked for you @ my code, where I also use the Properties View, in order to see what is going wrong.

It seems that your object, which is passed to the Properties View on selection change, implements the IAdaptable interface.
The ViewsPlugin checks in line 100, if your sourceObject is an instace of IAdaptable and then asks for an Adapter of the IPropertySourceProvider.class and your sourceObject will wrongly return something different then null.

So please check the getAdapter method of your sourceObject and return null, if the class which is ask for is not the desired one.

For instance :
public class YourSourceObject implements IAdaptable{

public Object getAdapter(Class adapter){
    if(adapter == DesiredAdapter.class){
           return new YourAdapterClass();
    }

return null;
}

}


So return null, if the adapter class is not appropriate, and it should work.

Here you can find also a nice tutorial concerning Adapters in Eclipse :
www.eclipse.org/articles/article.php?file=Article-Adapters/index.html

If anything is not clear don´t hesitate to ask me.
Looking forward to your feedback Smile

Best regards,

Simon

[Updated on: Thu, 14 June 2012 13:48] by Moderator

Re: JFace TreeViewer Connected with PropertiesView [message #886605 is a reply to message #886315] Fri, 15 June 2012 05:10 Go to previous message
Eclipse UserFriend
thanks alot.

very nice article!
Previous Topic:Tile Editor horizontal/vertical programmatically
Next Topic:Eclipse 4 Application Tutorial available (for Eclipse 4.2 M5)
Goto Forum:
  


Current Time: Wed Jul 23 14:42:50 EDT 2025

Powered by FUDForum. Page generated in 0.03740 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top