[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jwt-dev] How to extend Editpart in JWT
|
Hi Kim,
you're absolutely right, the EditPartAdapterFactory requires the
original package structure. I'm currently working on a few changes to
make it easier to define a custom package layout but there are a few
problems. I think I can come back to you with a solution on monday.
Regards,
Chris
Am 03.09.2010 13:48, schrieb Kim Nguyen:
Hi Christian, Marc,
Thank you for your answer. I tried to debug EPC plugin, it works fine.
The editpart of EPC could load without problem.
But I think why our editparts could not load sticked up with the
EditPartAdapterFactory.
At line 314 the target will be combined from editpartPackage and
ModelPackage.
private static final String MODEL_ROOT_PACKAGE =
"org.eclipse.jwt.we.model"; //$NON-NLS-1$
private static final String MODEL_EXTERNAL_ROOT_PACKAGE =
"org.eclipse.jwt.meta.model";
What happend when our package structure doesn't match "
org.eclipse.jwt.we.model" or "org.eclipse.jwt.meta.model".
I have debugged and see that in method "findAdapter" created wrong
"target" for our editpart. So which caused that newInstance of our
Editpart never could be created.
See:
private Object findAdapter(Class targetClass, Object type)
{
String target = targetClass.getName();
Object editPart = null;
if (target.startsWith(MODEL_EXTERNAL_ROOT_PACKAGE))
{
target = target.replace(MODEL_EXTERNAL_ROOT_PACKAGE, MODEL_ROOT_PACKAGE);
}
if (!target.startsWith(MODEL_ROOT_PACKAGE))
{
return null;
}
target = editPartPackage + target.substring(MODEL_ROOT_PACKAGE.length())
+ EDITPART_POSTFIX;
try
{
editPart = this.bundle.loadClass(target).newInstance();
logger.instanceCreation(target);
}
.......
return null;
}
Best regards,
Kim
> Date: Thu, 2 Sep 2010 17:48:23 +0200
> From: christian.saad@xxxxxxxxxxxxxxxxxxxxxxxxxx
> To: marc.dutoo@xxxxxxxxxxx
> CC: kimnguyen@xxxxxxxxxx; jwt-dev@xxxxxxxxxxx
> Subject: Re: How to extend Editpart in JWT
>
> Hi Kim, Marc,
>
> the EPC view still works fine for me. Take a look at the view extension
> in the plugin.xml which registeres the EpcFactoryRegistry. The factory
> registry creates a CompositeEditPartFactory using the original JWT
> factory and a custom EPC factory which allows to use your own EditParts.
> The order in which the factories in the CompositeEditPartFactory are
> queried is the same as the order in which they are stored, so you have
> to make sure to register your custom EditPartFactory first.
>
> Regards,
> Chris
>
> Am 02.09.2010 12:06, schrieb Marc Dutoo:
> > Hi Kim
> >
> > Does the EditPart of the EPC Plugin load on your Eclipse ?
> >
> > If not, it would be a bug.
> >
> > Maybe Chris has some more ideas...
> >
> > Regards,
> > Marc
> >
> >
> > Kim Nguyen a écrit :
> >> Hi Marc,
> >>
> >> We are searching for possibility how to extends the EditPart in JWT
> >> now. We found this link, which describes the same problem what we have
> >> too.
> >> https://bugs.eclipse.org/bugs/show_bug.cgi?id=257725
> >>
> >> The problem what we have is that we have the own meta model, where
> >> element extend from jwt meta modell. So we want to use our own
> >> editpart to makes more flexibility.
> >> To do that, we have looked at EditpartFactory, which is registered in
> >> RegistryFactory. This step work fine.
> >> In the next step we want to load our new editpart with the
> >> EditpartFactory, but this the new editpart didn't load.
> >> I have looked at EPC example but could find out why it does not work.
> >> Do you have some ideas?
> >>
> >> Best regards,
> >>
> >> Kim
> >>