Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9126121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:57:52+00:00 2026-06-17T06:57:52+00:00

I have a project in eclipse workspace. When I open this project as IJavaProject

  • 0

I have a project in eclipse workspace.

enter image description here

When I open this project as IJavaProject using the following code, I have the project “not open”.

IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject orig = root.getProject(this.projectName);
orig.open(null /* IProgressMonitor */);
orig.refreshLocal(IResource.DEPTH_ZERO, null);
this.javaProject = JavaCore.create(orig);

I opened the IProject with open() method, and refreshed manually using refreshLocal following avoiding "resource is out of sync with the filesystem"

enter image description here

I have other resources not opened.

enter image description here

I tried “F5” to refresh the project, but it doesn’t work.

What might be wrong? How can I open the resources?

ADDED

I tried to open the resource with new NullProgressMonitor(), but it didn’t work.

orig.open(new NullProgressMonitor());
orig.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());

ADDED2

With this code that uses javaModel, I got the information that all of the projects in my workspace is closed. Does this mean my workspace is broken? When I opened the workspace using eclipse IDE, I could open and compile the Java code.

IJavaModel javaModel = JavaCore.create(root);
this.javaProject = javaModel.getJavaProject(this.projectName);

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:57:53+00:00Added an answer on June 17, 2026 at 6:57 am

    Code style :

    You should avoid ‘null’ as parameters when possible. This is always better for readability (and maintainability). here, the API designers have provided actual objects to say “no value” :

    orig.open(new NullProgressMonitor());
    orig.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
    

    Issue :

    I believe that your problem lies in the second of these lines : you refresh the project, but not any of its members. What if you try with the INFINITE depth so that all contained files are actually refreshed?

    orig.open(new NullProgressMonitor());
    orig.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
    

    UPDATE :

    Actually, this “(not open)” in the toString of your resource is not at the workspace level. Your IProject and IFiles are well opened and refreshed (you probably don’t even need that if your project is already opened).

    The Java model is not the same as the workspace, and java elements not being “opened” have no meaning at the workspace level, it only means that there is no buffer opened on the contents of the java element. You should not have to worry about opening the java elements, the jdt will do the work if and when needed during your manipulation of its elements.

    You might want to create the whole java model instead of only what corresponds to the project though :

    IJavaModel javaModel = JavaCore.create(root);
    this.javaProject = javaModel.getJavaProject(this.projectName);
    

    This might avoid strange errors later on :).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several projects open in an Eclipse workspace. Like so: com.harbl.project.one com.harbl.project.two com.harbl.project.three
I have a eclipse plugin code to manipulate a class (smcho.Hello) in a project/workspace.
I have imported an existing project into Eclipse workspace. I have this line of
I'm using RTC and Eclipse Helios. I have a project loaded in my workspace,
I have a .war project in Eclipse. It is probably not relevant but I
I have created a Dynamic Web Project in my Eclipse workspace. It is also
If I have an Eclipse project already in my workspace (say downloaded from version
I am using Eclipse 3.4.2 to develop my code. As part of my project
I have a project in eclipse workspace. I would like to make another program
Scenario Let's say I have an Eclipse workspace with Project A, Project B, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.