本文整理匯總了Java中com.intellij.psi.PsiFile.getProject方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiFile.getProject方法的具體用法?Java PsiFile.getProject怎麽用?Java PsiFile.getProject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.PsiFile
的用法示例。
在下文中一共展示了PsiFile.getProject方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTypeSystemMeta
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public synchronized TSMetaModel getTypeSystemMeta(@Nullable final PsiFile contextFile) {
if (contextFile == null || !TSMetaModelBuilder.isTsFile(contextFile)) {
return myCachedValue.getValue();
}
final TSMetaModelImpl externalModel = doGetExternalModel(contextFile);
final Project project = contextFile.getProject();
CachedValue<TSMetaModelImpl> fileModelCache = contextFile.getUserData(FILE_MODEL_CACHE_KEY);
if (fileModelCache == null) {
fileModelCache = CachedValuesManager.getManager(project).createCachedValue(
() -> ApplicationManager.getApplication().runReadAction(
(Computable<CachedValueProvider.Result<TSMetaModelImpl>>) () -> {
final TSMetaModelBuilder builder = new TSMetaModelBuilder(project);
final TSMetaModelImpl modelForFile = builder.buildModelForFile(contextFile);
return CachedValueProvider.Result.create(modelForFile, contextFile);
}), false);
contextFile.putUserData(FILE_MODEL_CACHE_KEY, fileModelCache);
}
final TSMetaModelImpl fileModel = fileModelCache.getValue();
return new TSMetaModelImpl(Arrays.asList(externalModel, fileModel));
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:25,代碼來源:TSMetaModelAccessImpl.java
示例2: doGetExternalModel
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@NotNull
private TSMetaModelImpl doGetExternalModel(final @NotNull PsiFile contextFile) {
final PsiFile originalFile = contextFile.getOriginalFile();
final VirtualFile vFile = originalFile.getVirtualFile();
final Project project = originalFile.getProject();
CachedValue<TSMetaModelImpl> externalModelCache = originalFile.getUserData(EXTERNAL_MODEL_CACHE_KEY);
if (externalModelCache == null) {
externalModelCache = CachedValuesManager.getManager(project).createCachedValue(
() -> ApplicationManager.getApplication().runReadAction(
(Computable<CachedValueProvider.Result<TSMetaModelImpl>>) () -> {
final List<VirtualFile> excludes = vFile == null
? Collections.emptyList()
: Collections.singletonList(vFile);
final TSMetaModelBuilder builder = new TSMetaModelBuilder(project, excludes);
final TSMetaModelImpl model = builder.buildModel();
return CachedValueProvider.Result.create(model, builder.getFiles());
}), false);
originalFile.putUserData(EXTERNAL_MODEL_CACHE_KEY, externalModelCache);
}
return externalModelCache.getValue();
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:27,代碼來源:TSMetaModelAccessImpl.java
示例3: ignoreUnresolvedReference
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public boolean ignoreUnresolvedReference(@NotNull PyElement element, @NotNull PsiReference reference) {
final PsiFile file = element.getContainingFile();
final Project project = file.getProject();
if (StudyTaskManager.getInstance(project).getCourse() == null) {
return false;
}
TaskFile taskFile = StudyUtils.getTaskFile(project, file.getVirtualFile());
if (taskFile == null || taskFile.isUserCreated() || taskFile.isHighlightErrors()) {
return false;
}
if (PsiTreeUtil.getParentOfType(element, PyImportStatementBase.class) != null) {
return false;
}
return true;
}
示例4: tryToRenameTaskFile
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
private static void tryToRenameTaskFile(PsiFile file, String oldName) {
final PsiDirectory taskDir = file.getContainingDirectory();
final Project project = file.getProject();
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
if (taskDir == null || !taskDir.getName().contains(EduNames.TASK)) {
return;
}
PsiDirectory lessonDir = taskDir.getParent();
if (lessonDir == null || !lessonDir.getName().contains(EduNames.LESSON)) {
return;
}
Lesson lesson = course.getLesson(lessonDir.getName());
if (lesson == null) {
return;
}
Task task = lesson.getTask(taskDir.getName());
if (task == null) {
return;
}
Map<String, TaskFile> taskFiles = task.getTaskFiles();
TaskFile taskFile = task.getTaskFile(oldName);
if (taskFile == null) {
return;
}
taskFiles.remove(oldName);
taskFiles.put(StudyUtils.pathRelativeToTask(file.getVirtualFile()), taskFile);
}