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


Java PsiDirectory.getName方法代码示例

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


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

示例1: rename

import com.intellij.psi.PsiDirectory; //导入方法依赖的package包/类
@Override
protected void rename(@NotNull Project project, @NotNull Course course, @NotNull PsiDirectory directory) {
  if (directory.getName().equals(EduNames.SRC)) {
    directory = directory.getParent();
    if (directory == null) {
      return;
    }
  }
  PsiDirectory lessonDir = directory.getParent();
  if (lessonDir == null || !lessonDir.getName().contains(EduNames.LESSON)) {
    return;
  }
  Lesson lesson = course.getLesson(lessonDir.getName());
  if (lesson == null) {
    return;
  }
  String directoryName = directory.getName();
  Task task = lesson.getTask(directoryName);
  if (task != null) {
    processRename(task, EduNames.TASK, project);
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:23,代码来源:CCTaskRenameHandler.java

示例2: isAvailable

import com.intellij.psi.PsiDirectory; //导入方法依赖的package包/类
@Override
protected boolean isAvailable(DataContext dataContext) {
    final Project project = CommonDataKeys.PROJECT.getData(dataContext);
    final Module module = LangDataKeys.MODULE.getData(dataContext);
    final ModuleType moduleType = module == null ? null : ModuleType.get(module);
    final boolean isGravModule = moduleType instanceof GravModuleType || moduleType instanceof WebModuleTypeBase;
    final boolean pluginEnabled = GravProjectComponent.isEnabled(project);
    if (!pluginEnabled) return false;
    if (dataContext.getData(PlatformDataKeys.NAVIGATABLE) instanceof PsiDirectory) {
        PsiDirectory psiDirectory = (PsiDirectory) dataContext.getData(PlatformDataKeys.NAVIGATABLE);
        String themeFolder = psiDirectory.getParent().getVirtualFile().getName();
        themeName = psiDirectory.getName();
        GravFileTypes.setModuleName(themeName);
        boolean isThemeFolder = themeFolder.equalsIgnoreCase("themes");
        return super.isAvailable(dataContext) && isGravModule && isThemeFolder;
    } else {
        return false;
    }
}
 
开发者ID:PioBeat,项目名称:GravSupport,代码行数:20,代码来源:NewThemeConfigurationFileAction.java

示例3: DirectoryLookupElement

import com.intellij.psi.PsiDirectory; //导入方法依赖的package包/类
DirectoryLookupElement(PsiDirectory directory) {
    icon = directory.getIcon(0);
    name = directory.getName();
}
 
开发者ID:nvlad,项目名称:yii2support,代码行数:5,代码来源:DirectoryLookupElement.java

示例4: bindToElement

import com.intellij.psi.PsiDirectory; //导入方法依赖的package包/类
@Override
public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
    final StringLiteralExpression string = (StringLiteralExpression) this.getElement();
    final PsiDirectory context = ViewsUtil.getContextDirectory(string);
    final PsiFile file = (PsiFile) element;
    final PsiElement newValue;

    String fileName = string.getContents();
    if (fileName.contains("/")) {
        fileName = fileName.substring(fileName.lastIndexOf('/') + 1);
    }
    if (!file.getContainingDirectory().equals(context)) {
        final PsiDirectory root = ViewsUtil.getRootDirectory(string);
        if (root == null) {
            return null;
        }

        PsiDirectory dir = file.getContainingDirectory();
        while (dir != null && !(dir.equals(root) || dir.equals(context))) {
            fileName = dir.getName() + "/" + fileName;
            dir = dir.getParent();
        }

        if (dir == null) {
            return null;
        }

        if (dir.equals(root)) {
            fileName = "/" + fileName;
        }
    }
    fileName = string.isSingleQuote() ? "'" + fileName + "'" : "\"" + fileName + "\"";
    newValue = PhpPsiElementFactory.createFromText(element.getProject(), StringLiteralExpression.class, fileName);

    if (newValue != null) {
        string.replace(newValue);
    }

    for (MethodReference reference : PsiTreeUtil.findChildrenOfType(file, MethodReference.class)) {
        if (reference.getName() != null && ArrayUtil.contains(reference.getName(), ViewsUtil.renderMethods)) {
            reference.putUserData(ViewsUtil.RENDER_VIEW_FILE, null);
        }
    }

    return newValue;
}
 
开发者ID:nvlad,项目名称:yii2support,代码行数:47,代码来源:PsiReference.java


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