Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Core expression, adapt to inner class
Core expression, adapt to inner class [message #335871] Thu, 07 May 2009 14:24 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hey,

I'm trying to use the <adapt> element in a core expression, where the
target type is an inner class. So that looks like:

<activeWhen>
<and>
<count
value="1">
</count>
<iterate>
<adapt type="com.example.Outer.Inner">
</adapt>
</iterate>
</and>
</activeWhen>

That doesn't work. I also tried type="com.example.Outer$Inner", doesn't
work either.

Using type="java.lang.Object" and then adapting programatically inside
the handler's execute method works fine for test selections, so I'm sure
I have some objects for which the handler should be active..

Hope that someone can help.
Felix
Re: Core expression, adapt to inner class [message #335872 is a reply to message #335871] Thu, 07 May 2009 14:44 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hm it must be some other problem. I extracted the inner class to be a
toplevel type and the handler remains inactive. I just read that the
expression returns not loaded if

"either the adapter* or the type referenced isn't loaded yet"

This is what probably happens in my case.

*) But I don't understand to which "adapter" the above phrase refers to.

Thanks for help,
Felix
Re: Core expression, adapt to inner class [message #335877 is a reply to message #335871] Thu, 07 May 2009 17:27 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

<adapt .../> does not use the IAdapter#getAdapter(*) interface. It only
uses org.eclipse.core.runtime.adapters and IAdapterManager#getAdapter(*)
Do you provide an adapter factory for the adapter manager?

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: Core expression, adapt to inner class [message #335883 is a reply to message #335877] Thu, 07 May 2009 17:55 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Paul Webster wrote:
> <adapt .../> does not use the IAdapter#getAdapter(*) interface. It only
> uses org.eclipse.core.runtime.adapters and IAdapterManager#getAdapter(*)
> Do you provide an adapter factory for the adapter manager?

No... *crying*. Thanks so much for telling me this :-)

Any reasons why the IAdapter interface itself isn't considered?

I might have been able to nail the problem down with a proper debug
entry point for the evaluation of such core expressions. Any Tip?

Thanks again,
Felix
Re: Core expression, adapt to inner class [message #335885 is a reply to message #335883] Thu, 07 May 2009 18:06 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Felix Dorner wrote:
>
> Any reasons why the IAdapter interface itself isn't considered?

It has to do with class loading. o.e.core.expression is a pretty
low-level plugin, and so when you want a core expression to adapt to
"org.example.MyClass" o.e.core.expressions has no way of turning that
into a Class<?> object ... it can't see the class loader that can load
it by default. But that's just a technical problem.

There are potentially ways around it, but they either aren't reliable or
they would cause massive plugin loading on their first evaluations.

> I might have been able to nail the problem down with a proper debug
> entry point for the evaluation of such core expressions. Any Tip?

There is tracing available for core expressions, in the Tracing tab of
the launch config dialog. I'd try there first.

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:Can't use Install Software and can't run some plug-ins on 3.5 M7 release
Next Topic:How to correctly save the workspace..
Goto Forum:
  


Current Time: Tue Apr 23 06:19:42 GMT 2024

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

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

Back to the top