Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » ExternalJavaProject (support for java outside a java project) and Jar update.
ExternalJavaProject (support for java outside a java project) and Jar update. [message #250933] Fri, 25 January 2008 06:12 Go to next message
Eclipse UserFriend
Originally posted by: valere.fedronic.ext.streamezzo.com

Hi,

I am using the new api (3.3) that allows to create a CompilationUnit in
a mock javaProject :

WorkingCopyOwner#newWorkingCopy(...)
[great API thanks!!]

This allows me to offer code select/completion and validation for a java
like language.

I am having some troubles with jar file on the classpath that are
updated on the file system.
E.g Let's say there is jar with a no arg method foo(), the code assit
works well and proposes the foo() completion. But if the jar is updated
and the foo() method, has now one argument , the corresponding model is
not updated and thus the code assist still proposes the old no arg foo()
method. And if there is a new method, it will not be proposed to completion.
[If a restart the application, the model is updated.]

How can i dynamically update/reconcile the jar model ?


Thanks,
Valère.
Re: ExternalJavaProject (support for java outside a java project) and Jar update. [message #250937 is a reply to message #250933] Fri, 25 January 2008 06:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: valere.fedronic.ext.streamezzo.com

I found a way:

IPackageFragment.close();
IPackageFragment.open(null);

I don't know if it is the best way but it works.


valere fedronic a écrit :
> Hi,
>
> I am using the new api (3.3) that allows to create a CompilationUnit in
> a mock javaProject :
>
> WorkingCopyOwner#newWorkingCopy(...)
> [great API thanks!!]
>
> This allows me to offer code select/completion and validation for a java
> like language.
>
> I am having some troubles with jar file on the classpath that are
> updated on the file system.
> E.g Let's say there is jar with a no arg method foo(), the code assit
> works well and proposes the foo() completion. But if the jar is updated
> and the foo() method, has now one argument , the corresponding model is
> not updated and thus the code assist still proposes the old no arg foo()
> method. And if there is a new method, it will not be proposed to
> completion.
> [If a restart the application, the model is updated.]
>
> How can i dynamically update/reconcile the jar model ?
>
>
> Thanks,
> Valère.
Re: ExternalJavaProject (support for java outside a java project) and Jar update. [message #250949 is a reply to message #250933] Fri, 25 January 2008 12:56 Go to previous messageGo to next message
Eclipse UserFriend
valere fedronic wrote:
> How can i dynamically update/reconcile the jar model ?

To refresh external jar files, use IJavaModel#refreshExternalArchives(IJavaElement[], IProgressMonitor).
Since in your case you don't have access to the IJavaProject that references the external jars, I would pass
null as the 'elementsScope' so that all external jars are refreshed.

Jerome
Re: ExternalJavaProject (support for java outside a java project) and Jar update. [message #251004 is a reply to message #250949] Mon, 28 January 2008 04:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: valere.fedronic.ext.streamezzo.com

Thanks jerome,

The IJavaModel#refreshExternalArchives doesn't work.
The Model Manager fails to detect a change in the project, beacause
the DeltaProcessor#createExternalArchiveDelta() always return false.

The DeltaProcessor doesn't check the jars timeStamp because it considers
that there are no java projects.
-->
JavaModelManager.getJavaModelManager().getJavaModel().getJav aProjects()
returns an empty array....

To make it works i must do the following :

#################################

for (IFile file: libraries)
{
IPackageFragmentRoot packageFragmentRoot =
externalProject.getPackageFragmentRoot(file);
packageFragmentRoot.close();
}

JavaModelManager.getJavaModelManager().getDeltaProcessor().p rojectCachesToReset.add(externalProject);
JavaModelManager.getJavaModelManager().getDeltaProcessor().r esetProjectCaches();

###################################



It seems that the DeltaProcessor doesn't support ExternalJavaProjects.

Valère.


Jerome Lanneluc a écrit :
> valere fedronic wrote:
>> How can i dynamically update/reconcile the jar model ?
>
> To refresh external jar files, use
> IJavaModel#refreshExternalArchives(IJavaElement[], IProgressMonitor).
> Since in your case you don't have access to the IJavaProject that
> references the external jars, I would pass
> null as the 'elementsScope' so that all external jars are refreshed.
>
> Jerome
Re: ExternalJavaProject (support for java outside a java project) and Jar update. [message #251007 is a reply to message #251004] Mon, 28 January 2008 05:23 Go to previous messageGo to next message
Eclipse UserFriend
valere fedronic wrote:
> Thanks jerome,
>
> The IJavaModel#refreshExternalArchives doesn't work.

Then it sounds like a bug. Could you please enter a bug report against JDT/Core?

Thanks
Jerome
Re: ExternalJavaProject (support for java outside a java project) and Jar update. [message #251018 is a reply to message #251007] Mon, 28 January 2008 09:57 Go to previous message
Eclipse UserFriend
Originally posted by: valere.fedronic.ext.streamezzo.com

https://bugs.eclipse.org/bugs/show_bug.cgi?id=216772

Regards,
Valère.

Jerome Lanneluc a écrit :
> valere fedronic wrote:
>> Thanks jerome,
>>
>> The IJavaModel#refreshExternalArchives doesn't work.
>
> Then it sounds like a bug. Could you please enter a bug report against
> JDT/Core?
>
> Thanks
> Jerome
Previous Topic:pattern matching and JDT
Next Topic:JUnit: How to test listener class methods using JUnit?
Goto Forum:
  


Current Time: Sun Apr 20 19:35:46 EDT 2025

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

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

Back to the top