Java Code Examples for com.intellij.ide.scratch.ScratchFileService#isInScratchRoot()

The following examples show how to use com.intellij.ide.scratch.ScratchFileService#isInScratchRoot() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseIntentionAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * @return true, if element belongs to project content root or is located in scratch files
 */
public static boolean canModify(PsiElement element) {
  return element.getManager().isInProject(element) || ScratchFileService.isInScratchRoot(PsiUtilCore.getVirtualFile(element));
}
 
Example 2
Source File: MoveFilesOrDirectoriesHandler.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static boolean isValidTarget(PsiElement psiElement) {
  if (!(psiElement instanceof PsiDirectory || psiElement instanceof PsiDirectoryContainer)) return false;
  return psiElement.getManager().isInProject(psiElement) || ScratchFileService.isInScratchRoot(PsiUtilCore.getVirtualFile(psiElement));
}