本文整理匯總了Java中com.intellij.psi.PsiFile.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiFile.getName方法的具體用法?Java PsiFile.getName怎麽用?Java PsiFile.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.PsiFile
的用法示例。
在下文中一共展示了PsiFile.getName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPresentation
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
public static ItemPresentation getPresentation(final CptTemplate element) {
return new ItemPresentation() {
@Nullable
@Override
public String getPresentableText() {
return element.getTemplateName();
}
@Nullable
@Override
public String getLocationString() {
PsiFile containingFile = element.getContainingFile();
return containingFile == null ? null : containingFile.getName();
}
@Nullable
@Override
public Icon getIcon(boolean unused) {
return CptIcons.FILE;
}
};
}
示例2: getDirectory
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Nullable
private static PsiDirectory getDirectory(PsiElement element) {
PsiFile file = element.getContainingFile().getOriginalFile();
String filename = file.getName();
PsiDirectory directory = file.getParent();
filename = filename.substring(0, filename.lastIndexOf("."));
if (directory != null) {
if (filename.endsWith("Controller")) {
directory = directory.getParentDirectory();
} else {
PsiDirectory messageParent = directory.findSubdirectory("messages");
while (messageParent == null) {
directory = directory.getParentDirectory();
if (directory == null) {
break;
}
messageParent = directory.findSubdirectory("messages");
}
}
}
if (directory != null) {
directory = directory.findSubdirectory("messages");
if (directory != null && directory.getSubdirectories().length > 0) {
directory = directory.getSubdirectories()[0];
return directory;
}
}
return null;
}
示例3: renderElement
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public void renderElement(LookupElementPresentation presentation) {
super.renderElement(presentation);
if (myCategory instanceof PsiFile) {
PsiFile file = (PsiFile) myCategory;
String filename = file.getName();
presentation.setIcon(file.getIcon(0));
presentation.setItemText(filename.substring(0, filename.lastIndexOf(".")));
}
}
示例4: CCStudentInvisibleFileNode
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
public CCStudentInvisibleFileNode(Project project,
PsiFile value,
ViewSettings viewSettings) {
super(project, value, viewSettings);
myName = value.getName();
}