Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » TreeViewer setInput error
TreeViewer setInput error [message #661579] Fri, 25 March 2011 13:31 Go to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Hello all. I have strange exception in code:
viewer.setInput(groups.observe(wtpBaseMain));


exception:
java.lang.ClassCastException: org.eclipse.emf.databinding.internal.EMFObservableListDecora tor cannot be cast to org.eclipse.emf.ecore.EObject
at org.eclipse.emf.databinding.internal.EMFValueProperty.doGetV alue(EMFValueProperty.java:62)

wtpBaseMain:
public wtpbase getWtpBase() {
		if (resource.getContents().size() == 0) {
		resource.getContents().add(WtpdbFactory.eINSTANCE.createwtpbase());
		}
		return (wtpbase) resource.getContents().get(0);
	}

where can be problem?
Re: TreeViewer setInput error [message #661630 is a reply to message #661579] Fri, 25 March 2011 15:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30551
Registered: July 2009
Senior Member
Alex,

Comments below.

Alex wrote:
> Hello all. I have strange exception in code:
>
> viewer.setInput(groups.observe(wtpBaseMain));
>
>
> exception:
> java.lang.ClassCastException:
> org.eclipse.emf.databinding.internal.EMFObservableListDecora tor
> cannot be cast to org.eclipse.emf.ecore.EObject
> at org.eclipse.emf.databinding.internal.EMFValueProperty.doGetV
> alue(EMFValueProperty.java:62)
>
> wtpBaseMain:
Why would you give a class such a horrible name? Class names are
supposed to start with an upper case letter.
>
> public wtpbase getWtpBase() {
> if (resource.getContents().size() == 0) {
>
> resource.getContents().add(WtpdbFactory.eINSTANCE.createwtpb ase());
> }
> return (wtpbase) resource.getContents().get(0);
> }
>
> where can be problem?
What's "groups"?
Re: TreeViewer setInput error [message #661643 is a reply to message #661630] Fri, 25 March 2011 16:30 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Well, groups is:
IEMFListProperty groups = EMFProperties
				.list(WtpdbPackage.Literals.WTPBASE__GROUPS);
Re: TreeViewer setInput error [message #661650 is a reply to message #661643] Fri, 25 March 2011 17:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30551
Registered: July 2009
Senior Member
Alex,

I imagine it should be unwrapping the decorator before passing it on to
the underlying property, but I'm no expert and there's not much I can
say from a few snippets of code. It seems odd that you're in
EMFValueProperty not in EMFListProperty given you say you created a list
property...


Alex wrote:
> Well, groups is:
>
> IEMFListProperty groups = EMFProperties
> .list(WtpdbPackage.Literals.WTPBASE__GROUPS);
>
Re: TreeViewer setInput error [message #661686 is a reply to message #661650] Sat, 26 March 2011 05:17 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
Like Ed is saying it looks strange and doesn't really make sense,
without seeing more complete sourcecode we can't really say what's going
wrong in your code.

Tom

Am 25.03.11 10:03, schrieb Ed Merks:
> Alex,
>
> I imagine it should be unwrapping the decorator before passing it on to
> the underlying property, but I'm no expert and there's not much I can
> say from a few snippets of code. It seems odd that you're in
> EMFValueProperty not in EMFListProperty given you say you created a list
> property...
>
>
> Alex wrote:
>> Well, groups is:
>>
>> IEMFListProperty groups = EMFProperties
>> .list(WtpdbPackage.Literals.WTPBASE__GROUPS);
>>
Re: TreeViewer setInput error [message #661695 is a reply to message #661686] Sat, 26 March 2011 10:37 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Yes, it's very strange. In this code:
IObservableList prop = groups.observe(wtpBaseMain);

in debug mode i seeing, that prop variable is EMFObservableListDecorator.
Re: TreeViewer setInput error [message #661754 is a reply to message #661579] Sun, 27 March 2011 10:46 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
So, maybe i can give you some code snippet? I can't solve this problem by myself Sad
Re: TreeViewer setInput error [message #661764 is a reply to message #661754] Sun, 27 March 2011 16:45 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
Sure upload it somewhere or paste it here and I'll take a look (but I'm
just on holiday this week so it might take some time).

Please don't forget to provide the .ecore as well (ideally I have a
complete project I can simply drop into my workspace)

Tom

Am 27.03.11 03:46, schrieb Alex:
> So, maybe i can give you some code snippet? I can't solve this problem
> by myself :(
Re: TreeViewer setInput error [message #661809 is a reply to message #661764] Mon, 28 March 2011 05:13 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom, thank you. I uploaded whole project:
http://www.filedropper.com/workspace
rcp project:
lv.psiers.wtp
Re: TreeViewer setInput error [message #661818 is a reply to message #661809] Mon, 28 March 2011 06:35 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
Hi,

The problem is how you are setting up your IObservableMap 1-4. A feature
path has to only contain single valued features which is NOT the case in
your code.

I'm not sure what this should be good for:

> map[1] = EMFProperties.value(
> FeaturePath.fromList(WtpdbPackage.Literals.P6GROUP__ITEMS,
> WtpdbPackage.Literals.P6ITEM__NAME)).observeDetail(set);

but this is where your problem gets from.

Tom

Am 27.03.11 22:14, schrieb Alex:
> Tom, thank you. I uploaded whole project:
> http://www.filedropper.com/workspace
> rcp project:
> lv.psiers.wtp
Re: TreeViewer setInput error [message #661825 is a reply to message #661818] Mon, 28 March 2011 07:05 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom, thank you. But, i can't understand. I want create treeviewer, where root item is p6 group item and child items is p6group_items. How can i configure my IObservableMap?
Re: TreeViewer setInput error [message #662272 is a reply to message #661818] Wed, 30 March 2011 02:04 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
Hi,

I've filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=341301 so that
it gets easier for people to find out the root cause of the problem.

I'll release this change later this week or a the start of next week.

Tom

Am 27.03.11 23:35, schrieb Tom Schindl:
> Hi,
>
> The problem is how you are setting up your IObservableMap 1-4. A feature
> path has to only contain single valued features which is NOT the case in
> your code.
>
> I'm not sure what this should be good for:
>
>> map[1] = EMFProperties.value(
>> FeaturePath.fromList(WtpdbPackage.Literals.P6GROUP__ITEMS,
>> WtpdbPackage.Literals.P6ITEM__NAME)).observeDetail(set);
>
> but this is where your problem gets from.
>
> Tom
>
> Am 27.03.11 22:14, schrieb Alex:
>> Tom, thank you. I uploaded whole project:
>> http://www.filedropper.com/workspace
>> rcp project:
>> lv.psiers.wtp
>
Re: TreeViewer setInput error [message #662286 is a reply to message #662272] Wed, 30 March 2011 05:50 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom, thank you for your help. But i have problem anyway. Even if i create TreeLabelProvider with only one ObservableMap, i anyway got this exception:
IObservableMap[] map = new IObservableMap[1];
		map[0] = EMFProperties.value(WtpdbPackage.Literals.P6GROUP__NAME)
				.observeDetail(set);
		/*map[1] = EMFProperties.value(
						WtpdbPackage.Literals.P6GROUP__ITEMS).observeDetail(set);
		map[2] = EMFProperties.value(
				
						WtpdbPackage.Literals.P6ITEM__MEASURE).observeDetail(
				set);
		map[3] = EMFProperties.value(
						WtpdbPackage.Literals.P6ITEM__LIMIT)
				.observeDetail(set);
		map[4] = EMFProperties.value(
						WtpdbPackage.Literals.P6ITEM__TAXRATE).observeDetail(
				set);*/

		viewer.setLabelProvider(new TreeLabelProviderImpl(map));
Re: TreeViewer setInput error [message #662291 is a reply to message #662286] Wed, 30 March 2011 06:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
What you show here is exactly the code I tested and it worked for me.

TOm

Am 29.03.11 22:50, schrieb Alex:
> Tom, thank you for your help. But i have problem anyway. Even if i
> create TreeLabelProvider with only one ObservableMap, i anyway got this
> exception:
>
> IObservableMap[] map = new IObservableMap[1];
> map[0] = EMFProperties.value(WtpdbPackage.Literals.P6GROUP__NAME)
> .observeDetail(set);
> /*map[1] = EMFProperties.value(
>
> WtpdbPackage.Literals.P6GROUP__ITEMS).observeDetail(set);
> map[2] = EMFProperties.value(
>
>
> WtpdbPackage.Literals.P6ITEM__MEASURE).observeDetail(
> set);
> map[3] = EMFProperties.value(
> WtpdbPackage.Literals.P6ITEM__LIMIT)
> .observeDetail(set);
> map[4] = EMFProperties.value(
>
> WtpdbPackage.Literals.P6ITEM__TAXRATE).observeDetail(
> set);*/
>
> viewer.setLabelProvider(new TreeLabelProviderImpl(map));
>
Re: TreeViewer setInput error [message #662292 is a reply to message #662291] Wed, 30 March 2011 06:56 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom, maybe problem with TreeViewer version?
Re: TreeViewer setInput error [message #662293 is a reply to message #662292] Wed, 30 March 2011 07:00 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040105030201080605000709
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

No it is not! I got exactly your exception and fixed it by commenting
your other observable-map creations but because your code was not
runnable straigt ahead I modified it to be a standalone snippet.

Attached is the code i used to test

Tom



Am 29.03.11 23:56, schrieb Alex:
> Tom, maybe problem with TreeViewer version?


--------------040105030201080605000709
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
name="TestApp.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="TestApp.java"

aW1wb3J0IGphdmEudXRpbC5TZXQ7CgppbXBvcnQgb3JnLmVjbGlwc2UuY29y ZS5kYXRhYmlu
ZGluZy5vYnNlcnZhYmxlLklPYnNlcnZhYmxlOwppbXBvcnQgb3JnLmVjbGlw c2UuY29yZS5k
YXRhYmluZGluZy5vYnNlcnZhYmxlLlJlYWxtOwppbXBvcnQgb3JnLmVjbGlw c2UuY29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ewer setInput error [message #662294 is a reply to message #662293] Wed, 30 March 2011 07:14 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Sorry, i can't see attached code Sad
Re: TreeViewer setInput error [message #662300 is a reply to message #662294] Wed, 30 March 2011 07:25 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
> import java.util.Set;
>
> import org.eclipse.core.databinding.observable.IObservable;
> import org.eclipse.core.databinding.observable.Realm;
> import org.eclipse.core.databinding.observable.list.IObservableList ;
> import org.eclipse.core.databinding.observable.map.IMapChangeListen er;
> import org.eclipse.core.databinding.observable.map.IObservableMap;
> import org.eclipse.core.databinding.observable.map.MapChangeEvent;
> import org.eclipse.core.databinding.observable.masterdetail.IObserv ableFactory;
> import org.eclipse.core.databinding.observable.set.IObservableSet;
> import org.eclipse.emf.databinding.EMFProperties;
> import org.eclipse.emf.databinding.FeaturePath;
> import org.eclipse.emf.databinding.IEMFListProperty;
> import org.eclipse.jface.databinding.swt.SWTObservables;
> import org.eclipse.jface.databinding.viewers.ObservableListTreeCont entProvider;
> import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor;
> import org.eclipse.jface.viewers.LabelProviderChangedEvent;
> import org.eclipse.jface.viewers.StyledCellLabelProvider;
> import org.eclipse.jface.viewers.StyledString;
> import org.eclipse.jface.viewers.TreeViewer;
> import org.eclipse.jface.viewers.ViewerCell;
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.layout.FillLayout;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
>
> import wtpdb.WtpdbFactory;
> import wtpdb.WtpdbPackage;
> import wtpdb.p6group;
> import wtpdb.p6item;
> import wtpdb.wtpbase;
>
>
> public class TestApp {
>
> private TreeViewer init(Composite parent, wtpbase wtpBaseMain) {
> TreeViewer viewer = new TreeViewer(parent);
> ObservableListTreeContentProvider cp = new ObservableListTreeContentProvider(
> new TreeFactoryImpl(), new TreeStructureAdvisorImpl());
> viewer.setContentProvider(cp);
>
> IObservableSet set = cp.getKnownElements();
>
> IObservableMap[] map = new IObservableMap[1];
> map[0] = EMFProperties.value(WtpdbPackage.Literals.P6GROUP__NAME)
> .observeDetail(set);
> /*map[1] = EMFProperties.value(
> FeaturePath.fromList(WtpdbPackage.Literals.P6GROUP__ITEMS,
> WtpdbPackage.Literals.P6ITEM__NAME)).observeDetail(set);
> map[2] = EMFProperties.value(
> FeaturePath.fromList(WtpdbPackage.Literals.P6GROUP__ITEMS,
> WtpdbPackage.Literals.P6ITEM__MEASURE)).observeDetail(
> set);
> map[3] = EMFProperties.value(
> FeaturePath.fromList(WtpdbPackage.Literals.P6GROUP__ITEMS,
> WtpdbPackage.Literals.P6ITEM__LIMIT))
> .observeDetail(set);
> map[4] = EMFProperties.value(
> FeaturePath.fromList(WtpdbPackage.Literals.P6GROUP__ITEMS,
> WtpdbPackage.Literals.P6ITEM__TAXRATE)).observeDetail(
> set);*/
>
> viewer.setLabelProvider(new TreeLabelProviderImpl(map));
>
> IEMFListProperty groups = EMFProperties
> .list(WtpdbPackage.Literals.WTPBASE__GROUPS);
> viewer.setInput(groups.observe(wtpBaseMain));
>
> return viewer;
>
> }
>
> public static void main(String[] args) {
> final Display d = new Display();
> Realm.runWithDefault(SWTObservables.getRealm(d), new Runnable() {
>
> @Override
> public void run() {
> Shell s = new Shell();
> s.setLayout(new FillLayout());
>
> TestApp t = new TestApp();
> wtpbase wtpBaseMain = WtpdbFactory.eINSTANCE.createwtpbase();
> p6group g = WtpdbFactory.eINSTANCE.createp6group();
> g.setName("Bla Bla");
> wtpBaseMain.getGroups().add(g);
> t.init(s, wtpBaseMain);
>
> s.open();
>
> while( ! s.isDisposed() ) {
> if( ! d.readAndDispatch() ) {
> d.sleep();
> }
> }
> }
> });
>
> d.dispose();
> }
>
>
>
> private static class TreeFactoryImpl implements IObservableFactory {
>
> private IEMFListProperty multi = EMFProperties
> .multiList(WtpdbPackage.Literals.P6GROUP__ITEMS);
>
> @Override
> public IObservable createObservable(final Object target) {
> if (target instanceof IObservableList) {
> return (IObservable) target;
> } else if (target instanceof p6group) {
> return multi.observe(target);
> }
> return null;
> }
>
> }
>
> private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor {
> /*
> * @Override public Object getParent(Object element) { if(element
> * instanceof p6item) return ((p6item)element) }
> */
>
> @Override
> public Boolean hasChildren(Object element) {
> if (element instanceof p6group
> && ((p6group) element).getItems().size() > 0) {
> return Boolean.TRUE;
> }
> return super.hasChildren(element);
> }
> }
>
> private class TreeLabelProviderImpl extends StyledCellLabelProvider {
> private IMapChangeListener mapChangeListener = new IMapChangeListener() {
> public void handleMapChange(MapChangeEvent event) {
> Set<?> affectedElements = event.diff.getChangedKeys();
> if (!affectedElements.isEmpty()) {
> LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent(
> TreeLabelProviderImpl.this,
> affectedElements.toArray());
> fireLabelProviderChanged(newEvent);
> }
> }
> };
>
> public TreeLabelProviderImpl(IObservableMap... attributeMaps) {
> for (int i = 0; i < attributeMaps.length; i++) {
> attributeMaps[i].addMapChangeListener(mapChangeListener);
> }
> }
>
> @Override
> public String getToolTipText(Object element) {
> return "#dummy#";
> }
>
> @Override
> public void update(ViewerCell cell) {
> if (cell.getElement() instanceof p6group) {
> p6group group = (p6group) cell.getElement();
>
> StyledString styledString = new StyledString(
> group.getName() != null ? group.getName() : "noname",
> null);
> String decoration = " (" + group.getItems().size() + " Items)";
> styledString.append(decoration, StyledString.COUNTER_STYLER);
> cell.setText(styledString.getString());
> // cell.setImage(groupImage);
> cell.setStyleRanges(styledString.getStyleRanges());
> } else if (cell.getElement() instanceof p6item) {
> p6item item = ((p6item) cell.getElement());
> String value = "*noname*";
> if (item != null) {
> value = item.getName() + " | " + item.getMeasure() + " | "
> + item.getLimit() + " | " + item.getTaxrate();
> }
> StyledString styledString = new StyledString(value, null);
> cell.setText(styledString.getString());
> cell.setForeground(cell.getControl().getDisplay()
> .getSystemColor(SWT.COLOR_DARK_GRAY));
> // cell.setImage(groupItemImage);
> cell.setStyleRanges(styledString.getStyleRanges());
> }
> }
> }
> }

Am 30.03.11 00:14, schrieb Alex:
> Sorry, i can't see attached code :(
Re: TreeViewer setInput error [message #662302 is a reply to message #661579] Wed, 30 March 2011 08:07 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
OMG, i don't know what to do Sad
Re: TreeViewer setInput error [message #662316 is a reply to message #661579] Wed, 30 March 2011 09:00 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom, i think that problem in HibernateModelResource file:
resourceSet
				.getResourceFactoryRegistry()
				.getExtensionToFactoryMap()
				.put(Resource.Factory.Registry.DEFAULT_EXTENSION,
						new HibernateResourceFactory());


Here i am using HibernateResourceFactory, but in your example there are XMIResourceFactoryImpl. If i change my code to:
resourceSet
				.getResourceFactoryRegistry()
				.getExtensionToFactoryMap()
				.put(Resource.Factory.Registry.DEFAULT_EXTENSION,
						new XMIResourceFactoryImpl());


i can open my editor, but i got another exception:
java.net.MalformedURLException: unknown protocol: hibernate
Re: TreeViewer setInput error [message #662355 is a reply to message #661579] Wed, 30 March 2011 11:08 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom, in your code i see, that groups, containing in your wtpBaseMain is of type EObjectContainmentEList, but in my it is HibernatePersistableEList. I think, that problem is there, but i don't know how to fix it.
Re: TreeViewer setInput error [message #662430 is a reply to message #662355] Wed, 30 March 2011 15:42 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
No this is not a problem and expected when using Teneo. Please provide a
stack trace.

Tom

Am 30.03.11 04:08, schrieb Alex:
> Tom, in your code i see, that groups, containing in your wtpBaseMain is
> of type EObjectContainmentEList, but in my it is
> HibernatePersistableEList. I think, that problem is there, but i don't
> know how to fix it.
Re: TreeViewer setInput error [message #662548 is a reply to message #661579] Thu, 31 March 2011 05:14 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
!SESSION 2011-03-31 08:10:03.064 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_24
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments: -application lv.psiers.wtp.application
Command-line arguments: -application lv.psiers.wtp.application -data /home/alex/workspace/../runtime-lv.psiers.wtp.application -dev file:/home/alex/workspace/.metadata/.plugins/org.eclipse.pde .core/lv.psiers.wtp.application/dev.properties -os linux -ws gtk -arch x86 -consoleLog

!ENTRY org.eclipse.ui 4 0 2011-03-31 08:10:23.239
!MESSAGE org.eclipse.emf.databinding.internal.EMFObservableListDecora tor cannot be cast to org.eclipse.emf.ecore.EObject
!STACK 0
java.lang.ClassCastException: org.eclipse.emf.databinding.internal.EMFObservableListDecora tor cannot be cast to org.eclipse.emf.ecore.EObject
at org.eclipse.emf.databinding.internal.EMFValueProperty.doGetV alue(EMFValueProperty.java:62)
at org.eclipse.core.databinding.property.value.ValueProperty.ge tValue(ValueProperty.java:41)
at org.eclipse.core.internal.databinding.property.value.SetSimp leValueObservableMap.doGet(SetSimpleValueObservableMap.java: 110)
at org.eclipse.core.databinding.observable.map.ComputedObservab leMap$1.handleSetChange(ComputedObservableMap.java:58)
at org.eclipse.core.databinding.observable.set.SetChangeEvent.d ispatch(SetChangeEvent.java:61)
at org.eclipse.core.databinding.observable.ChangeManager.fireEv ent(ChangeManager.java:119)
at org.eclipse.core.databinding.observable.set.DecoratingObserv ableSet.fireSetChange(DecoratingObservableSet.java:59)
at org.eclipse.core.databinding.observable.set.DecoratingObserv ableSet.handleSetChange(DecoratingObservableSet.java:97)
at org.eclipse.core.databinding.observable.set.DecoratingObserv ableSet$1.handleSetChange(DecoratingObservableSet.java:71)
at org.eclipse.core.databinding.observable.set.SetChangeEvent.d ispatch(SetChangeEvent.java:61)
at org.eclipse.core.databinding.observable.ChangeManager.fireEv ent(ChangeManager.java:119)
at org.eclipse.core.databinding.observable.set.ObservableSet.fi reSetChange(ObservableSet.java:67)
at org.eclipse.core.internal.databinding.observable.masterdetai l.DetailObservableSet.access$1(DetailObservableSet.java:1)
at org.eclipse.core.internal.databinding.observable.masterdetai l.DetailObservableSet$1.handleSetChange(DetailObservableSet. java:46)
at org.eclipse.core.databinding.observable.set.SetChangeEvent.d ispatch(SetChangeEvent.java:61)
at org.eclipse.core.databinding.observable.ChangeManager.fireEv ent(ChangeManager.java:119)
at org.eclipse.core.databinding.observable.set.ObservableSet.fi reSetChange(ObservableSet.java:67)
at org.eclipse.core.databinding.observable.set.WritableSet.clea r(WritableSet.java:161)
at org.eclipse.core.internal.databinding.observable.masterdetai l.DetailObservableSet.clear(DetailObservableSet.java:190)
at org.eclipse.jface.internal.databinding.viewers.ObservableCol lectionTreeContentProvider.inputChanged(ObservableCollection TreeContentProvider.java:144)
at org.eclipse.jface.databinding.viewers.ObservableListTreeCont entProvider$Impl.inputChanged(ObservableListTreeContentProvi der.java:55)
at org.eclipse.jface.databinding.viewers.ObservableListTreeCont entProvider.inputChanged(ObservableListTreeContentProvider.j ava:203)
at org.eclipse.jface.viewers.ContentViewer.handleDispose(Conten tViewer.java:171)
at org.eclipse.jface.viewers.StructuredViewer.handleDispose(Str ucturedViewer.java:2302)
at org.eclipse.jface.viewers.ContentViewer$2.widgetDisposed(Con tentViewer.java:214)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:123)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1263)
at org.eclipse.swt.widgets.Widget.release(Widget.java:1080)
at org.eclipse.swt.widgets.Control.release(Control.java:3304)
at org.eclipse.swt.widgets.Composite.releaseChildren(Composite. java:1293)
at org.eclipse.swt.widgets.Widget.release(Widget.java:1083)
at org.eclipse.swt.widgets.Control.release(Control.java:3304)
at org.eclipse.swt.widgets.Widget.dispose(Widget.java:462)
at org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:695)
at org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:465)
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.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.add(PartStack.java:497)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103 )
at org.eclipse.ui.internal.PartStack.add(PartStack.java:483)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112 )
at org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor SashContainer.java:63)
at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA reaHelper.java:225)
at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre aHelper.java:213)
at org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:778)
at org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:677)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:638)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2860)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2768)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPag e.java:2760)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.j ava:2711)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2707)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2691)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2674)
at lv.psiers.wtp.actions.GroupAction.run(GroupAction.java:31)
at lv.psiers.wtp.views.ExpandBarView$1.hyperLinkButtonClicked(E xpandBarView.java:63)
at lv.psiers.customwidgets.hyperlinkbutton.HyperLinkButton.mous eDown(HyperLinkButton.java:70)
at lv.psiers.customwidgets.hyperlinkbutton.HyperLinkButton$1.mo useDown(HyperLinkButton.java:53)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:185)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3540)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3161)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at lv.psiers.wtp.Application.start(Application.java:22)
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(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
at org.eclipse.equinox.launcher.Main.main(Main.java:1384)

!ENTRY org.eclipse.ui 4 0 2011-03-31 08:10:23.424
!MESSAGE Unable to create editor ID lv.psiers.wtp.editors.group: org.eclipse.emf.databinding.internal.EMFObservableListDecora tor cannot be cast to org.eclipse.emf.ecore.EObject
!STACK 0
java.lang.ClassCastException: org.eclipse.emf.databinding.internal.EMFObservableListDecora tor cannot be cast to org.eclipse.emf.ecore.EObject
at org.eclipse.emf.databinding.internal.EMFValueProperty.doGetV alue(EMFValueProperty.java:62)
at org.eclipse.core.databinding.property.value.ValueProperty.ge tValue(ValueProperty.java:41)
at org.eclipse.core.internal.databinding.property.value.SetSimp leValueObservableMap.doGet(SetSimpleValueObservableMap.java: 110)
at org.eclipse.core.databinding.observable.map.ComputedObservab leMap$1.handleSetChange(ComputedObservableMap.java:68)
at org.eclipse.core.databinding.observable.set.SetChangeEvent.d ispatch(SetChangeEvent.java:61)
at org.eclipse.core.databinding.observable.ChangeManager.fireEv ent(ChangeManager.java:119)
at org.eclipse.core.databinding.observable.set.DecoratingObserv ableSet.fireSetChange(DecoratingObservableSet.java:59)
at org.eclipse.core.databinding.observable.set.DecoratingObserv ableSet.handleSetChange(DecoratingObservableSet.java:97)
at org.eclipse.core.databinding.observable.set.DecoratingObserv ableSet$1.handleSetChange(DecoratingObservableSet.java:71)
at org.eclipse.core.databinding.observable.set.SetChangeEvent.d ispatch(SetChangeEvent.java:61)
at org.eclipse.core.databinding.observable.ChangeManager.fireEv ent(ChangeManager.java:119)
at org.eclipse.core.databinding.observable.set.ObservableSet.fi reSetChange(ObservableSet.java:67)
at org.eclipse.core.internal.databinding.observable.masterdetai l.DetailObservableSet.access$1(DetailObservableSet.java:1)
at org.eclipse.core.internal.databinding.observable.masterdetai l.DetailObservableSet$1.handleSetChange(DetailObservableSet. java:46)
at org.eclipse.core.databinding.observable.set.SetChangeEvent.d ispatch(SetChangeEvent.java:61)
at org.eclipse.core.databinding.observable.ChangeManager.fireEv ent(ChangeManager.java:119)
at org.eclipse.core.databinding.observable.set.ObservableSet.fi reSetChange(ObservableSet.java:67)
at org.eclipse.core.databinding.observable.set.WritableSet.add( WritableSet.java:90)
at org.eclipse.core.internal.databinding.observable.masterdetai l.DetailObservableSet.add(DetailObservableSet.java:140)
at org.eclipse.jface.internal.databinding.viewers.ObservableCol lectionTreeContentProvider.getOrCreateNode(ObservableCollect ionTreeContentProvider.java:248)
at org.eclipse.jface.internal.databinding.viewers.ObservableCol lectionTreeContentProvider.getChildren(ObservableCollectionT reeContentProvider.java:193)
at org.eclipse.jface.internal.databinding.viewers.ObservableCol lectionTreeContentProvider.getChildren(ObservableCollectionT reeContentProvider.java:189)
at org.eclipse.jface.databinding.viewers.ObservableListTreeCont entProvider.getChildren(ObservableListTreeContentProvider.ja va:215)
at org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren( AbstractTreeViewer.java:1354)
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 lv.psiers.wtp.editors.GroupEditor.init(GroupEditor.java:248)
at lv.psiers.wtp.editors.GroupEditor.createPartControl(GroupEdi tor.java:141)
at org.eclipse.ui.internal.EditorReference.createPartHelper(Edi torReference.java:670)
at org.eclipse.ui.internal.EditorReference.createPart(EditorRef erence.java:465)
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.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.add(PartStack.java:497)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103 )
at org.eclipse.ui.internal.PartStack.add(PartStack.java:483)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112 )
at org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor SashContainer.java:63)
at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA reaHelper.java:225)
at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre aHelper.java:213)
at org.eclipse.ui.internal.EditorManager.createEditorTab(Editor Manager.java:778)
at org.eclipse.ui.internal.EditorManager.openEditorFromDescript or(EditorManager.java:677)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManag er.java:638)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched( WorkbenchPage.java:2860)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben chPage.java:2768)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPag e.java:2760)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.j ava:2711)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2707)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2691)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa ge.java:2674)
at lv.psiers.wtp.actions.GroupAction.run(GroupAction.java:31)
at lv.psiers.wtp.views.ExpandBarView$1.hyperLinkButtonClicked(E xpandBarView.java:63)
at lv.psiers.customwidgets.hyperlinkbutton.HyperLinkButton.mous eDown(HyperLinkButton.java:70)
at lv.psiers.customwidgets.hyperlinkbutton.HyperLinkButton$1.mo useDown(HyperLinkButton.java:53)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:185)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3540)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3161)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at lv.psiers.wtp.Application.start(Application.java:22)
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(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
Re: TreeViewer setInput error [message #662553 is a reply to message #662548] Thu, 31 March 2011 05:36 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
Can you make the code posted dump this way? I'm really sorry but I can't
help you anymore than I did already.

The modified example works for me and think it does for you as well.

So please modify mine as long as you can reproduce it with it or on the
other had give a me a *directly* runnable example (hint Teneo has
NOTHING to do with it!).

I'm sorry but I can't offer more than this on the newsgroup.

Tom

Am 30.03.11 22:14, schrieb Alex:
> !SESSION 2011-03-31 08:10:03.064
> -----------------------------------------------
> eclipse.buildId=unknown
> java.version=1.6.0_24
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
> Framework arguments: -application lv.psiers.wtp.application
> Command-line arguments: -application lv.psiers.wtp.application -data
> /home/alex/workspace/../runtime-lv.psiers.wtp.application -dev
> file:/home/alex/workspace/.metadata/.plugins/org.eclipse.pde
> .core/lv.psiers.wtp.application/dev.properties -os linux -ws gtk -arch
> x86 -consoleLog
>
> !ENTRY org.eclipse.ui 4 0 2011-03-31 08:10:23.239
> !MESSAGE org.eclipse.emf.databinding.internal.EMFObservableListDecora
> tor cannot be cast to org.eclipse.emf.ecore.EObject
> !STACK 0
> java.lang.ClassCastException:
> org.eclipse.emf.databinding.internal.EMFObservableListDecora tor cannot
> be cast to org.eclipse.emf.ecore.EObject
> at org.eclipse.emf.databinding.internal.EMFValueProperty.doGetV
> alue(EMFValueProperty.java:62)
> at org.eclipse.core.databinding.property.value.ValueProperty.ge
> tValue(ValueProperty.java:41)
> at org.eclipse.core.internal.databinding.property.value.SetSimp
> leValueObservableMap.doGet(SetSimpleValueObservableMap.java: 110)
> at org.eclipse.core.databinding.observable.map.ComputedObservab
> leMap$1.handleSetChange(ComputedObservableMap.java:58)
> at org.eclipse.core.databinding.observable.set.SetChangeEvent.d
> ispatch(SetChangeEvent.java:61)
> at org.eclipse.core.databinding.observable.ChangeManager.fireEv
> ent(ChangeManager.java:119)
> at org.eclipse.core.databinding.observable.set.DecoratingObserv
> ableSet.fireSetChange(DecoratingObservableSet.java:59)
> at org.eclipse.core.databinding.observable.set.DecoratingObserv
> ableSet.handleSetChange(DecoratingObservableSet.java:97)
> at org.eclipse.core.databinding.observable.set.DecoratingObserv
> ableSet$1.handleSetChange(DecoratingObservableSet.java:71)
> at org.eclipse.core.databinding.observable.set.SetChangeEvent.d
> ispatch(SetChangeEvent.java:61)
> at org.eclipse.core.databinding.observable.ChangeManager.fireEv
> ent(ChangeManager.java:119)
> at org.eclipse.core.databinding.observable.set.ObservableSet.fi
> reSetChange(ObservableSet.java:67)
> at org.eclipse.core.internal.databinding.observable.masterdetai
> l.DetailObservableSet.access$1(DetailObservableSet.java:1)
> at org.eclipse.core.internal.databinding.observable.masterdetai
> l.DetailObservableSet$1.handleSetChange(DetailObservableSet. java:46)
> at org.eclipse.core.databinding.observable.set.SetChangeEvent.d
> ispatch(SetChangeEvent.java:61)
> at org.eclipse.core.databinding.observable.ChangeManager.fireEv
> ent(ChangeManager.java:119)
> at org.eclipse.core.databinding.observable.set.ObservableSet.fi
> reSetChange(ObservableSet.java:67)
> at org.eclipse.core.databinding.observable.set.WritableSet.clea
> r(WritableSet.java:161)
> at org.eclipse.core.internal.databinding.observable.masterdetai
> l.DetailObservableSet.clear(DetailObservableSet.java:190)
> at org.eclipse.jface.internal.databinding.viewers.ObservableCol
> lectionTreeContentProvider.inputChanged(ObservableCollection
> TreeContentProvider.java:144)
> at org.eclipse.jface.databinding.viewers.ObservableListTreeCont
> entProvider$Impl.inputChanged(ObservableListTreeContentProvi der.java:55)
> at org.eclipse.jface.databinding.viewers.ObservableListTreeCont
> entProvider.inputChanged(ObservableListTreeContentProvider.j ava:203)
> at org.eclipse.jface.viewers.ContentViewer.handleDispose(Conten
> tViewer.java:171)
> at org.eclipse.jface.viewers.StructuredViewer.handleDispose(Str
> ucturedViewer.java:2302)
> at org.eclipse.jface.viewers.ContentViewer$2.widgetDisposed(Con
> tentViewer.java:214)
> at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe
> ner.java:123)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1263)
> at org.eclipse.swt.widgets.Widget.release(Widget.java:1080)
> at org.eclipse.swt.widgets.Control.release(Control.java:3304)
> at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.
> java:1293)
> at org.eclipse.swt.widgets.Widget.release(Widget.java:1083)
> at org.eclipse.swt.widgets.Control.release(Control.java:3304)
> at org.eclipse.swt.widgets.Widget.dispose(Widget.java:462)
> at org.eclipse.ui.internal.EditorReference.createPartHelper(Edi
> torReference.java:695)
> at org.eclipse.ui.internal.EditorReference.createPart(EditorRef
> erence.java:465)
> 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.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.add(PartStack.java:497)
> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103 )
> at org.eclipse.ui.internal.PartStack.add(PartStack.java:483)
> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112 )
> at org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor
> SashContainer.java:63)
> at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA
> reaHelper.java:225)
> at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre
> aHelper.java:213)
> at org.eclipse.ui.internal.EditorManager.createEditorTab(Editor
> Manager.java:778)
> at org.eclipse.ui.internal.EditorManager.openEditorFromDescript
> or(EditorManager.java:677)
> at org.eclipse.ui.internal.EditorManager.openEditor(EditorManag
> er.java:638)
> at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(
> WorkbenchPage.java:2860)
> at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben
> chPage.java:2768)
> at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPag
> e.java:2760)
> at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.j
> ava:2711)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator
> .java:70)
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa
> ge.java:2707)
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa
> ge.java:2691)
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa
> ge.java:2674)
> at lv.psiers.wtp.actions.GroupAction.run(GroupAction.java:31)
> at lv.psiers.wtp.views.ExpandBarView$1.hyperLinkButtonClicked(E
> xpandBarView.java:63)
> at lv.psiers.customwidgets.hyperlinkbutton.HyperLinkButton.mous
> eDown(HyperLinkButton.java:70)
> at lv.psiers.customwidgets.hyperlinkbutton.HyperLinkButton$1.mo
> useDown(HyperLinkButton.java:53)
> at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe
> ner.java:185)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja
> va:3540)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3161)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav
> a:2640)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault
> (Realm.java:332)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work
> bench.java:664)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j
> ava:149)
> at lv.psiers.wtp.Application.start(Application.java:22)
> 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(NativeMethodAcce
> ssorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
> thodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 620)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
>
> !ENTRY org.eclipse.ui 4 0 2011-03-31 08:10:23.424
> !MESSAGE Unable to create editor ID lv.psiers.wtp.editors.group:
> org.eclipse.emf.databinding.internal.EMFObservableListDecora tor cannot
> be cast to org.eclipse.emf.ecore.EObject
> !STACK 0
> java.lang.ClassCastException:
> org.eclipse.emf.databinding.internal.EMFObservableListDecora tor cannot
> be cast to org.eclipse.emf.ecore.EObject
> at org.eclipse.emf.databinding.internal.EMFValueProperty.doGetV
> alue(EMFValueProperty.java:62)
> at org.eclipse.core.databinding.property.value.ValueProperty.ge
> tValue(ValueProperty.java:41)
> at org.eclipse.core.internal.databinding.property.value.SetSimp
> leValueObservableMap.doGet(SetSimpleValueObservableMap.java: 110)
> at org.eclipse.core.databinding.observable.map.ComputedObservab
> leMap$1.handleSetChange(ComputedObservableMap.java:68)
> at org.eclipse.core.databinding.observable.set.SetChangeEvent.d
> ispatch(SetChangeEvent.java:61)
> at org.eclipse.core.databinding.observable.ChangeManager.fireEv
> ent(ChangeManager.java:119)
> at org.eclipse.core.databinding.observable.set.DecoratingObserv
> ableSet.fireSetChange(DecoratingObservableSet.java:59)
> at org.eclipse.core.databinding.observable.set.DecoratingObserv
> ableSet.handleSetChange(DecoratingObservableSet.java:97)
> at org.eclipse.core.databinding.observable.set.DecoratingObserv
> ableSet$1.handleSetChange(DecoratingObservableSet.java:71)
> at org.eclipse.core.databinding.observable.set.SetChangeEvent.d
> ispatch(SetChangeEvent.java:61)
> at org.eclipse.core.databinding.observable.ChangeManager.fireEv
> ent(ChangeManager.java:119)
> at org.eclipse.core.databinding.observable.set.ObservableSet.fi
> reSetChange(ObservableSet.java:67)
> at org.eclipse.core.internal.databinding.observable.masterdetai
> l.DetailObservableSet.access$1(DetailObservableSet.java:1)
> at org.eclipse.core.internal.databinding.observable.masterdetai
> l.DetailObservableSet$1.handleSetChange(DetailObservableSet. java:46)
> at org.eclipse.core.databinding.observable.set.SetChangeEvent.d
> ispatch(SetChangeEvent.java:61)
> at org.eclipse.core.databinding.observable.ChangeManager.fireEv
> ent(ChangeManager.java:119)
> at org.eclipse.core.databinding.observable.set.ObservableSet.fi
> reSetChange(ObservableSet.java:67)
> at org.eclipse.core.databinding.observable.set.WritableSet.add(
> WritableSet.java:90)
> at org.eclipse.core.internal.databinding.observable.masterdetai
> l.DetailObservableSet.add(DetailObservableSet.java:140)
> at org.eclipse.jface.internal.databinding.viewers.ObservableCol
> lectionTreeContentProvider.getOrCreateNode(ObservableCollect
> ionTreeContentProvider.java:248)
> at org.eclipse.jface.internal.databinding.viewers.ObservableCol
> lectionTreeContentProvider.getChildren(ObservableCollectionT
> reeContentProvider.java:193)
> at org.eclipse.jface.internal.databinding.viewers.ObservableCol
> lectionTreeContentProvider.getChildren(ObservableCollectionT
> reeContentProvider.java:189)
> at org.eclipse.jface.databinding.viewers.ObservableListTreeCont
> entProvider.getChildren(ObservableListTreeContentProvider.ja va:215)
> at org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren(
> AbstractTreeViewer.java:1354)
> 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 lv.psiers.wtp.editors.GroupEditor.init(GroupEditor.java:248)
> at lv.psiers.wtp.editors.GroupEditor.createPartControl(GroupEdi
> tor.java:141)
> at org.eclipse.ui.internal.EditorReference.createPartHelper(Edi
> torReference.java:670)
> at org.eclipse.ui.internal.EditorReference.createPart(EditorRef
> erence.java:465)
> 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.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.add(PartStack.java:497)
> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103 )
> at org.eclipse.ui.internal.PartStack.add(PartStack.java:483)
> at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112 )
> at org.eclipse.ui.internal.EditorSashContainer.addEditor(Editor
> SashContainer.java:63)
> at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorA
> reaHelper.java:225)
> at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAre
> aHelper.java:213)
> at org.eclipse.ui.internal.EditorManager.createEditorTab(Editor
> Manager.java:778)
> at org.eclipse.ui.internal.EditorManager.openEditorFromDescript
> or(EditorManager.java:677)
> at org.eclipse.ui.internal.EditorManager.openEditor(EditorManag
> er.java:638)
> at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(
> WorkbenchPage.java:2860)
> at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Workben
> chPage.java:2768)
> at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPag
> e.java:2760)
> at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.j
> ava:2711)
> at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator
> .java:70)
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa
> ge.java:2707)
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa
> ge.java:2691)
> at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPa
> ge.java:2674)
> at lv.psiers.wtp.actions.GroupAction.run(GroupAction.java:31)
> at lv.psiers.wtp.views.ExpandBarView$1.hyperLinkButtonClicked(E
> xpandBarView.java:63)
> at lv.psiers.customwidgets.hyperlinkbutton.HyperLinkButton.mous
> eDown(HyperLinkButton.java:70)
> at lv.psiers.customwidgets.hyperlinkbutton.HyperLinkButton$1.mo
> useDown(HyperLinkButton.java:53)
> at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe
> ner.java:185)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja
> va:3540)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3161)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav
> a:2640)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:24 38)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault
> (Realm.java:332)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work
> bench.java:664)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j
> ava:149)
> at lv.psiers.wtp.Application.start(Application.java:22)
> 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(NativeMethodAcce
> ssorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
> thodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 620)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
>
Re: TreeViewer setInput error [message #662932 is a reply to message #661579] Fri, 01 April 2011 14:07 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom, sorry for my persistence. I'm trying to find problem with debugger help. When debugging in AbstractTreeViewer.java in getRawChildren method i see that condition
if (equals(parent, getRoot())) {
					return super.getRawChildren(parent);
				}

is not satisfied for me. But in your Project app this condition returns true. Maybe this can point you in the right direction?
BTW, code that you gave above works fine for me.
Re: TreeViewer setInput error [message #663037 is a reply to message #662932] Sat, 02 April 2011 15:33 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
Ok now we get closer through this still doesn't lead to any exception
like you told us earlier.

The problem you are having is that the equals-method in case of Teneo
lists is not following the List-contract (because of performance).

The solution to this is to provide your own IElementComparer to the
viewer which is doing an == check before calling .equals().

IIRC the problem has already been solved with Eclipse DB [1] which will
be delivered with 3.7 and though it doesn't talk about Teneo i think I
was debugging a teneo problem by then.

But anyways beside that I'd really suggest you add an IElementComparer
because e.g. when refreshing instances from the database this allows you
to do equality check based upon the database primary key instead of
object equality.

Tom

[1]https://bugs.eclipse.org/bugs/show_bug.cgi?id=327326

Am 01.04.11 07:07, schrieb Alex:
> Tom, sorry for my persistence. I'm trying to find problem with debugger
> help. When debugging in AbstractTreeViewer.java in getRawChildren
> method i see that condition
> if (equals(parent, getRoot())) {
> return super.getRawChildren(parent);
> }
>
> is not satisfied for me. But in your Project app this condition returns
> true. Maybe this can point you in the right direction?
> BTW, code that you gave above works fine for me.
Re: TreeViewer setInput error [message #663173 is a reply to message #663037] Mon, 04 April 2011 08:34 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom, thank you. May be you can point me how can i do that?
viewer.setComparer(new IElementComparer() {

			@Override
			public int hashCode(Object element) {
				return System.identityHashCode(element);
			}
			

			@Override
			public boolean equals(Object a, Object b) {
				return (a==b)
			}
		});
Re: TreeViewer setInput error [message #663209 is a reply to message #663173] Mon, 04 April 2011 10:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
That looks good (at least to fix you setInput/refresh problem

Tom

Am 04.04.11 10:34, schrieb Alex:
> Tom, thank you. May be you can point me how can i do that?
>
> viewer.setComparer(new IElementComparer() {
>
> @Override
> public int hashCode(Object element) {
> return System.identityHashCode(element);
> }
>
>
> @Override
> public boolean equals(Object a, Object b) {
> return (a==b)
> }
> });
>
Re: TreeViewer setInput error [message #663210 is a reply to message #663209] Mon, 04 April 2011 10:45 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom, you know, it's really works fine. Problem was in Nebula XViewer widget. There are updateStatusLabel() method:
public void updateStatusLabel(){
   if (getRoot() != null && ((ITreeContentProvider) getContentProvider()) != null) {
         loadedNum = ((ITreeContentProvider) getContentProvider()).getChildren(getRoot()).length;
      }
}

i changed this code to this:
public void updateStatusLabel(){
   if (getRoot() != null && ((ITreeContentProvider) getContentProvider()) != null) {
      loadedNum = ((ITreeContentProvider) getContentProvider()).getElements(getRoot()).length;
      }
}

and now it's works fine. Is that a good approach?
Re: TreeViewer setInput error [message #663212 is a reply to message #663210] Mon, 04 April 2011 10:52 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
Yes and this a bug you should report back to the XViewer team because
they should not call getChildren() with the root as input that's where
getElements has to be called.

Tom


Am 04.04.11 12:45, schrieb Alex:
> Tom, you know, it's really works fine. Problem was in Nebula XViewer
> widget. There are updateStatusLabel() method:
>
> public void updateStatusLabel(){
> if (getRoot() != null && ((ITreeContentProvider) getContentProvider())
> != null) {
> loadedNum = ((ITreeContentProvider)
> getContentProvider()).getChildren(getRoot()).length;
> }
> }
>
> i changed this code to this:
>
> public void updateStatusLabel(){
> if (getRoot() != null && ((ITreeContentProvider) getContentProvider())
> != null) {
> loadedNum = ((ITreeContentProvider)
> getContentProvider()).getElements(getRoot()).length;
> }
> }
>
> and now it's works fine. Is that a good approach?
Re: TreeViewer setInput error [message #663220 is a reply to message #663212] Mon, 04 April 2011 11:41 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Thank you Tom. I will necessarily report about this bug to nebula project. I have one more question about eclipse rcp architecture. Maybe i can create new topic or ask my question here?
Re: TreeViewer setInput error [message #663226 is a reply to message #663220] Mon, 04 April 2011 11:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
If it is only RCP specific you should ask at eclipse.platform.rcp newsgroup.

Tom

Am 04.04.11 13:41, schrieb Alex:
> Thank you Tom. I will necessarily report about this bug to nebula
> project. I have one more question about eclipse rcp architecture. Maybe
> i can create new topic or ask my question here?
Re: TreeViewer setInput error [message #663229 is a reply to message #663226] Mon, 04 April 2011 12:15 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Ok, question is about your databinding example. There you use AdminViewPart, where you use stuff, like ObservablesManager, Undo-Redo Actions, IModelResource, ResourceProvider and so on. Then you share this between your project parts through it's constructors. Where i can put this things if i use Editors (not ViewParts).
Re: TreeViewer setInput error [message #663233 is a reply to message #663229] Mon, 04 April 2011 12:28 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
Though they are named Part they are NOT ViewPart nor EditorPart but all
togeher live in EditorPart that's why I can share them. So you can't
simply share them in pure RCP between because there's no 1:1
relationship between them a ViewPart/EditorPart/...

Tom

Am 04.04.11 14:15, schrieb Alex:
> Ok, question is about your databinding example. There you use
> AdminViewPart, where you use stuff, like ObservablesManager, Undo-Redo
> Actions, IModelResource, ResourceProvider and so on. Then you share this
> between your project parts through it's constructors. Where i can put
> this things if i use Editors (not ViewParts).
Re: TreeViewer setInput error [message #663235 is a reply to message #663233] Mon, 04 April 2011 12:39 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Thank you Tom. But how can i share Undo-Redo actions between EditorParts? Maybe you have some experience and you can help me?
Re: TreeViewer setInput error [message #663249 is a reply to message #663235] Mon, 04 April 2011 12:51 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6505
Registered: July 2009
Senior Member
Simple answer you can't and NO user would expect that Undo/Redo is
shared between Editors. You'd expect undo/redo to happen only on the
currently active editor.

Tom

Am 04.04.11 14:39, schrieb Alex:
> Thank you Tom. But how can i share Undo-Redo actions between
> EditorParts? Maybe you have some experience and you can help me?
Re: TreeViewer setInput error [message #663451 is a reply to message #661579] Tue, 05 April 2011 07:43 Go to previous message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom hello. I have one question about your project. After editing some person, i'm executing undo action. After that i can't open person editor second time, because in XMIModelResource setSavePoint() method, changes variable != -1. Is this a bug?
public IStatus setSavePoint()
  {
    if (changes == -1)
    {
      changes = 0;
      beforeSavePointModified = modified;
      return Status.OK_STATUS;
    }
    return Status.CANCEL_STATUS;
  }
Previous Topic:Copying proxy objects
Next Topic:New Ecore container-reference validation rule in Helios: Bug?
Goto Forum:
  


Current Time: Sat Oct 19 21:54:59 GMT 2019

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

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

Back to the top