當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。