本文整理匯總了Java中com.intellij.psi.PsiFile.getFileType方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiFile.getFileType方法的具體用法?Java PsiFile.getFileType怎麽用?Java PsiFile.getFileType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.PsiFile
的用法示例。
在下文中一共展示了PsiFile.getFileType方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setupConfigurationFromContext
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
protected boolean setupConfigurationFromContext(AppleScriptRunConfiguration configuration, ConfigurationContext context, Ref<PsiElement> sourceElement) {
PsiElement elem = context.getPsiLocation();
PsiFile file = elem != null ? elem.getContainingFile() : null;
if (file == null) return false;
boolean shouldSetUp = file.getFileType() == AppleScriptFileType.INSTANCE;
VirtualFile vFile = file.getVirtualFile();
String scriptPath = vFile != null ? file.getVirtualFile().getPath() : null;
if (scriptPath != null) {
configuration.setScriptPath(scriptPath);
String[] parts = scriptPath.split("/");
if (parts.length > 0) {
configuration.setName(parts[parts.length - 1]);
}
}
return shouldSetUp;
}
示例2: postProcessEnter
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public Result postProcessEnter(
@NotNull PsiFile file, @NotNull Editor editor, @NotNull DataContext dataContext) {
if (file.getFileType() != SoyFileType.INSTANCE) {
return Result.Continue;
}
int caretOffset = editor.getCaretModel().getOffset();
PsiElement element = file.findElementAt(caretOffset);
Document document = editor.getDocument();
int lineNumber = document.getLineNumber(caretOffset) - 1;
int lineStartOffset = document.getLineStartOffset(lineNumber);
String lineTextBeforeCaret = document.getText(new TextRange(lineStartOffset, caretOffset));
if (element instanceof PsiComment && element.getTextOffset() < caretOffset) {
handleEnterInComment(element, file, editor);
} else if (lineTextBeforeCaret.startsWith("/*")) {
insertText(file, editor, " * \n ", 3);
}
return Result.Continue;
}
示例3: isProvider
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
static public boolean isProvider(@Nullable PsiFile file) {
//noinspection SimplifiableIfStatement - easier to read
if (null == file || PhpFileType.INSTANCE != file.getFileType() || file.getName().equals("config.php")) {
return false;
}
return file.getVirtualFile().getPath()
.matches(".*/(translations|messages)/([a-zA-z]{2}(-[a-zA-z]{2})?)/[^/]+\\.php$");
}
示例4: isInContext
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public boolean isInContext(@NotNull PsiFile file, int offset) {
if (file.getFileType() != SoyFileType.INSTANCE) return false;
PsiElement element = file.findElementAt(offset);
return psiElement()
.andOr(
psiElement().inside(Matchers.templateBlockMatcher),
psiElement().withAncestor(2, Matchers.templateCallStatementMatcher))
.accepts(element);
}
示例5: isInContext
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public boolean isInContext(@NotNull PsiFile file, int offset) {
if (file.getFileType() != SoyFileType.INSTANCE) return false;
PsiElement element = file.findElementAt(offset);
return psiElement()
.inside(Matchers.templateBlockMatcher)
.andNot(psiElement().withAncestor(2, Matchers.templateCallStatementMatcher))
.accepts(element);
}
示例6: isInContext
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public boolean isInContext(@NotNull PsiFile file, int offset) {
if (file.getFileType() != SoyFileType.INSTANCE) return false;
PsiElement element = file.findElementAt(offset);
return !psiElement().inside(Matchers.templateBlockMatcher).accepts(element);
}
示例7: createModel
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@NotNull
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
final PsiFile file = element.getContainingFile();
if (element.getNode().getElementType() == SoyTypes.OTHER) {
return new SimpleTemplateLanguageFormattingModelBuilder().createModel(element, settings);
} else {
return new DocumentBasedFormattingModel(
getRootBlock(file, file.getViewProvider(), settings),
element.getProject(),
settings,
file.getFileType(),
file);
}
}
示例8: isInContext
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public boolean isInContext(@NotNull PsiFile file, int offset) {
return file.getFileType() == AppleScriptFileType.INSTANCE;
}
示例9: isAvailable
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
return file.getFileType() == AppleScriptFileType.INSTANCE;
}
示例10: isAvailable
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
return file.getFileType() instanceof AppleScriptFileType;
}
示例11: isInContext
import com.intellij.psi.PsiFile; //導入方法依賴的package包/類
@Override
public boolean isInContext(@NotNull PsiFile psiFile, int offset) {
return psiFile.getFileType() == CptFileType.INSTANCE;
}