How can I rename multiple files in Eclipse? - regex

I'd like to rename multiple files(/resources) in Eclipse.
Functionality by order of usefulness:
Rename files in search results (i.e. search for pattern, see which files match
Rename files using a regexp which runs on all filenames (e.g. s/stuff(.*)\.c/stuff\1.c.old/)
Rename files in the selection in the package explorer (F2 doesn't do this...)
How can I do this? Is there a relevant add-on maybe?

May be you can use Jalopy, unfortunately its not free. Am not sure how usefull it can be in your case.

Related

cmake project include dirs detection in vim editor [duplicate]

I have a cmake project. I want to do the following easily
search the declaration, definition and references of any variable, function, etc. under the cursor, which may be declared in an external header file whose path is added using INCLUDE_DIRECTORIES in CMakeLists.txt
rename a variable, function, etc. that is declared in the project
How can I set this up?
You can try to use vim plugin cmake4vim in order to integrate CMake to Vim.
This plugin helps to work with cmake targets and allows to generate compilation database file (compile_commands.json). A lot of plugins use this file for code completion, jump to definition and etc. (for example YCM)
Also you can use vim lsp plugins (for example vim-lsp) these plugins use language servers for code completion, refactoring and another good features.
But CMake project integration (cmake cache generation, project compilation, etc.) and search the declaration, definition and etc are different tasks. And different plugins and tools solve these tasks.
You can tell Vim where to look for includes by adding entries to the path option. I don't have enough experience with Cmake to know how to pull paths from CMakeLists.txt, though.
See :help 'path'.
Assuming a properly set path, it is possible to use the built-in :dsearch and related commands to search for definitions across includes.
The define option has a prescriptive name but it could be used to find any specific pattern so you could alter it to match declarations, too, or really anything.
See :help include-search and :help 'define'.
Vim has no built-in concept of "reference". :isearch and friends should work for that but they will probably be too noisy.
Renaming is usually done with something like:
:grep foo paths
:cwindow
:cdo s/foo/bar/gc
YouCompleteMe will help you. It uses compilation_database.json, witch can be generated by cmake.
This plugin also provides autocompetion for many languages.
I use functions in vim and assign them to a hotkey.
https://developer.ibm.com/tutorials/l-vim-script-2/
it gives you more an IDE feel. but at the end of the day you get a bit more control.

Python: select only folders in a directory

I am wondering about a good way to isolate just the folders in any given directory. Right now I have a folder with both, folders and random files in it and I want to isolate just the folders and ignore the files, whatever they may be called. Is there a quick way to do this in python?
Cheers
This may be a duplicate question. Please check out this link and see if it serves your purpose :
How to list only top level directories in Python?

Specify Multiple Directories in Notepad++ Find in Files

Notepad++'s "Find in Files" is amazingly helpful. But I want to specify a bunch of directories in which the search should take place.
Above you see me add the wildcards to the "Directory" field:
C:\*\vc90\*
However my version of Notepad++ doesn't seem to tolerate asterisks in the path.
I have about 30 Visual Studio Projects who's names I want to be grabbed by the first asterisks in the path, but I only want to modify files in the vc90 version of these projects (not vc80, vc100, etc.), and I don't want to have to go individually specify each of the directories.
Is there some other recourse for me?
PowerGREP
While it's not Notepad++, and it's not free, PowerGREP can do what you're looking for. You can download an evaluation version, which appears to still be working on my machine, months later.
I created a few mock files/folders and it seems to work as you expect. There are options to create backups, etc.
VSCode is free and supports wilcards for both files and paths in search/replace operations.

Cleaning up a VC++ 6 project

I'm working with a very old and large VC6++ project and it's all messed up. There are unused files and folders everywhere, copies of folders and it's just a mess to clean it up by hand in its current state.
It will be done eventually, but is there any simple way to check what files and folders are used when it does a clean compile?
The project settings doesnt help me at all because it simply uses copies of folders and additional include directories.
Any suggestions?
Well, if you want to parse the compiler output you can get which files are actually used. I also find this when googling around, you might want to try (I haven't tried it myself). My way would be to clean the build, list all source files, build, and for each source find its corresponding .obj. The ones without .obj are not used. Note that this only works for source files, unused header files stay undetected.
VC6 will produce a makefile for you:
http://msdn.microsoft.com/en-us/library/aa233950%28v=vs.60%29.aspx
You can use the generated makefile (and the associated .dep file) as a starting point and edit it down to the list of files that get used in a build.
This will let you see the header files that the project depends on in addition to the .c/.cpp/.lib files that might show in the build log. One thing to keep in mind is that you'll probably also want to make sure you track the .dsw and .dsp workspace and project files.
If you're a bit adventurous, you might be able to convince the makefile to actually copy the source files to some other location for you with an appropriate override of the certain macros and/or dependencies. But that would probably be more trouble than it's worth for a one-time effort.
Finally, there's a commercial product, CopyWiz by Kinook Software, that seems to have features that might do what you're looking for (and it supports VC++ 6). Note: I'm not sure if it will do what you want, but it may be worth a look.
Yes. Run Process Monitor from SysInternals. It can capture all file system events and filter them based on the path and other factors.
So, set the filter to the root of your source tree, only succesfull file reads (VC looks for headers in many places), and build your project. You'll probably still see several thousand events. So, save them to file, sort by path, and remove duplicate paths (headers especially will have many duplicate entries)

Should I add .vcxproj.filter files to source control?

While evaluating Visual Studio 2010 Beta 2, I see that in the converted directory, my vcproj files became vcxproj files. There are also vcxproj.filter files alongside each project which appear to contain a description of the folder structure (\Source Files, \Header Files, etc.).
Do you think these filter files should be kept per-user, or should they be shared across the whole dev group and checked into SCC?
My current thinking is to check them in, but I wonder if there are any reasons not to do that, or perhaps good reasons why I should definitely check them in.
The obvious benefit is that the folder structures will match if I'm looking at someone else's machine, but maybe they'd like to reorganize things logically?
We intentionally pulled the .filter. file information out of the .vcproj when we translated to the .vcxproj MSBuild format.
One reason is exactly what you pointed out, that the filters are purely a logical view, and different team members may want different views.
The other is that sometimes the build is set up to check the timestamp of the project file, and trigger a rebuild if it has changed - because that may mean there are different source files to build, or different settings, etc. I don't recall if we actually shipped with the build trigging that way, but the idea was that we did not want to trigger a rebuild simply because the filters changed, as they don't affect the build.
Previous versions of Visual Studio (at least versions 6.0 and 2008) store that information in their own project file (.dsp and .vcproj files respectively), which of course is good to add to SCC.
I cannot think of any reason to not include this .filter files in SCC
I just found that if you use Git you can mark .filter files to be treated as a union for merging to make it simpler. Just add the line:
*.vcxproj.filters merge=union
to your .gitattributes file.
See Using .gitattributes to avoid merge conflicts for more details.
It should not be added in case you use CMake (or similar build tools) to generate files like *.sln, *.vcxproj, *.vcxproj.filters etc., because this files may contain full path to your Project Folder and other only your computer's specific folders.