Eclipse build failure when project folder has ampersand in pathname - eclipse

I have a C/C++ project which has some normal and some linked/virtual folders and it has been building just fine. Now that I've put it into perforce over VPN (the path of which I cannot modify), there is an ampersand in the path of the project that causes eclipse to fail when it gets to building the files in the linked folders (it appears eclipse builds an entire pathname for linked folder's files from the environment variables and passes that to the gnu compiler). I don't know if Perforce allows aliasing of workspaces (to get rid of the ampersand) but I can't find one. I've tried alt root but that doesn't seem to do anything useful. I've found that using the DOS command prompt subst F:
C:\perforce\pathwithampersand will allow the project to build in eclipse but now I loose the ability to utilize the Perforce plugin features. Although I can still manually check files in/out using the P4 client, it would be very useful if the ampersand problem was taken care of by eclipse. I've searched and searched but can't find anything about eclipse having a problem (or solution) with ampersand in the folder path. I'm using eclipse platform 4.2.1 and CDT 8.1.1 but cannot update to any later version(s) than those because they are part of a tool suite a vendor controls. Perforce plugin is 2013.1/server is 2009.1.

Go to the P4 Client Connection->Edit Current Workspace
Expand the depot tree until you see your project. Right mouse click on it and choose Include Special.
Click Files radio button and click the Save button.
That will cause a path name to be displayed next to your project under Client Expression. Click to the right of this path which will cause it to become editable. Cursor over to the part that includes the ampersand and delete it. Click the OK button.
P4 will then (eventually) ask if you want to update files to the new location (or something like that). Choose update and it will take some time to create the new folder and move the files there. It is unclear whether you need to log out of P4 for it to be completely enforced so the best solution is to do so (Connection->Log Off). It might leave the old directory so you can delete it at will and it will not appear the next time you start P4.
Some users found this sequence did not work this way so they had to click the "View workspace mapping as text" button on the workspace edit dialog and delete the ampersand. Click apply.

Related

How to ignore other folders on Team checkin in Eclipse

Team Anywhere always scan other project folder
(Click the above link to see the screenshot)
I have an Android project under c:\AndroidDevelopment, with Team Anywhere installed so I can connect to TFS(visualstudio.com) and do source code control. However, whenever I try to check in a file, it takes a long time to come up with this check in window and I think the problem is, as you can see in the screenshot, it scans the whole world of C:\Projects. Why it scans C:\Projects folder? which has nothing to do with my android project under c:\AndroidDevelopment?
How to tell the Team Anywhere not to do that? (Or what causes TeamAnywhere to scan c:\projects folder?)
Thanks
If you are working in a local workspace, Eclipse can detect changes that you make outside the system.
If you make changes outside Eclipse to projects that are in your Eclipse workspace, refresh the Package Explorer or Project Explorer to see your changes. Changes will be detected automatically.
You can manage your workspace under Pending Changes--Actions to see whether you have mapped C:\Projects\ folder:
If items that you don’t need to check in are appearing regularly in the Promote Candidate Changes dialog box, you can select one of them, open its shortcut menu, and choose Ignore this local item to ignore the item.
You can also customize which files are ignored by version control. You can configure which kinds of files are ignored by placing text file called .tfignore in the folder where you want rules to apply. The effects of the .tfignore file are recursive. However, you can create .tfignore files in sub-folders to override the effects of a .tfignore file in a parent folder. More information, please check: https://msdn.microsoft.com/en-us/library/jj155786(v=vs.120).aspx

Eclipse Package Explorer Oddity

Recently whenever I open my workspace in Eclipse the Package Explorer has always defaulted to focusing on a single folder of all my projects/resource files. I've put up with this for a few months since I can just "Up to" to get back to the project level.
However, I'd like to get this sorted. Does anyone have any idea how I can stop Eclipse opening this specific folder as its default?
You've probably already found the solution by now, but I recently ran into the same problem and found a solution that seemed to work for me and thought I'd share.
Close Eclipse and open your workspace's workbench.xml file for edit:
gedit <yourEclipseWorkspaceDir>/.metadata/.plugins/org.eclipse.ui.workbench/workbench.xml
Search the doc for the name of the folder your Package Explorer keeps defaulting to. This should be the value of the path attribute in a line like this:
<input factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="<theOffendingFolder>" type="2"/>
Change the value of the path attribute to point to the desired folder, or delete that input line entirely if you want the Package Explorer to show you the default project level. Save the file and open Eclipse.
Maybe this is related to the files automatically opened when you start your workspace (because it was closed in that state) and the package explorer "Link with editor button". This button at the top right of package explorer view allows to synchronize the current visible file in the editor with the package explorer (personally I often use this feature but I know some of my colleagues hate it ;-)).
Hope this can help
Manu

Eclipse autocomplete not working in some Java files

I have noticed that autocomplete is not working in some of java files in Eclipse.
Also, the files where autocomplete is not working, display a hollow "J" as the icon for the Java file. The files where autocomplete is working, icon for java file is a filled "J"
I am wondering if someone can point out what went wrong all of suddent, why the change in icons and why autocomplete and syntax highlighting is turned-off in the files with a hollow "J" icon?
Thanks.
update
Basically, I was doing what VonC has suggested but Eclipse was not refreshing that it why I was thinking that VonC's suggestion isn't working, after doing a refresh, the problem resolved.
Since this question is highly ranked on Google, I will add a solution to fix general auto complete issue, not for 'hollow J' ones.
Try Window (Windows/Linux) or Eclipse (OS X) -> Preferences -> Java -> Editor -> Content Assist -> Restore Defaults
also
Content Assist -> Advanced -> Restore Defaults
some answers (restore defaults) above do not work for some adt bundle installs as of jan '13.
in those cases, go to
Window -> Preferences -> Java -> Editor -> Content Assist -> Advanced
and tick on the JAVA PROPOSAL options.
In this following picture, MyClass.java has a hollow J, because it is explicitly excluded from the sources to build:
Could you go to the properties of the project, "Java Build Path" Section, "Source" tab and see if some exclusion filter has been set ?
It is usual for instance to define:
**/Test*.java
to exclude at first building any unit-test class (when you have a large set of sources and do not want to be presented with Test classes during auto-completion, or do not want them considered during source searches).
Those with a hollow J aren't part of the build path of the project, so they can't participate in the normal build process and therefore auto-complete won't be enabled for these files (and other Java editor features!). You must add the folders with the Java files to be built to the build path using the 'source path' section of the project properties. This can be accessed by right clicking on a project in the project navigator / package explorer and going to Properties. See http://www.informit.com/articles/article.aspx?p=367962 for details.
Additionally, if the files aren't part of a Java project in the first place, you must create a project and move the files in, or put the files in an existing one. Again, make sure these file are under a source directory as described by that section of the project properties.
(source: teradata.com)
I cope with the issue by deleting the file if autocomplete does not work. Just before copying the source code. Then I have recreated the java file with the same name. Pasted the source code previously copied.
As an addendum to the #VonC answer, make sure that the Java files are part of the Inclusion pattern. I had a case where a build process was creating the project while only including .js files and not the Java files:
You can manually edit the inclusions via the Edit button. In my case, a fix was made to the build script to make it permanent.
Neither Restoring Defaults or my build path (file was already in package directory w/other files where auto-complete was working) fixed problem. Fix for me was to close the file explicitly (right click on file name in tab) and re-open. Interestingly, just re-starting Eclipse didn't work either.
Make sure you have the right directory structure. I believe that:
Hollow J icon beside Java file - will not be build
Normal J icon beside Java file - is a file to be build.
I made a mistake when I created webapp artefact. By default it does not create folder for Java, but for resources. I mistakenly put my sources there.
Have a look - see the difference.
I was able to get this fixed in Visual Studio Code, VSCode but entering crtl-shift-p and typing in clean. When I did that I ran the "Java: Clean Java Language Sever Workspace" command. This fixed my autocomplete issue for me.

ClearCase and Eclipse: How to hide/ignore files?

I'm working with Eclipse and ClearCase and we're facing the problem that there's no "ignore"-feature in ClearCase and we're having regularly checked-in files that shouldn't have been checked in.
In Eclipse, I already found the "Ignored Resources" configuration in Window -> Preferences -> Team and have been able to ignore files that follow a specific pattern that way.
But what do I do if I want to
keep a folder and all its contents from being checked in (such as a target-folder containing classes and such) or
keep a single specific file that can't be matched by a pattern in "Ignored Resources" from being checked in?
Update: We're using the provided Eclipse-plugin.
Within eclipse itself, the current ClearCase plugin cannot specify files to ignores, and they will always show up with a native ls -private command as private files.
Only a dedicated GUI (like CCRC -- ClearCase Remote Client -- used as Rich Client Platform based on eclipse) has a way to specify ignore files.
I'd say look at creating an entry in your configspec to exclude the target file/folder.
(I'm assuming you are using the Eclipse plugin)
When you create a new file or folder, it asks you whether or not you want to add the element(s) to source control. If you simply click cancel on the popup, then it will be ignored until you specifically add it. So, ClearCase, in effect, asks you whether or not this is an ignored file as soon as you create it. If the files are being checked in, blame the people who checked it in, not ClearCase.

Eclipse - Ignore Entire Directories

I use Aptana Studio (based on Eclipse). I'm trying to get Eclipse to completely ignore an entire directory inside a project. I mean COMPLETELY. I don't want it to display in the project folder. I don't want Eclipse to even be aware it exists.
Unfortunately, all my efforts to add it as a filter don't work. See http://forums.aptana.com/viewtopic.php?f=14&t=8340#p33714 . I think the filter only prevents the folder from being displayed in the project display. It doesn't keep Eclipse from actually looking at all the files in that folder for code assist, etc.
My problem is that directory has thousands of text files. So, each time Eclipse opens or refreshes this project, it analyzes all those files.
How can I prevent this?
Not sure about this aptana thing, but there is a convenient way to do it in native eclipse:
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.
If your project tree is not refreshed immediately, press F5 to enforce it.
Consider also the 'Derived' checkbox: right-click an entry in the package explorer, choose properties, check Derived. This may solve part of your problem.
See http://robmayhew.com/eclipse-ignore-folder/
If you have a linked resource (pointing off to some other file/folder on disk) with the same name in the same location in the resource tree, then the real folder on disk will be hidden from the resource model.
Unfortunately you can't create the linked resource if the real directory is already there in the project structure. You can try something like this:
On disk, rename/move the directory in question
Refresh the project, the directory is gone
Create a linked resource ( New -> File/Folder >> Advanced -> Link to file in the file system ). Name it the same as the original directory.
On disk, restore the original name of the directory
Refresh project.
Try right-clicking "Properties" and unchecking all permissions.