当前位置: 首页>>代码示例>>Java>>正文


Java ReadonlyStatusHandler.getInstance方法代码示例

本文整理汇总了Java中com.intellij.openapi.vfs.ReadonlyStatusHandler.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ReadonlyStatusHandler.getInstance方法的具体用法?Java ReadonlyStatusHandler.getInstance怎么用?Java ReadonlyStatusHandler.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.vfs.ReadonlyStatusHandler的用法示例。


在下文中一共展示了ReadonlyStatusHandler.getInstance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isQuickFixOnReadOnlyFile

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
private static boolean isQuickFixOnReadOnlyFile(PsiElement problemElement) {
  final PsiFile containingPsiFile = problemElement.getContainingFile();
  if (containingPsiFile == null) {
    return false;
  }
  final VirtualFile virtualFile = containingPsiFile.getVirtualFile();
 
  final Project project = problemElement.getProject();
  final ReadonlyStatusHandler handler = ReadonlyStatusHandler.getInstance(project);
    final ReadonlyStatusHandler.OperationStatus status;
    if (virtualFile != null) {
        status = handler.ensureFilesWritable(virtualFile);
        return status.hasReadonlyFiles();
    }

    return false;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:18,代码来源:LuaFix.java

示例2: applyFix

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
  // can happen during batch-inspection if resolution has already been applied
  // to plugin.xml or java class
  if (!myElement.isValid()) return;

  final boolean external = descriptor.getPsiElement().getContainingFile() != myElement.getContainingFile();
  if (external) {
    final PsiClass clazz = PsiTreeUtil.getParentOfType(myElement, PsiClass.class, false);
    final ReadonlyStatusHandler readonlyStatusHandler = ReadonlyStatusHandler.getInstance(project);
    final VirtualFile[] files = new VirtualFile[]{myElement.getContainingFile().getVirtualFile()};
    final ReadonlyStatusHandler.OperationStatus status = readonlyStatusHandler.ensureFilesWritable(files);

    if (status.hasReadonlyFiles()) {
      final String className = clazz != null ? clazz.getQualifiedName() : myElement.getContainingFile().getName();

      Messages.showMessageDialog(project,
              DevKitBundle.message("inspections.registration.problems.quickfix.read-only",
                      className),
              getName(),
              Messages.getErrorIcon());
      return;
    }
  }

  try {
    doFix(project, descriptor, external);
  }
  catch (IncorrectOperationException e) {
    Logger.getInstance("#" + getClass().getName()).error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:BaseFix.java

示例3: isQuickFixOnReadOnlyFile

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
protected static boolean isQuickFixOnReadOnlyFile(PsiElement problemElement) {
  final PsiFile containingPsiFile = problemElement.getContainingFile();
  if (containingPsiFile == null) {
    return false;
  }
  final VirtualFile virtualFile = containingPsiFile.getVirtualFile();
  if (virtualFile == null) {
    return false;
  }
  final Project project = problemElement.getProject();
  final ReadonlyStatusHandler handler = ReadonlyStatusHandler.getInstance(project);
  final ReadonlyStatusHandler.OperationStatus status = handler.ensureFilesWritable(virtualFile);
  return status.hasReadonlyFiles();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:TitleCapitalizationInspection.java

示例4: isFileReadOnly

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
protected static boolean isFileReadOnly( @NotNull Project project, @NotNull PsiFile file )
{
    VirtualFile virtualFile = file.getVirtualFile();
    ReadonlyStatusHandler readonlyStatusHandler = ReadonlyStatusHandler.getInstance( project );
    ReadonlyStatusHandler.OperationStatus operationStatus =
        readonlyStatusHandler.ensureFilesWritable( virtualFile );
    return operationStatus.hasReadonlyFiles();
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:9,代码来源:AbstractIntention.java

示例5: isQuickFixOnReadOnlyFile

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
protected static boolean isQuickFixOnReadOnlyFile(PsiElement problemElement) {
  final PsiFile containingPsiFile = problemElement.getContainingFile();
  if (containingPsiFile == null) {
    return false;
  }
  final VirtualFile virtualFile = containingPsiFile.getVirtualFile();
  final JavaPsiFacade facade = JavaPsiFacade.getInstance(problemElement.getProject());
  final Project project = facade.getProject();
  final ReadonlyStatusHandler handler = ReadonlyStatusHandler.getInstance(project);
  final ReadonlyStatusHandler.OperationStatus status = handler.ensureFilesWritable(virtualFile);
  return status.hasReadonlyFiles();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:GroovyFix.java

示例6: isQuickFixOnReadOnlyFile

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
private static boolean isQuickFixOnReadOnlyFile(PsiElement problemElement) {
    final PsiFile containingPsiFile = problemElement.getContainingFile();
    if (containingPsiFile == null) {
      return false;
    }
    final VirtualFile virtualFile = containingPsiFile.getVirtualFile();
    final Project project = problemElement.getProject();
    final ReadonlyStatusHandler handler = ReadonlyStatusHandler.getInstance(project);
    final ReadonlyStatusHandler.OperationStatus status = handler.ensureFilesWritable(virtualFile);
    return status.hasReadonlyFiles();
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:12,代码来源:InspectionJSFix.java

示例7: isQuickFixOnReadOnlyFile

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
protected boolean isQuickFixOnReadOnlyFile(PsiElement problemElement) {
  final PsiFile containingPsiFile = problemElement.getContainingFile();
  if (containingPsiFile == null) {
    return false;
  }
  final VirtualFile virtualFile = containingPsiFile.getVirtualFile();
  final Project project = problemElement.getProject();
  final ReadonlyStatusHandler handler =
    ReadonlyStatusHandler.getInstance(project);
  final ReadonlyStatusHandler.OperationStatus status =
    handler.ensureFilesWritable(virtualFile);
  return status.hasReadonlyFiles();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:InspectionGadgetsFix.java

示例8: isWritable

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
private static boolean isWritable(Project project, PsiElement element) {
  final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(element);
  if (virtualFile == null) {
    return true;
  }
  final ReadonlyStatusHandler readonlyStatusHandler = ReadonlyStatusHandler.getInstance(project);
  final ReadonlyStatusHandler.OperationStatus operationStatus = readonlyStatusHandler.ensureFilesWritable(virtualFile);
  return !operationStatus.hasReadonlyFiles();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:Intention.java

示例9: ensureFileWritable

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
public static boolean ensureFileWritable(Project project, PsiFile file) {
  final VirtualFile virtualFile = file.getVirtualFile();
  final ReadonlyStatusHandler readonlyStatusHandler = ReadonlyStatusHandler.getInstance(project);
  final ReadonlyStatusHandler.OperationStatus operationStatus = readonlyStatusHandler.ensureFilesWritable(virtualFile);
  return !operationStatus.hasReadonlyFiles();
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:7,代码来源:QuickfixUtil.java

示例10: getOptions

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<BooleanOptionDescription> getOptions(@Nullable Project project) {
  if (project == null || ProjectLevelVcsManager.getInstance(project).getAllVcss().length == 0) {
    return Collections.emptyList();
  }
  VcsConfiguration vcs = VcsConfiguration.getInstance(project);
  if (vcs == null) {
    return Collections.emptyList();
  }
  ArrayList<BooleanOptionDescription> options = new ArrayList<BooleanOptionDescription>();

  String id = "project.propVCSSupport.Mappings"; // process Version Control settings
  options.add(option(vcs, id, "Limit history by " + vcs.MAXIMUM_HISTORY_ROWS + " rows", "LIMIT_HISTORY"));
  options.add(option(vcs, id, "Show directories with changed descendants", "SHOW_DIRTY_RECURSIVELY"));
  options.add(option(vcs, id, "Store on shelf base revision texts for files under DVCS", "INCLUDE_TEXT_INTO_SHELF"));
  VcsContentAnnotationSettings vcsCA = VcsContentAnnotationSettings.getInstance(project);
  if (vcsCA != null) {
    options.add(option(vcsCA, id, "Show changed in last " + vcsCA.getLimitDays() + " days", "isShow", "setShow"));
  }
  options.add(option(vcs, id, "Notify about VCS root errors", "SHOW_VCS_ERROR_NOTIFICATIONS"));
  options.add(option(vcs, id, "Commit message right margin " + vcs.COMMIT_MESSAGE_MARGIN_SIZE + " columns", "USE_COMMIT_MESSAGE_MARGIN"));
  options.add(option(vcs, id, ApplicationBundle.message("checkbox.wrap.typing.on.right.margin"), "WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN"));

  id = "project.propVCSSupport.Confirmation"; // process Version Control / Confirmation settings
  ReadonlyStatusHandler vcsROSH = ReadonlyStatusHandler.getInstance(project);
  if (vcsROSH instanceof ReadonlyStatusHandlerImpl) {
    options.add(option(((ReadonlyStatusHandlerImpl)vcsROSH).getState(), id, "Show \"Clear Read-only Status\" Dialog", "SHOW_DIALOG"));
  }
  options.add(option(vcs, id, "Confirmation: Suggest to move uncommitted changes to another changelist", "OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT"));
  options.add(option(vcs, id, "Confirmation: Force non-empty checkin comments", "FORCE_NON_EMPTY_COMMENT"));
  options.add(option(vcs, id, "Confirmation: Clear initial commit message", "CLEAR_INITIAL_COMMIT_MESSAGE"));

  id = "project.propVCSSupport.Background"; // process Version Control / Background settings
  options.add(option(vcs, id, "Perform in background: update from VCS", "PERFORM_UPDATE_IN_BACKGROUND"));
  options.add(option(vcs, id, "Perform in background: commit to VCS", "PERFORM_COMMIT_IN_BACKGROUND"));
  options.add(option(vcs, id, "Perform in background: checkout from VCS", "PERFORM_CHECKOUT_IN_BACKGROUND"));
  options.add(option(vcs, id, "Perform in background: Edit/Checkout", "PERFORM_EDIT_IN_BACKGROUND"));
  options.add(option(vcs, id, "Perform in background: Add/Remove", "PERFORM_ADD_REMOVE_IN_BACKGROUND"));
  options.add(option(vcs, id, "Perform in background: revert", "PERFORM_ROLLBACK_IN_BACKGROUND"));

  if (!project.isDefault()) {
    // process Version Control / Changelist Conflicts settings
    options.add(tracker(project, "Changelists: Enable changelist conflict tracking", "TRACKING_ENABLED"));
    options.add(tracker(project, "Changelists: Show conflict resolving dialog", "SHOW_DIALOG"));
    options.add(tracker(project, "Changelists: Highlight files with conflicts", "HIGHLIGHT_CONFLICTS"));
    options.add(tracker(project, "Changelists: Highlight files from non-active changelists", "HIGHLIGHT_NON_ACTIVE_CHANGELIST"));
  }
  return Collections.unmodifiableCollection(options);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:VcsOptionsTopHitProvider.java

示例11: getReadOnlyStatusHandler

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
private ReadonlyStatusHandlerImpl getReadOnlyStatusHandler() {
  return ((ReadonlyStatusHandlerImpl)ReadonlyStatusHandler.getInstance(myProject));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:VcsGeneralConfigurationPanel.java

示例12: isFileReadOnly

import com.intellij.openapi.vfs.ReadonlyStatusHandler; //导入方法依赖的package包/类
public static boolean isFileReadOnly(Project project, PsiFile file) {
    final ReadonlyStatusHandler instance     = ReadonlyStatusHandler.getInstance(project);
    final VirtualFile virtualFile = file.getVirtualFile();

    return virtualFile != null && instance.ensureFilesWritable(virtualFile).hasReadonlyFiles();
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:7,代码来源:JSElementFactory.java


注:本文中的com.intellij.openapi.vfs.ReadonlyStatusHandler.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。