How to remove non-project files from refactorings in Idea? - intellij-idea

For some reason when I try to do a rename refactor, idea picks up code that is not even remotely close to my project. Furthermore, this code is read-only and I can't edit it! And Non-Project Access dialog is almost mockingly "ultimate" in its options: I can only choose whether I want to edit the non-project files this time or I want to do this ALWAYS. No option to skip these files altogether.
I tried to add these folders as a content root and exclude them - it didn't help. And I can't remove them, since they actually don't show up as files in the refactor preview (they are not referenced anywhere in the project view either), only {m} functions/method do with no option to remove them.
So the refactor rightfully fails because it can't edit RO files. So how would I solve this?

Related

VB.Net remove lock attribute from files in directory

I am making a little program and I need to be able to remove the Lock attribute from all files (no matter the extension of those files) in the specified directory. I haven't find any way to do so on the web so far, so I really have no idea how to start a basic code for that job, so all I can really do is give you the elements of my Windows Form:
txtDirectory: This is where the directory is being
displayed/selected. All files in the displayed directory needs to be
getting the Lock attribute from them - see btnConfirm to know more.
btnSelectDirectory: This button opens the directory seletion
dialog. This section does not need any code - but feel free to add
code if you think it could improve my program.
btnConfirm: This
button is where, when clicked, all files in the specified directory
will be removed from the Lock attribute. This is what I really
need help with.
How can I do so?

IntelliJ "File..." action is showing directories when I want it to just show files

I could swear that this wasn't the behavior on an older version. Is there any way to make it so the File... action only displays actual files, and not directories? It's incredibly frustrating to have to always be suggested a directory first instead of a file, since (in my opinion) jumping to a directory is totally useless - all it does is scroll you in the folder/projects view to that directory..
Edit: IntelliJ version is: IntelliJ IDEA 2017.3.2, Build #IU-173.4127.27.
As explained in comments on the Youtrack issue I opened, this is now intended behavior due to the directory being a better match than the file (case sensitivity).
This is resolved for me with these possible solutions:
Use Navigate > Class instead, as suggested by glytching. Works well for most purposes since it handles many languages just fine.
Type a . to ignore directories. This, for me, is easier to incorporate into muscle memory than hitting Shift to capitalize or hitting Up/Down to scroll around the list of suggestions.

MvcBuildViews and locating views

I have enabled MvcBuildViews task in my project file and I have found it finds and tries to build views that aren't in the project.
These views were totally out of date but not knowing whether to delete them or not from source I opted to relocate them (until I can find out) to a new folder called 'Obsolete'.
After relocating the view I try and build the project and it still somehow finds these views in the 'Obsolete' folder now.
How can I instruct the MvcBuildViews task to only compile views found in their usual search location and not everywhere in the project directory?
So after doing some more hunting I find that the MvcBuildViews uses the aspnet_compiler.exe under the hood. It appears the only solution if I want to hand pick the locations is to point it at the specific folders themselves. My other option is to move the views outside of the project.
http://msdn.microsoft.com/en-US/library/ms229863(v=vs.100).aspx

How to see a list of new non-version controlled files in IntelliJ

So I add new files to my project. At this point IntelliJ pops up a dialog asking me if I'd like to add these files to git/mercurial/svn etc.
I will always say No at this point because until I've fleshed the files out a little, perhaps got them to work with some context, perhaps decided to rename them, I'm not happy to add these new files to version control. Even if I can still rollback the 'add', I have to bare in mind the nuts and bolts of the underlying system. It's safer simply not to do it.
Now I'm ready to commit, I bring up the commit dialog box and the new files are nowhere to be found! If I go on a scouting expedition for them, I can add them individually from project files but this is error-prone.
How do I automatically get a list of all my new files which I previously delayed adding?
I found it, under the changes tab. I was looking for it only under the version control context menu from project files.

Why does dragging an objective-C header or code file from one folder to another make it turn red in Xcode 4.6?

I have an Xcode 4 objective-C project which contains about 150 .m and .h files in it.
The code underlying the project does not always correspond in underlying disk structure to the folders shown in the Xcode project. I get that part.
What I don't get is why Xcode won't tell me anything about why I can create new project groups and move items to them, with no problems, but certain existing project folders will cause the project to become broken, and the code will no longer build once I move certain .m files or .h files into a different group. When its broken it just shows the file in red. This is frustrating and confusing.
In the screenshot below, the left side of image before shows state before, when all is good, right side shows red (missing) file after moving into a group. Given that groups don't represent a folder on disk, I would not expect moving from one group to another to break things. Sometimes it does, and sometimes it does not. This particular XCode issue upsets me a lot.
In the good old days of Friendly Mac User-Interfaces, you could hit ⌘+I and get some information about the properties of objects, or right click and get to the properties of something via its context menu. Groups (folder icons) in XCode projects have no properties item in their context (right click menu) and yet these groups all clearly NOT all alike. What's up with these identical looking groups?
Secondly, how does a person learn how to reorganize both the on-disk-folder-organization and the visual group organization, in a way that does not leave you bloodied and beaten? (XCode 4 is the most difficult IDE version I have ever used, for this, I'm sure I've missed some important documentation on dealing with folders and files and so on.)
Update: The File Inspector (Identity Inspector in Utilities menu) is the key to this mystery, but exactly how a new user is to discover this (other than by painful experience) is still unknown to me. I also don't really understand what all this is about, with various choices available in the Path drop-down, and the blank or non blank value that has no description or help, just a cryptic icon and either a name of some real on-disk-folder or else a gray text field saying None:
This sort of thing doesn't just happen out of the blue. In this case, what has happened is that a user has opened an .xcodeproj and is unaware of the difference between the various relative or absolute Path options that a Group can be a part of. A Group in XCode is always shown with exactly the same manilla color folder-icon inside your XCode project, no matter what modes or properties it has defined inside of it.
By default the simplest case is that you create a new folder Group object in XCode and it's purely a cosmetic organizational tool that has no disk location information stored in it.
This is not the ONLY thing that these groups do, and not the only "mode" that these groups can be used in. These groups can also be used to point at some folder and say "things that are in this virtual folder are really somewhere else, either underneath this project's main folder in a subdirectory, or even up somewhere else on your hard-drive, either stored in relative path, or absolute path format". When used like this, these things remind me of a Windows "Shortcut" object on the desktop, or a Mac "Alias" object in the finder.
Dragging a file from one group to another does not move it to a different folder on the disk. It simply moves a reference to a file with a certain name, to another group, which might mean that after you drag a file, you haven't really moved it, or copied, or relocated it in any way, you've just moved an alias from a place where it could resolve properly to a real file, to a place where it can't. Thus XCode helpfully turns it red for you, without any helpful error message about what happened.
How do you fix it? In this case, go to the Identity inspector pane in the Utilities menu, and either decide to clear out the bogus value in the place where I have shown in the picture in the original question where I had "Classes". Clearing out a value that is invalid is not exactly easy to do because XCode requires that you basically find the root folder of your project and select that, and that will 'clear" the relative or absolute path property on your folder-group.
Alternatively, you can leave the folder alone, and just don't drag files from group A to group B without first checking what relative or absolute path they reference.
What still seems horrible to me is that XCode tutorials tell you to "use XCode to manage your project's contents, don't just drag files around in the finder inside an XCode project directory", and that's good advice, but it leads me to assume that XCode provides full and intuitive physical (and virtual) group-folder organization tools. It does not. As an example, imagine you inherit a project that has .m and .h files scattered through four physical folders underneath the main XCode project folder and you want to move those files around. You have to do a combination of tricky things inside XCode, and either in Terminal or in the Finder, in order to reorganize your folder. With the complications involved in moving items around in your version control tool of choice added upon the top of that, and XCode's very limited support for only Git and Subversion, you have a really tricky mess.