How to reprotect file that doesn't belong to the project ?

When editing a file that doesn't belong to the project, I can edit it anyway.

How to put back this file protected ?

2
15 comments

External files opened explicitly via File | Open are always writeable (see the discussion in https://youtrack.jetbrains.com/issue/IDEA-125379);

You can set up your external files as javascript libraries - library files are write-protected

0
Avatar
Permanently deleted user

THank you for your answer.

My question was not so clear. I will rephrase it.

When I click on a method that is not part of the project, the file is opening.
If I try to edit this file, a pop-up appears "Non-Project files Protection".

If I select "I want to edit this file anyway", I don't know how to put back the protection on that file. 

0

Ah, I see:) Close the project, open file .idea/workspace.xml, find the

<component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">

component there, remove your file from the list

3
Avatar
Permanently deleted user

Hello! :)

I have similar prolbem: once I choose some thing like "edit anyway" in "Non-Project files Protection"  dialog, and now I can edit non-project files even after restart IDE/restart computer/reinstall IDEA/deleting IDE settings folder/deleting .idea project folder. It doesn't matter how to open such non-project files: by click/cmd+shift+O/go to definition.

I have no idea how to reenable non-project file protection.

 

IntelliJ IDEA 2016.3
Build #IU-163.7743.44, built on November 18, 2016
Licensed to Yandex LLC

JRE: 1.8.0_112-release-408-b2 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

0
Avatar
Permanently deleted user

I see changed files in CHANGED_PATHS, can remove them. But them or other still can be modified without "non-project file protection" dialog,  even after IDE restart (

0
Avatar
Permanently deleted user

After all years, this still is a problem in 2019.1.2 Pro version

1

I'm on PyCharm 2019.2.3 and I have this problem, but CHANGED_PATHS is nowhere in my workspace.xml or any other file in my .idea directory.

0

Please open <IDE config dir>/workspace folder, locate the .xml file that corresponds to your project and search it for "CHANGED_PATHS"

1

Thanks for clarifying that Elena. I was looking in my projects .idea directory as per previous comments.

0

The settings layout has changed recently, some information that used to be stored in `.idea/workspace.xml`, like the windows size and positions, etc. is now stored globally in IDE configuration directory

0

Elena Pogorelova could you let me know where this file is located on MacOS?

0

@Will sorry, could you clarify what file you have in mind?

0
# backup the xml before do this
xmlstarlet ed --delete '/project/component[@name="IdeDocumentHistory"]/changedPaths' ~/Library/Application\ Support/JetBrains/<product><version>/workspace/{{ProjectId}}.xml

# ProjectId can found in:
project/.idea/workspace.xml
1

Please sign in to leave a comment.