XCode 4: Removing top-level folder - xcode4

I accidentally added a folder to the top-level of the workspace as it is displayed in XCode 4. That is, the folder now sits right along side my project at the top-level, and I'd like to remove it but I don't see how. The delete option is disabled when I try. I read somewhere that after creating a workspace that such a folder is possible to delete. I'd like to try to avoid this for the time being.
Is the meta-data for this folder stored in the project.pbxproj file? I need to check in the changes I've made to project.pbxproj file but not the meta-data for the top-level folder I'm trying to remove.
Thanks.

I also had this issue. To fix it I manually removed the section relating to my unwanted group from the project.xcworkspace file in my .xcodeproj package:
In Finder, right click on your .xcodeproj package and click Show Package Contents.
Open the project.xcworkspace file in your favourite text editor.
Completely remove the xml element named 'Group' for the group you want to remove. I had to remove the following (my group was called New Group):
<Group location = "container:" name = "New Group"> </Group>

Maybe it is Xcode specific (mine is 6) but in my case it was required to make one more step in addition to Stefan's answer:
Right click on .xcodeproj in Finder -> Show Package Contents.
The same for project.xcworkspace inside: right click -> Show Package Contents.
After that open contents.xcworkspacedata with text editor (default TextEdit is ok)
Remove the tag:
<Group location = "container:" name = "New Group"> ... </Group>

Related

Getting GPS to display my package subfolders

My GPS does not display the subfolders under "src" although they exist and are non empty. When I try to create a new subfolder from within GPS, it gets created but does not show under "src". I am using (community) GPS version 20180523 on Windows 10.
I have tried the following.
(1) I fiddled around with the folder display options in the top right corner of the project tab with no success.
(2) I aggressively hit the refresh button.
(3) I created the subfolders I want in Windows explorer.
How can I get my folder-organised code to show correctly in GPS?
Thanks.
In your project properties GUI, go under Sources->Directories and check the "Include Subdirectories" checkbox. To add it manually to your GPR file, open it and add "/**" to the end of your Source_Dirs option:
for Source_Dirs use ("src/**");

Customize Applescript app icon

I have created my AppleScript, tested it, saved it as an .app and it works.
Now, how do I set a custom icon for it?
I have done a bit of googling and tried a few different things but cannot get it to work. The app is mainly for me and maybe some people I know to make workflows easier so having a nice little icon makes a huge difference.
Can anyone help with this please?
Basically you need an .icns icon file.
Open your application with right-click > Show Package Contents
Navigate to Contents > Resources
Delete applet.icns
Drag the custom icon file into the Resources folder
Rename the icon file in Resources to applet.icns
To update the icon appearance open and re-save the applet in Script Editor.
This is how I do it:
In Finder, select your icon file.
Get Info (CMD-I) on the file.
Click the icon in the top left corner of the Get Info window.
Copy it via CMD-C.
Now Get Info on your AppleScript file.
Click the icon in the top left corner of the Get Info window.
Paste the icon using CMD-V.
The AppleScript icon should be replaced by the icon copied from the icon file.
A screen recording demonstrating this process can be viewed at this answer from AskDifferent.
Just building into #pipwerks answers: You can also use Drag&Drop!
(Optional) Create your icon online from any image on https://iconverticons.com/online/ and download de .icns file for your icon.
Get Info (CMD-I) on you AppleScript file.
Now Drag&Drop your .icns file into the small icon in the top left corner.
It works and now it's ready to add it to the dock or wherever you want.
On newer systems if the above methods do not work there is another solution.
In Script Editor, after opening our script (.app), choose View -> Show Bundle Contents from the menu (or press cmd +0).
In the panel that will expand on the right (Bundle Info) in the Resources section, right-click the applet.icns file and select delete from the drop-down menu.
Our new icon file with the same name applet.icns drag and drop into the window Resources where you just deleted it.
Save application and voila :-D
Here's another way on newer systems, I'm using macOS 12.1.
Open the new icon image file in Preview and choose File > Export...
Hold down the Option key while selecting "Format" and see a whole bunch of new choices including ICNS.
Save it, drop it in your Resources folder, and you're good to go.

Sublime Text 3 side bar is not updating or refreshing

For some reason the side bar on Sublime Text 3 is just displaying the folder named Template. The strange thing is that this folder is already deleted and regardless of that, the folder Template should not be displayed when I open Sublime in for example my Dropbox folder. No matter where in Ubuntu I open Sublime (from command line or Dash) it will open with that folder named Template in the sidebar. Template will have the arrow next to it indicating I can expand its contents or hide them. When I press it I see the arrow go from the right to to down position no folder contents show, nothing happens.
Also nothing happens when I go Project > Refresh Folders.
This problem happened around the time I was trying to add a new server using SFTP. Not certain if that had anything to do with it.
Any ideas whats happening here?
If it is a top level folder, you need to edit the project itself. You may right click on the folder in the side bar, and select "Remove from Project". Alternatively, you can edit the file itself by going to Project -> Edit Project. The top level folders are defined as a list of objects. Remove the entry you want from there, and it will no longer appear in the sidebar. You can write a plugin to clean up a project for you if you find yourself removing items frequently.

How to highlight opened file in XCode 4 on the "Project Navigator" panel?

Since a project can have hundreds of files inside dozens of directories (filters) shown on the "Project Navigator" panel, sometimes it's getting difficult to seek the file which is currently opened in the Editor (for example, when I jump from file to file via "CMD + clicking", etc).
Is there a way to automatically select currently opened file on the "Project Navigator" panel? I.e., automatically expand the directories (filters) and select the file there as I would have clicked on it? Maybe there's a shortcut or something?
Thanks.
The keyboard shortcut is ⌘-shift-J
Right-click the file in the editor and choose Reveal in Project Navigator.
Another option is to Right click anywhere within the Editor pane (with the source code) -> Navigate -> Reveal in Project Navigator.

Can't Rename Files In Xcode 4 Anymore?

Seriously, in previous versions of XCode I could right-click a file or group in XCode and I would get the "rename" option. In XCode 4 I can't seem to rename my files in XCode directly anymore. What happened? Why would Apple remove such a feature? How can I rename my nibs, image resources, and others in XCode now?
Note that if you're renaming a class, the best way I've found to do this is to open the class header, select the name of the class then control-click and choose Refactor / Rename. That way Xcode will rename the .h and .m files and replace instances of your class name (almost) everywhere it appears, including XIB files. Nifty!
Edit: in Xcode 4.2, watch out for this gotcha: "When initiating a refactoring rename operation from the declaration of a property, any Interface Builder files that refer to that property will not be updated correctly. Instead, perform the rename operation on a usage of the property, or an associated #synthesize statement."
The contextual menu item was removed, but you can still rename from within. Select the file and then click again in the name and you should get the editor field. Type away to rename. It can be a little temperamental though. The biggest problem I usually have is doing the 2nd click too quickly and it being registered as a double click. So you might need to play around with your timing a little bit to get used to it.
If you want the CM item back, make sure to file a bug report on it.
Select the file in the navigation window and press Enter.
Just the way renaming in Finder.
In case you want to change the path in case you moved some files...
Step 1: View -> Utilities -> File Inspector to open the file inspector
Step 2: Under Identity -> Path there is a white icon to change the relative path of the file
Furthermore, to rename the file, just refactor as stated above ;)
another way you can do it, is by using the little rectangle with an arrow in it which is at the bottom of the bar. Click on it, your items will be displayed in a list like view, you can rename it there the way you would rename files or whatever... Hope that helps
If you want to rename non-class files like png files just select file and choose 'Show File Inspector' from right click, then change file name from 'name' textfield (identify and type label).
I you want change class name, I recommend 'Simon Whitaker' Refactor method (second comment).

Resources