Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Why do I keep losing my workplaces?(they keep going away and I have to start over)
Why do I keep losing my workplaces? [message #1702236] Mon, 20 July 2015 22:21 Go to next message
Norman Noobie is currently offline Norman NoobieFriend
Messages: 7
Registered: April 2015
Junior Member
Kepler service release 2 running on Win 8.1

Why do the source files in my Workspaces keep disappearing? Here's the scenario. I work in Workspace foo for a while. I then switch to Workspace bar (a completely different project). I then want to work on Foo again, but there are no source files. The source files are present on the disk, but according to Eclipse I've just started a new project. I fix it by checking my files into my VCS, using Eclipse to create a bunch of MT files with the same names, killing Eclipse, then pulling my files back out of my VCS. Restart Eclipse, all is good.

Whiskey Tango Foxtrot?

My directory layout is
 ...../Workspace
             + Foo
                    + .metadata
                    + .other eclipse files
                    + Src
                            Foo.java
             +Bar
                    + .Eclipse dot files
                    + Src
                            Bar.java
                            BarClass1.java
                            BarClass2.java

Am I using Eclipse wrong? Should I have 1 workspace and switch projects? I'm an Eclipse n00b.
Re: Why do I keep losing my workplaces? [message #1702238 is a reply to message #1702236] Mon, 20 July 2015 22:53 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3799
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 07/20/2015 04:21 PM, Norman Noobie wrote:
> Kepler service release 2 running on Win 8.1
>
> Why do the source files in my Workspaces keep disappearing? Here's the
> scenario. I work in Workspace foo for a while. I then switch to
> Workspace bar (a completely different project). I then want to work on
> Foo again, but there are no source files. The source files are present
> on the disk, but according to Eclipse I've just started a new project.
> I fix it by checking my files into my VCS, using Eclipse to create a
> bunch of MT files with the same names, killing Eclipse, then pulling my
> files back out of my VCS. Restart Eclipse, all is good.
>
> Whiskey Tango Foxtrot?
>
> My directory layout is
>
> ...../Workspace
> + Foo
> + .metadata
> + .other eclipse files
> + Src
> Foo.java
> +Bar
> + .Eclipse dot files
> + Src
> Bar.java
> BarClass1.java
> BarClass2.java
>
> Am I using Eclipse wrong? Should I have 1 workspace and switch
> projects? I'm an Eclipse n00b.
>

It's a little hard to follow, but yes, you appear not to grasp the
difference between workspaces and projects.

Think of workspaces as a convenient collection of possibly related
projects. You can put as many projects into a workspace as you like, but
I tend to have several workspaces containing closely interrelated projects.

Also, if you've imported the same project into different workspaces, you
might be inconvenienced as well--depending on what you had in mind.

Hope this helps.
Re: Why do I keep losing my workplaces? [message #1702241 is a reply to message #1702238] Mon, 20 July 2015 23:26 Go to previous messageGo to next message
Norman Noobie is currently offline Norman NoobieFriend
Messages: 7
Registered: April 2015
Junior Member
I admit I'm confused as to the difference between a Workspace and a Project. I like to keep my source code under a single directory, for Java I'm using Workspace. Is Workspace a magic word in Eclipse (I think Eclipse created it first time I ran it)? Would I be better off renaming my Workspace directory to something like Java_Code?

Nothing is imported, I don't do enough Java to have common files between unrelated projects.

If it helps, whenever I create a new project the source files always end up in .../Workspace/New_Project/New_Project/normal eclipse files and dirs. That is, the name of the new project is repeated twice. Why? Hellifino, and I spent a lot of time once trying to figure it out.
Re: Why do I keep losing my workplaces? [message #1702243 is a reply to message #1702241] Tue, 21 July 2015 00:19 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3799
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 07/20/2015 05:26 PM, Norman Noobie wrote:
> I admit I'm confused as to the difference between a Workspace and a
> Project. I like to keep my source code under a single directory, for
> Java I'm using Workspace. Is Workspace a magic word in Eclipse (I think
> Eclipse created it first time I ran it)? Would I be better off renaming
> my Workspace directory to something like Java_Code?
>
> Nothing is imported, I don't do enough Java to have common files between
> unrelated projects.
>
> If it helps, whenever I create a new project the source files always end
> up in .../Workspace/New_Project/New_Project/normal eclipse files and
> dirs. That is, the name of the new project is repeated twice. Why?
> Hellifino, and I spent a lot of time once trying to figure it out.

Here's your workspace with a couple of Java projects:

/home/norman/dev/workspace
+-- ProjectA
`-- ProjectB

The Eclipse workspace is equivalent to what's in the Eclipse workbench
(IDE) at any given time when you launch it. The workspace is equal to
the Project, Package and Navigator Views in the Eclipse workbench. You
access ProjectA and ProjectB via the workbench out of the workspace.

The workspace is a filesystem anchor for Eclipse. In the workspace,
there is a subdirectory, .metadata, that corrals all the known
information about the workspace, including settings, the list of
projects in it, etc.

I'm talking about Java projects here.

The project has .project, .classpath and sometimes other files and/or
subdirectories (like .settings) depending on what kind of project it is
IF IN FACT it is an Eclipse project at all. Underneath your project you see:

/home/norman/dev
+-- ProjectA
| +-- src
| `-- test
`-- ProjectB
+-- src
`-- test


The workspace has nothing whatsoever to do with the organization of any
of the projects it contains. It might not even contain the project
filesystems (I never put my project source code inside the workspace
filesystem, for example, though Eclipse makes the workspace the default
place to create a new project.)

The project, on the other hand, is the most important entity. It exists
separately from Eclipse and from the workspace it is in. It doesn't need
Eclipse to build, indeed, it should not need Eclipse to build. If you're
working on real, commercial software, it likely will not be built by
Eclipse except when you're working with it. Otherwise, it will be built
by Jenkins/Hudson, CruiseControl, your favorite build system, Maven,
ant, whatever.

So, the workspace is just where you "pin" a project so Eclipse can work
on it.

I suggest you follow some tutorials that lead you through building
workspaces and projects to some end. I would suggest vogella.de/tutorials.

Be patient, it will sink in.
Re: Why do I keep losing my workplaces? [message #1702247 is a reply to message #1702243] Tue, 21 July 2015 02:16 Go to previous messageGo to next message
Norman Noobie is currently offline Norman NoobieFriend
Messages: 7
Registered: April 2015
Junior Member
I'll need to sleep on that as it seems 100% sdrawkcab from my mental model of how things work, but right now what you just said just seems confusing.

How do you have a project tree that doesn't contain any source files? What's the point of having a project tree if the source files are under Grandma's mattress?

(next day) Thanks for the link to vogella.de/tutorials, that's explaining a lot of things I was fuzzy on.

[Updated on: Tue, 21 July 2015 13:37]

Report message to a moderator

Re: Why do I keep losing my workplaces? [message #1702311 is a reply to message #1702247] Tue, 21 July 2015 13:35 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3799
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 07/20/2015 08:16 PM, Norman Noobie wrote:
> I'll need to sleep on that as it seems 100% sdrawkcab from my mental
> model of how things work, but right now what you just said just seems
> confusing.
>
> How do you have a project tree that doesn't contain any source files?
> What's the point of having a project tree if the source files are under
> Grandma's mattress?

The project "tree" (filesystem) does have source files.

Think of the workspace as a sheet of paper containing a list of projects
and where they live. Some of them, by default, live inside the same
drawer (filesystem) as the workspace. This is how it will probably be
for you as a beginner. If you ever do serious development, those
projects (that is, their source files) will live in a version control
system like Git and will probably not live inside the workspace
subdirectory, but on a path outside it which depends on how your group
sets up projects.

What's confusing is that I gave you the whole story instead of a narrow
one. That was probably a mistake.

Just stop thinking of the workspace as your project, that's all.
Re: Why do I keep losing my workplaces? [message #1702494 is a reply to message #1702236] Wed, 22 July 2015 17:24 Go to previous messageGo to next message
Jason Lynch is currently offline Jason LynchFriend
Messages: 11
Registered: July 2009
Junior Member
Workspace is places to management resources which lay on some storage like hard disk. Workspace is not a project.
if you just directly put something into workplaces it will not just reflect on the package explore or navigator view.

I would suggest you to create Eclipse Project using the new menu. and normally then you can just put all you content under that Project. of course you can drop them into the folder of that created project. Then go back to Eclipse package explorer or navigator view, select the project and use right-context menu, => Refresh (or simply F5) to get the content shown up.
Re: Why do I keep losing my workplaces? [message #1702514 is a reply to message #1702494] Wed, 22 July 2015 19:32 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
You might benefit from a basic description of the relationship between Workspaces and Projects. Here are some descriptions that I've written; they mostly say the same thing but in slightly different words.
https://www.eclipse.org/forums/index.php/m/1353633/#msg_1353633 (which references http://stackoverflow.com/a/9841397/639520)
https://www.eclipse.org/forums/index.php?t=msg&th=890096&goto=1514671&#msg_1514671
https://www.eclipse.org/forums/index.php?t=msg&th=781857&goto=1386344&#msg_1386344
Previous Topic:Custom language syntax with outline and highlight?
Next Topic:How do I get to the Product Configuration Editor?
Goto Forum:
  


Current Time: Sun Sep 22 20:19:09 GMT 2019

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

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

Back to the top