|
|
Re: Determining the client project of an EJB project from a plugin [message #222553 is a reply to message #222532] |
Thu, 02 October 2008 13:13 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: k.mitov.xxx.xxx
Hi Stephen,
It is possible to find the client project in the following way:
IModelProvider provider = ModelProviderManager.getModelProvider(project);
String jarName = ((EJBJar)provider.getModelObject()).getEjbClientJar();
IProject clientProject =
ResourcesPlugin.getWorkspace().getRoot().getProject(getClien tNameFromJarName(jarName));
where the method getClientNameFromJarName is
private String getClientNameFromJarName(String jarName) {
if (jarName == null)
return null;
if (jarName.endsWith(".jar")) //$NON-NLS-1$
return jarName.substring(0, jarName.lastIndexOf(".jar")); //$NON-NLS-1$
return jarName;
}
You can see this code in
org.eclipse.jst.jee.model.internal.EJB3MergedModelProvider.j ava
Best Regards,
Kiril
Stephen Burdeau wrote:
> I am writing a plugin where I have a handle to an EJB project (IProject)
> and I want to determine what the corresponding client project is, if any.
> I noticed that the file .settings/org.eclipse.wst.common.component for the
> EJB project looks like the following:
> <?xml version="1.0" encoding="UTF-8"?>
> <project-modules id="moduleCoreId" project-version="1.5.0">
> <wb-module deploy-name="CreditQueryEJB">
> <wb-resource deploy-path="/" source-path="/ejbModule"/>
> <dependent-module deploy-path="/"
> handle="module:/resource/CreditQueryEJBClient/CreditQueryEJBClient ">
> <dependency-type>uses</dependency-type>
> </dependent-module>
> <property name="java-output-path"/>
> <property name="ClientProject" value="CreditQueryEJBClient"/>
> <property name="ClientJARURI" value="CreditQueryEJBClient.jar"/>
> </wb-module>
> </project-modules>
> So, it looks like I could get this information from the ClientProject
> property in this file.
> I have been searching the WTP documentation, google, and source code in an
> effort to determine how I get at these properties from my plugin, but so
> far with no luck.
> Can anyone point me in the right direection?
|
|
|
Powered by
FUDForum. Page generated in 0.05542 seconds