Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » implementing ITableItemLabelProvider with aspects
implementing ITableItemLabelProvider with aspects [message #594341] Thu, 20 July 2006 14:09
Daniel Mahler is currently offline Daniel MahlerFriend
Messages: 53
Registered: July 2009
Member
I have been experimenting with customizing emf generated code using AspectJ,
[and so far it has been pretty close to a raging succcess. :) ]
Now I am trying to 'Tree with Columns' editor page to do something useful.
Since the column contents are fairly uniform,
I using AspectJ to essentially create a mixin trait to inherit into all my
item providers (see code below).
My model is generated from an XSD (that explains the odd classnames) and
comes in 2 packages.
So I have created three trivial interfaces:
and andcestor for all item providers, and 2 specializations of it (1 for
each package).

I the aspect I then make the generated item providers implement the new
interfaces and I make the new top inteface provide default implementations
for the ITableItemLabelProvider interface and declare the it to extend all
the item provider interfaces.

Finally I add _1ItemProviderAdapterFactory.new() to the supportedTypes
list of the adapter factory in each package using after advice on its
constructor.

As far as I understand the EMF framework, this should do it,
since now all the item providers implement ITableItemLabelProvider
and both the adapter factories support it.
However, when I run the plugin,
I only get the new behaviour for the document root node
and all the descendants revert to the eclipse default behavior,
of showing the same information in both columns.
According to the AJDT tools my advice is being applied to all my classes,
so I do not know what is going on.
Any advice appreciated.

thanks
D




++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++
public interface CrcsItemProvider {

}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++
public interface CCSItemProvider extends CrcsItemProvider {

}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++
public interface RCSItemProvider extends CrcsItemProvider {

}

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++

public privileged aspect TextProvider {

declare parents: com.rightscom.ns.ccs.provider.*Provider implements
CCSItemProvider;

declare parents: org.relaxng.ns.structure._1.provider.*Provider
implements RCSItemProvider;

declare parents: CrcsItemProvider implements ITableItemLabelProvider,
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource;

////////////////////////////

public String CrcsItemProvider.getColumnText (Object o, int i) {
String res = null;
switch (i) {
case 0: res = getText(o); break;
default: res ="ZZZZZZZZ"; break;
}
return res;
}

public Object CrcsItemProvider.getColumnImage (Object o, int i) {
Object res = null;
switch (i) {
case 0: res = getImage(o); break;
default: res =null; break;
}
return getImage(o);
}

after (CcsItemProviderAdapterFactory t) returning:
execution(CcsItemProviderAdapterFactory.new())
&& this(t) {
t.supportedTypes.add(ITableItemLabelProvider.class);
}

after (_1ItemProviderAdapterFactory t) returning:
execution(_1ItemProviderAdapterFactory.new())
&& this(t) {
t.supportedTypes.add(ITableItemLabelProvider.class);
}
....
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++
Previous Topic:VerifyError When Running with JUnit
Next Topic:Capturing join points inside Eclipse code.
Goto Forum:
  


Current Time: Sat Nov 29 01:31:47 GMT 2014

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

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