how to change views with clearcase on eclipse - eclipse

I'm using eclipse to work on a HUGE C project and it works generally well except for not being able to change views.
I create a new project and set the project source to the clearcase vob directory and it works just fine except it stores the project files in the vob. then when I change views the project cant be opened because its meta-data is sitting in the old view. I can create a new project but eclipse refuses to have two projects with the same path so I (probably unwisely) remove the original project and create it again. I'm spending too much time waiting for the indexer every time I switch views.
How can I switch views with out having to re-index everything?

I also worked on a project that used ClearCase with Eclipse. The same kind of drama that you describe happened to us on a regular basis. ClearCase was a big part of my reason for leaving that job.
With some distance between me an that horror, I've thought up a possible solution: Set up several different installations of Eclipse, with not just separate workspaces but separate .metadata and related stuff. Check out into separate Eclipses from the different views, then shut down one and fire up another to work with another view.
I haven't tried this, but it seems to me this should work.
Oh yes, you'll want to export your preferences between Eclipse installations.

Are you talking about snapshot or dynamic views here?
The path should be unique per view in both cases anyway.
In either case, what eclipse will not let you do is to have, in the same (eclipse) workspace, two projects with the same (eclipse) name.
You can try:
to have them in two different workspaces
to have a different .project per view (with a different name), provided those views reference the LATEST of two different branches.
(as As mentioned earlier in Which eclipse files belong under Version Control, those two files -- .project and .classpath -- can be under version control, provided they only use relative path.)

Perhaps the answer here is not to let clearcase anywhere near your workspace?
Use 'create project from existing source', so that the project lives inside the clearcase view, instead of having the project live in the workspace with a source folder inside the view.
Then you can have one workspace for each of your views.
This does imply checking in .cproject, .project, .classpath, etc.

if i switch view and use the same project it sometimes works if I manually copy .cproject and .project from one view to the other.

Related

Eclipse: Is it Possible to Open Files that are in a Workspace But Not in a Project?

I have a folder hierarchy that looks like this:
- workspace
- some_folder
+ eclipse_project
Is it possible to open and view the hierarchy in the project explorer of Eclipse beginning at "some_folder," instead of at "eclipse_project?" If so, how is this accomplished? When I try importing, Eclipse obviously refuses to because the files in the outer folder are already in the workspace.
Or does this contradict the principle behind Eclipse and projects?
Thanks.
Or does this contradict the principle behind Eclipse and projects?
Yes, it does. The File menu does offer to let you Open File..., but whether it's supported by an editor and how much functionality is retained is entirely up to that editor. Some will flat-out fail.
As a workaround, you can create a New General->File, expand the Advanced section of the wizard, and set the new in-workspace file to link to the real file's physical on-disk location, as long as that location is not in some way under the workspace's location. Note that even this may not always be supported by extremely old editors.

Multiple sub-workspaces in Eclipse

I write code in several languages (Python, C, C++, and Java) using Eclipse. Is it possible to designate a directory on my machine (say /home/workspace/) as the "primary" workspace for any Eclipse session, but then to have subfolders, /home/workspace/python, /home/workspace/java, etc., in which I can create new Eclipse projects.
I don't want to have to navigate menus and select different workspaces for each session of Eclipse that I start up. I would rather just always have permission to manipulate any projects from a variety of folders at any time, but I can't find a clear answer about whether this can be done and how to do it.
As I understand your question; You want to have one workspace, but be able to code in several different languages without switching workspace but at the same time keep the projects separated?
First I would suggest you consider several workspaces, I find it convenient to keep settings and projects in separate workspaces. I rarely have to switch language that often.
But. I think what you want to do is to keep several working sets. You create one java working set, one C++ set and associate your different projects with a working set. Then you can minimize the java working set when you are running C++. For working sets you dont need any subfolders on the harddrive.
You might also want to look into Mylyn. Its a great tool for those who often are switching context. It saves the context (eclipse perspective, open files, etc) as associated with a task.
How about setting Eclipse to prompt for the workspace at launch? It wouldn't allow you to work in two languages at once, but should do the trick otherwise.
An Eclipse workspace can contain projects slated for different languages and those projects can live anywhere on your hard drive. There are at least two ways to do what you want. When creating a new project, uncheck the Use default location checkbox and browse to or specify the folder where you want your project to live. If a project already exists import the project into the workspace using the File->Import menu option and then select Existing Projects into workspace. In the next screen make sure the checkbox for Copy projects into workspace is not selected. This will leave the source files in the original folder.
In the Project explorer view, all the projects are going to look like they live at the root level. However you can group related projects into working sets. Then select just the working set you're interested in and all the others will disappear from view.
A warning is in order if you make use of eclipse variables in external tools (and possibly elsewhere). The syntax you use for paths needs to be adjusted. For example with projects outside the workspace this syntax ${workspace_loc:/MyProject/MyFile.txt} is no longer the same as this syntax ${workspace_loc}/MyProject/MyFile.txt

Is it possible to prevent Eclipse from closing up the project space when you close the app?

I have a Java project in Eclipse that mirrors a directory structure on my hard drive and every time I open Eclipse I have to manually open all of the folders to see the source files inside them. Is there a way to avoid this so that everything stays open between app sessions?
With the CNF alone (the Common Navigation Framework), I don't think so.
But with Mylyn (which is part of certain Eclipse packages), you can because the Mylyn task will keep the relevant files/classes/methods visible from one session ot the next.

Starteam shortcut file

Is it possible to create StarTeam shortcut, opening project and overriding working directory?
Is it possible to create one StarTeam shortcut, opening several projects at a time?
Problem is: I have several solutions, which use the same StarTeam project, and I have to manually change working folder very often (View -> Properties -> Working folder). It is not possible to share data between solutions: local view should be located in separate place for each solution.
You could create different views for each project. Different views can have different working folders; in fact, they do by default. Keep in mind, a view can be set to behave pretty much the same as the default view, with regards to which revisions of files you see. But they can have their own working folders. The downside of this technique is that Change Requests and the like will also be "in the view," so moving them will not necessarily affect other views. But given that you are working on an entirely separate projects, that might not be all such a bad thing. As usual, you should experiment with this in a test project, and make sure you're happy with the behavior, before using it on your "life" repository.
The override/alternate directory for each project and folder is maintained inside a local file - not on the server. The default working folder is kept on the server, and any time you update it the changes are propigating to all other users.
The shortcut xml has no place to specify a working folder.
If you don't need the StarTeam GUI, stcmd allows you to specify a new working folder for most operations with the -rp and -fp flags.
If the projects that need this common library code are in their own views, you could also share the common project into a new subfolder within those other projects. You can use a relative path for this new subfolder that includes .. to move it outside the containing project's folder. This lets you use common code in many projects while allowing you to specify the location of that common code per project.
Shares come with some overhead, so be aware, but other than that it would probably work for what you're trying to do.

How do I stop Eclipse from refreshing some dir?

Every time I start Eclipse it tries to refresh an entire project, which translates to more than 10 minutes of wait time, not to mention the ridiculous amount of memory it would consume.
I know there's a global setting to turn off automatic refreshing (General -> Workspace -> Refresh automatically). Is there a way to turn that off on individual directories? The rationale is that some directories are seldom changed in some of my projects.
According to this thread, no:
no settings per projects (for disabling auto-refresh)
no settings per directory within one project.
For more recent versions of Eclipse, as detailed in Eclipse help page, you can use Resource filters (also initially mentioned below by pcoucke)
Resource filters can be created, edited and removed in the File > Properties > Resource > Resources Filters property page for a project or folder resource.
Resource filters only apply to files and/or folders that are implicitly included in the workspace by the refresh operation
An "Exclude" resource filter prevent all files and/or folders that match the filter condition to be included in the workspace during the refresh operation.
I mentioned an example in "How to have .git folders ignored by Eclipse projects"
For individual directories you can do it by adding Resource filters.
Right-click a project folder in Project Explorer tree and go to "Properties".
Resource -> Resource Filters.
Add as much exclusion filters for files/folders as you like.
See this answer: https://stackoverflow.com/a/6321688/1194584
If your problem is the refresh on startup, try: Preferences -> General -> Startup and Shutdown -> Refresh workspace on startup.
I found an effective hack that can in effect make Eclipse ignore a directory. See Eclipse - Ignore Entire Directories
To exclude entire projects, you could close them. Don't know a way for individual directories.
I'm sorry but I don't know anything about such a setting. As one already mentioned you could close the project within Eclipse (once it is open). This prevents the repetitive refreshing on that project. Otherwise I can just give you the suggestion to have 1 workspace per project and not include multiple different projects into the same workspace (unless they are related to each other). This is a much better practice and what I'm doing every day when working with Eclipse. And I didn't experience any problems so far of the type you mentioned.
I ran in to this same problem. When an eclipse project refreshes it seems to want to touch every file regardless of settings. The code base I'm working on has ~70K files, and took nearly 2 minutes to refresh. I eventually redefined the eclipse project to be a much smaller subset of that (~10K files) that has a ~ 1 second refresh. Not ideal, but the long refresh times are intolerable.
FYI the "Derived" check box and "Exclude from build..." options DON'T prevent a folder from being refreshed.
Note, the computer I'm using is 4-5 years old (Pentium IV processor, 7200 rpm hard drive). I bet one of these newer fast solid state hard drives would dramatically improve refresh times!
I found out a way to stop auto refreshing at eclipse startup.Below are the steps:-
Windows->Preferences->(Search Keyword:-Workspace)->General->Startup And ShutDown->Uncheck Referesh workspace on start up.
Done ...!!!
Work like charm for me.
Edit the file .project inside the folder .metadata.plugins\org.eclipse.jdt.core.org.eclipse.jdt.core.external.folders of your workspace folder.
Then remove any content between the linkedResources tags.
That worked for me (eclipse-jee-helios-SR2-win32)
You know what. Just close unused projects and that's was all for me.!