Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How I want to refresh workspace programmatically
How I want to refresh workspace programmatically [message #102787] Wed, 30 July 2003 00:01 Go to next message
Eclipse UserFriend
Originally posted by: hoalq.fsoft.com.vn

Hi
I meet a problem while I want to program with eclipse.
I want to code a program that perform refresh workspace.
My code:

package src;

/**
* @author hoalq
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
public class LocalRefresh {
IResource resource;
IProject project;
IProgressMonitor monitor;
public LocalRefresh()throws CoreException{
project=resource.getProject();
resource.refreshLocal(1,monitor);
}


public static void main(String[] args) throws CoreException {
LocalRefresh app=new LocalRefresh();
}
}

but it when I run as Application I have message :
java.lang.NullPointerException
at src.LocalRefresh.<init>(LocalRefresh.java:23)
at src.LocalRefresh.main(LocalRefresh.java:29)
Exception in thread "main"
please correc it for me. thanks very much
Re: How I want to refresh workspace programmatically [message #103081 is a reply to message #102787] Wed, 30 July 2003 08:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

if you take a look into your code you will see that your IResource
resource isn't initialized (means it is null).

Ralf

Le Quang Hoa schrieb:

> Hi
> I meet a problem while I want to program with eclipse.
> I want to code a program that perform refresh workspace.
> My code:
>
> package src;
>
> /**
> * @author hoalq
> *
> * To change the template for this generated type comment go to
> * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
> */
> import org.eclipse.core.resources.*;
> import org.eclipse.core.runtime.CoreException;
> import org.eclipse.core.runtime.IProgressMonitor;
> public class LocalRefresh {
> IResource resource;
> IProject project;
> IProgressMonitor monitor;
> public LocalRefresh()throws CoreException{
> project=resource.getProject();
> resource.refreshLocal(1,monitor);
> }
>
>
> public static void main(String[] args) throws CoreException {
> LocalRefresh app=new LocalRefresh();
> }
> }
>
> but it when I run as Application I have message :
> java.lang.NullPointerException
> at src.LocalRefresh.<init>(LocalRefresh.java:23)
> at src.LocalRefresh.main(LocalRefresh.java:29)
> Exception in thread "main"
> please correc it for me. thanks very much
>
Re: How I want to refresh workspace programmatically [message #103633 is a reply to message #103081] Wed, 30 July 2003 21:35 Go to previous message
Eclipse UserFriend
Originally posted by: hoalq.fsoft.com.vn

Thanks
what can I do to initialize IResource. I don't know the way to initialize
it. if you know pls help me.
thanks
Hoalq

Ralf Koban wrote:

> Hi,

> if you take a look into your code you will see that your IResource
> resource isn't initialized (means it is null).

> Ralf

> Le Quang Hoa schrieb:

> > Hi
> > I meet a problem while I want to program with eclipse.
> > I want to code a program that perform refresh workspace.
> > My code:
> >
> > package src;
> >
> > /**
> > * @author hoalq
> > *
> > * To change the template for this generated type comment go to
> > * Window>Preferences>Java>Code Generation>Code and Comments
> > */
> > import org.eclipse.core.resources.*;
> > import org.eclipse.core.runtime.CoreException;
> > import org.eclipse.core.runtime.IProgressMonitor;
> > public class LocalRefresh {
> > IResource resource;
> > IProject project;
> > IProgressMonitor monitor;
> > public LocalRefresh()throws CoreException{
> > project=resource.getProject();
> > resource.refreshLocal(1,monitor);
> > }
> >
> >
> > public static void main(String[] args) throws CoreException {
> > LocalRefresh app=new LocalRefresh();
> > }
> > }
> >
> > but it when I run as Application I have message :
> > java.lang.NullPointerException
> > at src.LocalRefresh.<init>(LocalRefresh.java:23)
> > at src.LocalRefresh.main(LocalRefresh.java:29)
> > Exception in thread "main"
> > please correc it for me. thanks very much
> >
Previous Topic:prevent User from local file system
Next Topic:Eclipse 2.1.1 & jre 1.4.2
Goto Forum:
  


Current Time: Sun Jun 08 05:34:10 EDT 2025

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

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

Back to the top