Home » Eclipse Projects » Eclipse Platform » Is there a way I can get Eclipse "build" the java file I just imported at when I want?
Is there a way I can get Eclipse "build" the java file I just imported at when I want? [message #33855] |
Thu, 15 May 2003 15:19  |
Eclipse User |
|
|
|
Originally posted by: wgyun.hotmail.com
Hi there,
I'm writing a new import wizard to import a java file into my
project(basicly copy the file into Eclipse and refresh the parent folder). I
thought once I imported the java file, I should be able to get the compiled
class file as well, but it seemed to be not the case, the build process was
postponed somehow, and when I tried to get the class file, it couldn't be
found. So my question is if I can synchronize the build process before I
tried to access the compiled class file. Put in another way, can I start the
build process programmatically and wait for the build process to complete
before I do another dependent task? I appreciate your help a lot!
Thanks!
|
|
| |
Re: Is there a way I can get Eclipse "build" the java file I just imported at when I want? [message #34261 is a reply to message #33890] |
Thu, 15 May 2003 16:36   |
Eclipse User |
|
|
|
Originally posted by: wgyun.hotmail.com
Sorry, I may not stated it clearly, the project did get refreshed but before
I tried to
access the class file, the code is something like this:
public ImportJava implements IRunnableWithProgress
{
...
ProjectUtil.copyFile(javaf, destpath);
final IResource resource = project;
display.syncExec(new Runnable()
{
public void run()
{
try
{
resource.refreshLocal(IResource.DEPTH_ONE, null);
}
catch (CoreException e)
{
WebServicesPlugin.log(e);
}
}
});
// Problem is in here, try to access the binary of the import java file
but find nothing
...
// however, once this thread is run through, the binary file is there
}
my question is whether I can synchronize the build process(just like what I
did to synchronize the refresh process which didn't work for build process)
before I try to access the build result?
Thanks for your reply!
"Olivier Thomann" <Olivier_Thomann@ca.ibm.comNOSPAM> wrote in message
news:kep7cvgojhi42rk3eeviqcdfrftiqscg22@4ax.com...
> On Thu, 15 May 2003 15:19:43 -0400, "Cindy Wen" <wgyun@hotmail.com>
> wrote:
> >I'm writing a new import wizard to import a java file into my
> >project(basicly copy the file into Eclipse and refresh the parent
folder). I
> >thought once I imported the java file, I should be able to get the
compiled
> >class file as well, but it seemed to be not the case, the build process
was
> >postponed somehow, and when I tried to get the class file, it couldn't be
> >found. So my question is if I can synchronize the build process before I
> >tried to access the compiled class file. Put in another way, can I start
the
> >build process programmatically and wait for the build process to complete
> >before I do another dependent task? I appreciate your help a lot!
> >Thanks!
> You should refresh your project. I guess the file you copied in your
> project is out of sync. Then there is no delta sent for its addition
> and therefore no build.
> --
> Olivier
|
|
| | |
Re: Is there a way I can get Eclipse "build" the java file I just imported at when I want? [message #45953 is a reply to message #34261] |
Fri, 23 May 2003 10:43  |
Eclipse User |
|
|
|
Originally posted by: John_Arthorne.oti.com_
Jumping in the conversation a bit late, but I thought I'd point out that
the code snippet below is wrong. It is using syncExec to execute the
refresh in the UI thread. This is generally the exact opposite of what
you want to do. Long running work like refresh and build should NOT
happen in the UI thread, because this will freeze the UI and prevent paints.
To answer your original question, you can force a build using the
methods IWorkspace.build or IProject.build. I generally wouldn't
recommend doing this though, since if the user has chosen to turn off
builds, they will be pretty annoyed if you force a build on them.
--
Cindy Wen wrote:
> Sorry, I may not stated it clearly, the project did get refreshed but before
> I tried to
> access the class file, the code is something like this:
>
> public ImportJava implements IRunnableWithProgress
> {
> ...
> ProjectUtil.copyFile(javaf, destpath);
>
> final IResource resource = project;
> display.syncExec(new Runnable()
> {
> public void run()
> {
> try
> {
> resource.refreshLocal(IResource.DEPTH_ONE, null);
> }
> catch (CoreException e)
> {
> WebServicesPlugin.log(e);
> }
> }
> });
>
> // Problem is in here, try to access the binary of the import java file
> but find nothing
> ...
> // however, once this thread is run through, the binary file is there
> }
|
|
|
Goto Forum:
Current Time: Fri Apr 25 19:19:26 EDT 2025
Powered by FUDForum. Page generated in 0.06213 seconds
|