本文整理汇总了Java中com.intellij.psi.PsiIdentifier类的典型用法代码示例。如果您正苦于以下问题:Java PsiIdentifier类的具体用法?Java PsiIdentifier怎么用?Java PsiIdentifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PsiIdentifier类属于com.intellij.psi包,在下文中一共展示了PsiIdentifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: seekChildren
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
private static void seekChildren(PsiElement element, PsiIdentifier target, Find find) {
for (PsiElement child : element.getChildren()) {
if (child instanceof PsiLocalVariable) {
PsiLocalVariable localVariable = (PsiLocalVariable) child;
if (isSameName(target, localVariable.getNameIdentifier())) {
find.findLocalVariable = localVariable;
return;
}
}
if (child instanceof PsiParameter) {
PsiParameter parameter = (PsiParameter) child;
if (isSameName(target, parameter.getNameIdentifier())) {
find.findParameter = parameter;
return;
}
}
seekChildren(child, target, find);
if (!find.isEmpty()) return;
}
}
示例2: testCamelGutterForVariableAndConstant
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
public void testCamelGutterForVariableAndConstant() {
myFixture.configureByFiles("JavaCamelRouteLineMarkerProviderFromVariableTestData.java");
List<GutterMark> gutters = myFixture.findAllGutters();
assertNotNull(gutters);
//remove first element since it is navigate to super implementation gutter icon
gutters.remove(0);
assertEquals("Should contain 2 Camel gutters", 2, gutters.size());
assertGuttersHasCamelIcon(gutters);
LineMarkerInfo.LineMarkerGutterIconRenderer firstGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(0);
assertTrue(firstGutter.getLineMarkerInfo().getElement() instanceof PsiIdentifier);
assertEquals("The navigation start element doesn't match", "uriVar",
firstGutter.getLineMarkerInfo().getElement().getText());
List<GotoRelatedItem> firstGutterTargets = getGutterNavigationDestinationElements(firstGutter);
assertEquals("Navigation should have two targets", 2, firstGutterTargets.size());
}
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:21,代码来源:JavaCamelRouteLineMarkerProviderTestIT.java
示例3: testCamelGutterForMethodCallFrom
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
public void testCamelGutterForMethodCallFrom() {
myFixture.configureByFiles("JavaCamelRouteLineMarkerProviderFromMethodCallTestData.java");
List<GutterMark> gutters = myFixture.findAllGutters();
assertNotNull(gutters);
//remove first element since it is navigate to super implementation gutter icon
gutters.remove(0);
// remove last element since it is from method returning route uri
gutters.remove(gutters.size() - 1);
assertEquals("Should contain 1 Camel gutters", 1, gutters.size());
assertGuttersHasCamelIcon(gutters);
LineMarkerInfo.LineMarkerGutterIconRenderer firstGutter = (LineMarkerInfo.LineMarkerGutterIconRenderer) gutters.get(0);
assertTrue(firstGutter.getLineMarkerInfo().getElement() instanceof PsiIdentifier);
assertEquals("The navigation start element doesn't match", "calcEndpoint",
firstGutter.getLineMarkerInfo().getElement().getText());
List<GotoRelatedItem> firstGutterTargets = getGutterNavigationDestinationElements(firstGutter);
assertEquals("Navigation should have two targets", 2, firstGutterTargets.size());
assertEquals("The navigation variable target element doesn't match", "calcEndpoint",
getGuttersWithMethodTarget(firstGutterTargets).get(0).getName());
}
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:25,代码来源:JavaCamelRouteLineMarkerProviderTestIT.java
示例4: ClsMemberImpl
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
protected ClsMemberImpl(T stub) {
super(stub);
myDocComment = !isDeprecated() ? null : new AtomicNotNullLazyValue<PsiDocComment>() {
@NotNull
@Override
protected PsiDocComment compute() {
return new ClsDocCommentImpl(ClsMemberImpl.this);
}
};
myNameIdentifier = new AtomicNotNullLazyValue<PsiIdentifier>() {
@NotNull
@Override
protected PsiIdentifier compute() {
return new ClsIdentifierImpl(ClsMemberImpl.this, getName());
}
};
}
示例5: select
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
@Override
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
List<TextRange> result = super.select(e, editorText, cursorOffset, editor);
final PsiField field = (PsiField)e;
final TextRange range = field.getTextRange();
final PsiIdentifier first = field.getNameIdentifier();
final TextRange firstRange = first.getTextRange();
final PsiElement last = field.getInitializer();
final int end = last == null ? firstRange.getEndOffset() : last.getTextRange().getEndOffset();
PsiDocComment comment = field.getDocComment();
if (comment != null) {
TextRange commentTextRange = comment.getTextRange();
addRangeElem(result, editorText, comment, commentTextRange.getEndOffset());
}
addRangeElem(result, editorText, first, end);
//addRangeElem (result, editorText, field, textLength, field.getTypeElement(), end);
addRangeElem(result, editorText, field.getModifierList(), range.getEndOffset());
//addRangeElem (result, editorText, field, textLength, field.getDocComment(), end);
result.addAll(expandToWholeLine(editorText, range));
return result;
}
示例6: tokenize
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
@Override
public void tokenize(@NotNull T element, TokenConsumer consumer) {
final PsiIdentifier psiIdentifier = PsiTreeUtil.getChildOfType(element, PsiIdentifier.class);
final PsiTypeElement psiType = PsiTreeUtil.getChildOfType(element, PsiTypeElement.class);
if (psiIdentifier == null) {
return;
}
final String identifier = psiIdentifier.getText();
final String type = psiType==null?null:psiType.getText();
if (identifier == null) {
return;
}
if (type == null || !type.equalsIgnoreCase(identifier)) {
myIdentifierTokenizer.tokenize(psiIdentifier, consumer);
}
if (psiType != null) {
myTypeTokenizer.tokenize(psiType, consumer);
}
}
示例7: visitMethod
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
super.visitMethod(method);
if (!TestNGUtil.hasTest(method)) {
return;
}
final PsiIdentifier nameIdentifier = method.getNameIdentifier();
if (nameIdentifier == null) {
return;
}
final String name = method.getName();
if (isValid(name)) {
return;
}
if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
return;
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method, name);
}
示例8: visitMethod
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
super.visitMethod(method);
if (!TestUtils.isJUnit4TestMethod(method) || !TestUtils.isRunnable(method)) {
return;
}
final PsiIdentifier nameIdentifier = method.getNameIdentifier();
if (nameIdentifier == null) {
return;
}
final String name = method.getName();
if (isValid(name)) {
return;
}
if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
return;
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method, name);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JUnit4MethodNamingConventionInspectionBase.java
示例9: visitMethod
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
@Override
public void visitMethod(PsiMethod method) {
super.visitMethod(method);
if (!TestUtils.isJUnit3TestMethod(method) || !TestUtils.isRunnable(method)) {
return;
}
final PsiIdentifier nameIdentifier = method.getNameIdentifier();
if (nameIdentifier == null) {
return;
}
final String name = method.getName();
if (isValid(name)) {
return;
}
if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
return;
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method, name);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JUnit3MethodNamingConventionInspectionBase.java
示例10: visitTypeParameter
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
@Override
public void visitTypeParameter(PsiTypeParameter parameter) {
super.visitTypeParameter(parameter);
final String name = parameter.getName();
if (name == null) {
return;
}
if (isValid(name)) {
return;
}
final PsiIdentifier nameIdentifier = parameter.getNameIdentifier();
if (nameIdentifier == null) {
return;
}
registerError(nameIdentifier, name);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TypeParameterNamingConventionInspectionBase.java
示例11: visitMethod
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
@Override
public void visitMethod(@NotNull PsiMethod method) {
super.visitMethod(method);
if (method.isConstructor()) {
return;
}
if (!method.hasModifierProperty(PsiModifier.NATIVE)) {
return;
}
final PsiIdentifier nameIdentifier = method.getNameIdentifier();
if (nameIdentifier == null) {
return;
}
final String name = method.getName();
if (isValid(name)) {
return;
}
if (!isOnTheFly() && MethodUtils.hasSuper(method)) {
return;
}
if (LibraryUtil.isOverrideOfLibraryMethod(method)) {
return;
}
registerMethodError(method, name);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:NativeMethodNamingConventionInspectionBase.java
示例12: visitContinueStatement
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
@Override
public void visitContinueStatement(
@NotNull PsiContinueStatement statement) {
super.visitContinueStatement(statement);
final PsiIdentifier label = statement.getLabelIdentifier();
if (label == null) {
return;
}
final String labelText = label.getText();
if (labelText == null) {
return;
}
if (labelText.length() == 0) {
return;
}
registerStatementError(statement);
}
示例13: visitBreakStatement
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
@Override
public void visitBreakStatement(@NotNull PsiBreakStatement statement) {
super.visitBreakStatement(statement);
final PsiIdentifier labelIdentifier =
statement.getLabelIdentifier();
if (labelIdentifier == null) {
return;
}
final String labelText = labelIdentifier.getText();
if (labelText == null) {
return;
}
if (labelText.length() == 0) {
return;
}
registerStatementError(statement);
}
示例14: getQuickFixes
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
@NotNull
@Override
public IntentionAction[] getQuickFixes(@NotNull PsiElement element) {
if (!(element instanceof PsiIdentifier)) return IntentionAction.EMPTY_ARRAY;
PsiElement parent = element.getParent();
if (!(parent instanceof PsiClass)) return IntentionAction.EMPTY_ARRAY;
PsiClass psiClass = (PsiClass)parent;
if (InheritanceUtil.isInheritor(psiClass, LocalInspectionTool.class.getName())) {
return new IntentionAction[]{new RegisterInspectionFix(psiClass, LocalInspectionEP.LOCAL_INSPECTION)};
}
if (InheritanceUtil.isInheritor(psiClass, GlobalInspectionTool.class.getName())) {
return new IntentionAction[]{new RegisterInspectionFix(psiClass, InspectionEP.GLOBAL_INSPECTION)};
}
ExtensionPointLocator extensionPointLocator = new ExtensionPointLocator(psiClass);
List<ExtensionPointCandidate> candidateList = extensionPointLocator.findSuperCandidates();
if (!candidateList.isEmpty()) {
return new IntentionAction[]{new RegisterExtensionFix(psiClass, candidateList)};
}
return IntentionAction.EMPTY_ARRAY;
}
示例15: findLayoutResource
import com.intellij.psi.PsiIdentifier; //导入依赖的package包/类
/**
* Try to find layout XML file in selected element
*
* @param element
* @return
*/
public static PsiFile findLayoutResource(PsiElement element) {
if (element == null) {
return null; // nothing to be used
}
if (!(element instanceof PsiIdentifier)) {
return null; // nothing to be used
}
PsiElement layout = element.getParent().getFirstChild();
if (layout == null) {
return null; // no file to process
}
if (!"R.layout".equals(layout.getText())) {
return null; // not layout file
}
Project project = element.getProject();
String name = String.format("%s.xml", element.getText());
PsiFile[] files = FilenameIndex.getFilesByName(project, name, new EverythingGlobalScope(project));
if (files.length <= 0) {
return null; //no matching files
}
return files[0];
}