[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.newcomer] Getting workspace from within a program
|
- From: "R (Chandra) Chandrasekhar" <chandrac@xxxxxxxxxxxxxx>
- Date: Thu, 09 Mar 2006 13:33:26 +0800
- Newsgroups: eclipse.newcomer
- Organization: EclipseCorner
- User-agent: Thunderbird 1.5 (Windows/20051201)
Folks,
I am new to Eclipse and am trying to get the location of the current
workspace and the root workspace from within a program.
The Eclipse FAQ book (p 291, FAQ 286) suggests:
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
I have tried to run this as a code fragment from within Eclipse with
these two imports:
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
but have not been successful.
I tried running it as a JavascrapBook page (.jpage file with the
requisite imports) but it said that the Workspace was closed.
All I want is to see that the above code does return what I would expect
it to, so that I can use it to set some environment variables elsewhere.
What should I do to run it standalone?
Thanks for your help.
Chandra
[Cross-posted on the eclipse.platform newsgroup as well.]