com.intellij.openapi.vfs.ReadonlyStatusHandler



API Populatity

2 Client projects

Project: com.intellij

Project JetBrains/intellij-community in file ...Inspection.actions.UnimplementInterfaceAction.java (2007-02-07)
@@ -3,6 +3,7 @@ package com.intellij.codeInspection.actions;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.openapi.editor.Editor;
 import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.ReadonlyStatusHandler;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiTreeUtil;
 import com.intellij.util.IncorrectOperationException;
@@ -62,6 +63,9 @@ public class UnimplementInterfaceAction implements IntentionAction {
     final PsiElement target = psiReference.resolve();
     if (target == null || !(target instanceof PsiClass)) return;
 
+    if (ReadonlyStatusHandler.getInstance(project)
+      .ensureFilesWritable(file.getVirtualFile()).hasReadonlyFiles()) return;
+
     PsiClass targetClass = (PsiClass)target;
 
     psiReference.getElement().delete();
Project JetBrains/intellij-community in file ...ij.codeInsight.ExternalAnnotationsManagerImpl.java (2007-06-29)
@@ -23,6 +23,7 @@ import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.util.Comparing;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.ReadonlyStatusHandler;
 import com.intellij.psi.*;
 import com.intellij.psi.util.PsiFormatUtil;
 import com.intellij.psi.xml.XmlDocument;
@@ -88,7 +89,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
     final PsiManager psiManager = listOwner.getManager();
     XmlFile xmlFile = findExternalAnnotationsFile(listOwner);
     if (xmlFile != null) {
-      if (!CodeInsightUtil.prepareFileForWrite(xmlFile)) return;
+      if (ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(xmlFile.getVirtualFile()).hasReadonlyFiles()) return;
       annotateExternally(listOwner, annotationFQName, xmlFile);
     }
     else {
Project JetBrains/intellij-community in file ...napi.vcs.readOnlyHandler.ReadOnlyStatusDialog.java (2012-01-10)
@@ -1,6 +1,7 @@
 
 package com.intellij.openapi.vcs.readOnlyHandler;
 
+import com.intellij.openapi.vfs.ReadonlyStatusHandler;
 import com.intellij.util.ui.OptionsDialog;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.registry.Registry;
@@ -65,12 +66,12 @@ public class ReadOnlyStatusDialog extends OptionsDialog {
   }
 
   protected boolean isToBeShown() {
-    return ((ReadonlyStatusHandlerImpl)ReadonlyStatusHandlerImpl.getInstance(myProject)).getState().SHOW_DIALOG;
+    return ((ReadonlyStatusHandlerImpl)ReadonlyStatusHandler.getInstance(myProject)).getState().SHOW_DIALOG;
   }
 
   protected void setToBeShown(boolean value, boolean onOk) {
     if (onOk) {
-      ((ReadonlyStatusHandlerImpl)ReadonlyStatusHandlerImpl.getInstance(myProject)).getState().SHOW_DIALOG = value;
+      ((ReadonlyStatusHandlerImpl)ReadonlyStatusHandler.getInstance(myProject)).getState().SHOW_DIALOG = value;
     }
   }