Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Different classloader in ToolBehaviorProvider?
Different classloader in ToolBehaviorProvider? [message #1216413] Thu, 28 November 2013 13:16 Go to next message
Soeren M is currently offline Soeren MFriend
Messages: 77
Registered: September 2011
Member
Hi,

Ive tried to implement the DoubleClickFeature and got a Classcast Exception.
Edit: Maybe its necessary how I create the object:
Object o = getFeatureProvider().getBusinessObjectForPictogramElement(context.getInnerPictogramElement());

java.lang.ClassCastException: moby.impl.SuperStateImpl cannot be cast to moby.impl.SuperStateImpl


Actually I am avoiding it via:
o.getClass().getName().equals(SuperStateImpl.class.getName())

But yeah, thats ugly...

Do you use different class loader?

[Updated on: Thu, 28 November 2013 13:30]

Report message to a moderator

Re: Different classloader in ToolBehaviorProvider? [message #1219202 is a reply to message #1216413] Mon, 02 December 2013 15:35 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Soeren,

Graphiti itself does not use different classloaders, but the Equinox
framework underneath does. Each bundle (Eclipse plugin) will be loaded using
its own class loader.

Michael
Re: Different classloader in ToolBehaviorProvider? [message #1219315 is a reply to message #1216413] Tue, 03 December 2013 10:02 Go to previous messageGo to next message
Soeren M is currently offline Soeren MFriend
Messages: 77
Registered: September 2011
Member
Hey Michael,

thanks for your reply Smile

Well, I dont know if I understand you, but is it correct if I say that will happen always, or am I doing something wrong there?
I would like to avoid my approach and just check the instance of my objects, is that possible?
Re: Different classloader in ToolBehaviorProvider? [message #1219729 is a reply to message #1219315] Thu, 05 December 2013 15:11 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Soeren,

it should not happen always. Can you give more details on what you are
trying?

Michael
Re: Different classloader in ToolBehaviorProvider? [message #1219834 is a reply to message #1216413] Fri, 06 December 2013 08:28 Go to previous message
Soeren M is currently offline Soeren MFriend
Messages: 77
Registered: September 2011
Member
Sure,

I tried to set up the DoubleClickFeature. I created my own Ecore-Model and the ToolBehaviourProvider.

public class MobyEditorToolBehaviorProvider extends DefaultToolBehaviorProvider {

	...
	
	@Override
	public ICustomFeature getDoubleClickFeature(IDoubleClickContext context) {
		Object o = getFeatureProvider().getBusinessObjectForPictogramElement(context.getInnerPictogramElement());
		if(o.getClass().getName().equals(SuperStateImpl.class.getName())) { //XXX: FIX ME
			return new SuperStateCollapseFeature(getFeatureProvider());
		}
	 
	    return super.getDoubleClickFeature(context);
	}

        ...
}


Maybe its my fault. I didnt use the canExecute method from the CustomFeature. I rewrote it and it works fine. Thank you Smile

Anyways I am wondering that I cant check it in the ToolBehaviorProvider like I did.

Thats the correct code, just in case anyone is running into it like me:
Toggle Spoiler
Previous Topic:Control Points for CurvedConnection
Next Topic:graphiti property view during refresh,want to write model by emf recording commad
Goto Forum:
  


Current Time: Thu Apr 25 09:41:21 GMT 2024

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

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

Back to the top