Have you ever viewed the contents of a file that you had no intention of modifying and then accidentally changed and saved? It can happen to anyone, especially when editing a large number of files. TKE has an elegant way to avoid having this happen to you with a feature called file locking.
Locking a file causes the associated edit buffer to switch to read-only mode. You can still select, copy text and search within the file; however, it is impossible to modify the contents of the buffer. Let’s take a quick look to see how to lock (and unlock) a file within TKE.
Locking a File
You can lock a file via the UI in two different ways:
- Click on the tab in the tab bar containing the file to lock and then click on the "File / Lock" menu option.
- Right click on the tab in the tab bar to display the contextual menu for the tab and select the "Locked" menu option.
Once the file is locked a lock icon will be displayed on the left side of the tab to indicate its status.
Unlocking a File
To unlock a file, perform the same procedure used for locking a file except that the "File / Unlock" menu option should be used. Once the file is unlocked, the lock icon will be removed from the tab to indicate the file can continue to be edited.
In a few special cases like viewing the application user license and viewing the base preferences file, TKE will open the file in "read-only" viewing mode. The lock icon will be displayed in the tab in the same manner as a locked file; however, you will not be able to change the lock status of read-only files (their menu options will be greyed out to indicate that they are not available with the current file).
Note that files with a read-only permission value are not automatically locked by TKE when they are opened. Users can make changes to the edit buffer of a read-only file. When the file is attempted to be saved, TKE will display an error message specifying that the save was not possible due to permission issues.
To see more information about the TKE code editor, visit http://tke.sourceforge.net