Can I make Eclipse change my comments when I rename my classes? - eclipse

I am using the refactor rename tool in Eclipse to change my class names, but can I make it change those names in my comments at the same time? I heard it was possible, but my Eclipse doesn't bring up the prompt to ask if I want references in my comments to be changed when I rename the class. Please let me know, thanks.

If you use "Refactor - Rename" from the package tree, an options dialog should appear. If you do it from the editor, press the little down arrow in the rename popup, and choose "Open Rename Dialog...".

Related

What is shourtcut for files in Netbeans

I realy dont know how to ask this one, so I will try to describe it.
I am pretty sure that there is a shortcut in NetBeans for files.
And when I want to get path to web/img/sample/fileWithStrangeName I dont want to type it and make some mistake.
What is shortcut in netbeans for that kind of navigation?
As you can see from the http://wiki.netbeans.org/Keyboard_Shortcuts there is no direct way to do this using a keyboard shortcut for any version until now.
What i do is right clicking on a file and then select properties. And then copy the value of the All Files property.
Another way is to use the plugin Explore from here, that opens the file in its location. And then copy the path from that window.

Show the name of the containing folder in the Eclipse tab of a file

I have the same set of files in N folders, one of them, say, blank.xhtml. The files contain somewhat similar information and it is becoming overwhelming to figure out which file comes from which folder every time I switch between the tabs. When I open one of them to edit and happen to open a file with the same name from another folder I get confused and more often than not end up editing the wrong file: nullifying my hard work. So I am wondering if there is a way to show the name of a containing folder in the tab like this G-06/blank.xhtml or G-07/blank.xhtml. I will be very very thankful to anybody who has pointers to how I can make this happen.
As an addition to the Maroun's answer there is an alternative solution.
It's not exactly what you want (full name in the tab's title), but may be useful sometimes.
In the "Project Explore" view (the same goes to "Navigator" view) click the "Link with Editor" button. That way, whenever you choose some file opened in the editor, it will be automatically selected/highlighted (see the picture) in the "Project Explorer" view.
Here is the picture:
Maybe this will be useful to you too.
If you hover the mouse over the tab containing the file name then a popup appears showing the full path. Not exactly what you wanted, but it should help. (This with Eclipse Neon.3 Release 4.6.3 on a Mac).
Not quite what you're looking for, but ctrl+shft+e will open the switch editor window that shows all the open editors with their filepaths. I use this shortcut for the same reason. I'll have multiple build.gradle files open from multiple projects and this helps pick the correct one

How can I copy and edit a file in Eclipse?

This seems so simple but I can't find a good way to do it:
Often I want to take an existing (Java) file and base a new one on it - basically just copy the file, rename the copy, and edit it. I can't find any good way to do this. The best I can do is to right-click on the file in the Package Explorer, select copy, and then paste it. If I do it in the same directory I'm prompted to change its name, which is cool.
The problems with this are: 1) It doesn't seem very "Eclipse-y", and 2) Usually I don't have the Package Explorer expanded to where the source file is, so it's very tedious to go through all the projects/packages and find it.
There must be a better way to do this, no? I expected something in the refactor menu but all there is is "move".
Alternative is there a simple way to show where a file I'm currently editing is in the Package Explorer? That wouldn't be ideal but would be good enough for me.
On the top right portion of the package explorer, there is a "link with editor" button that will automatically highlight which file you have open in the editor.
Select 'Show In - Package Explorer' in the context menu of your editor.

Searching within Xcode

I've had some problems with searching in Xcode, what is the best way to find and locate a method or class within a certain project?
command-shift-O will bring up the "open quickly" box, which searches textually and symbolically.
Press ⇧+⌘+O to open the 'Open Quickly...' dialogue window.
From there you can type any symbol name or filename to quickly zoom around your project.
Unfortunately, it doesn't do wildcard or partial searching (much to my frustration) so you need to know the name (or at least the beginning of the name) for it to be much use.
You can use it to open system symbols or headers too, eg, just type UITableView to view the header for it.
If you know the name of the method or class, a really easy way is to type it in whatever document you are in, then hold command and double-click the text. XCode will jump directly to the definition of whatever you double-clicked (even if it is not part of the project).
Project Find with the type of search set to definitions works well.
If you are trying to find the definition of a class from where it's being used, you can right click over the class name and select "Go to definition"
This will take you to where the class/function is defined
Alternatively there's "Find in project"
Pressing ⇧+⌘+F will open up Project Find. Type in what you want to find, and then in the drop-down next to it select "In Project" and press "find."
Voila! It should group the results by file for you.
Look on the left bar, you have a smart folder called "Project Symbols." When you click on it, it will display all the symbols (eg. classes, methods, properties) available in your project. You can even search in this folder by entering a term in the box in the upper right corner.

Eclipse: shortcut for "open project"?

Is there a shortcut in Eclipse for "open project"? Ideally, I'd like something like the "Open Resource" dialog.
I want this because I have a "testing" project, which I use whenever I want to try something out… But it's annoying to scroll through the massive Navigator trying to find it and click it when it gets closed.
Not by default. The action is defined here, with no keyboard shortcut.
http://eclipse-tools.sourceforge.net/Keyboard_shortcuts_(3.0).pdf
You could add a Working Set that contains only your test project, and use 'Select Working Set...' functionality from the Navigator tab's view menu:
While this won't open the project for you, it WILL make it the only thing you see in navigator or package explorer.
Once you've added it, it will be in a list and you won't need to open the 'Select Working Set...' dialog, just select 'my test project' from the popup menu. It's triggered by that small triangle in the upper right of Navigator, I'm not sure if there is a shortcut.
To switch back to your normal work, simply 'Deselect Working Set' and you will then see everything again.
I also find the 'Collapse All' button/shortcut to be handy when finding things in the Package Explorer or Navigator tabs.
I'll offer a solution to a problem I've had which, if I've interpreted the question correctly, is very similar to yours.
I find that when I have a lot of projects with loads of expanded directories/packages inside Project Explorer, trying to find a particular project is irritating because I have to scroll through all this. I could collapse all projects down but then I also lose my current position in every project.
I'd just like to be able to search for a particular project by name and open it, in the Project Explorer tree. Opening a file inside the project using Open Resource isn't a good enough workaround, as having to think of the name of a file inside that project completely out of context is often equally annoying!
A solution that works great (at least in Eclipse Juno, Mac OSX) is, with the Project Explorer focused, to hold Shift and start typing the project name. This dynamically selects the best matching project in the Explorer as you type. Then with your hands still on the keyboard you can use the arrow keys to open up and browse the project.
It ain't pretty but it gets the job done, and saves some valuable seconds :)
You could also:
switch workspace (in a workspace with only this test project in it) (no shortcut: you can define one)
install mylyn and select a "test" task (which would immediately empty your Navigator view, leaving only the relevant classes/methods).
If the test project is already opened and you know the name of the class in it, you could go to this class with Navigate -> Open Type (There is a shorcut also, on mac osx is Shift + Command + T)
I find it easier to move with this method, but I didn't know it until someone else showed me, maybe it helps.
You can set a shortcut at Preferences->General->Keys, search for Open Project. However, for me it does not work from the editor itself. I have to click the package explorer, for example. Also, if you have a lot of projects, there will be a huge list of them as well, as expected.