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 ?

7 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

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

2

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

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

Please sign in to leave a comment.