本文整理汇总了Java中com.intellij.navigation.GotoRelatedItem.createItems方法的典型用法代码示例。如果您正苦于以下问题:Java GotoRelatedItem.createItems方法的具体用法?Java GotoRelatedItem.createItems怎么用?Java GotoRelatedItem.createItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.navigation.GotoRelatedItem
的用法示例。
在下文中一共展示了GotoRelatedItem.createItems方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getItems
import com.intellij.navigation.GotoRelatedItem; //导入方法依赖的package包/类
@NotNull
@Override
public List<? extends GotoRelatedItem> getItems(@NotNull PsiElement context) {
PsiClass psiClass = PsiTreeUtil.getParentOfType(context, PsiClass.class, false);
if (psiClass != null) {
while (psiClass != null) {
List<PsiFile> forms = FormClassIndex.findFormsBoundToClass(psiClass.getProject(), psiClass);
if (!forms.isEmpty()) {
return GotoRelatedItem.createItems(forms, "UI Forms");
}
psiClass = PsiTreeUtil.getParentOfType(psiClass, PsiClass.class);
}
}
else {
PsiFile file = context.getContainingFile();
if (file != null && file.getFileType() == GuiFormFileType.INSTANCE) {
try {
String className = Utils.getBoundClassName(file.getText());
if (className != null) {
Project project = file.getProject();
PsiClass aClass = JavaPsiFacade.getInstance(project).findClass(className, GlobalSearchScope.allScope(project));
if (aClass != null) {
return Collections.singletonList(new GotoRelatedItem(aClass, "Java"));
}
}
}
catch (Exception ignore) {
}
}
}
return Collections.emptyList();
}
示例2: getItems
import com.intellij.navigation.GotoRelatedItem; //导入方法依赖的package包/类
@NotNull
@Override
public List<? extends GotoRelatedItem> getItems(@NotNull PsiElement context) {
PsiClass psiClass = PsiTreeUtil.getParentOfType(context, PsiClass.class, false);
if (psiClass != null) {
while (psiClass != null) {
List<PsiFile> forms = FormClassIndex.findFormsBoundToClass(psiClass);
if (!forms.isEmpty()) {
return GotoRelatedItem.createItems(forms, "UI Forms");
}
psiClass = PsiTreeUtil.getParentOfType(psiClass, PsiClass.class);
}
}
else {
PsiFile file = context.getContainingFile();
if (file.getFileType() == GuiFormFileType.INSTANCE) {
try {
String className = Utils.getBoundClassName(file.getText());
if (className != null) {
Project project = file.getProject();
PsiClass aClass = JavaPsiFacade.getInstance(project).findClass(className, GlobalSearchScope.allScope(project));
if (aClass != null) {
return Collections.singletonList(new GotoRelatedItem(aClass, "Java"));
}
}
}
catch (Exception ignore) {
}
}
}
return Collections.emptyList();
}
示例3: getItems
import com.intellij.navigation.GotoRelatedItem; //导入方法依赖的package包/类
@NotNull
@Override
public List<? extends GotoRelatedItem> getItems(@NotNull PsiElement context) {
PsiClass psiClass = PsiTreeUtil.getParentOfType(context, PsiClass.class, false);
if (psiClass != null) {
final Project project = psiClass.getProject();
while (psiClass != null && TestNGUtil.hasTest(psiClass) && PsiClassUtil.isRunnableClass(psiClass, true)) {
final String qName = psiClass.getQualifiedName();
if (qName != null) {
final String packageQName = ((PsiJavaFile)psiClass.getContainingFile()).getPackageName();
final String packageName = StringUtil.getShortName(packageQName);
final String[] names;
if (packageQName.length() > 0) {
final String pName = packageName.length() > 0 ? packageName : packageQName;
names = new String[]{qName, pName};
}
else {
names = new String[]{qName};
}
final List<PsiElement> tags = new ArrayList<PsiElement>();
for (final String name : names) {
PsiSearchHelper.SERVICE.getInstance(project)
.processUsagesInNonJavaFiles(name, new PsiNonJavaFileReferenceProcessor() {
public boolean process(final PsiFile file, final int startOffset, final int endOffset) {
final PsiReference referenceAt = file.findReferenceAt(startOffset);
if (referenceAt != null) {
if (packageQName.endsWith(name)) { //special package tag required
final XmlTag tag = PsiTreeUtil.getParentOfType(file.findElementAt(startOffset), XmlTag.class);
if (tag == null || !tag.getName().equals("package")) {
return true;
}
final XmlAttribute attribute = tag.getAttribute("name");
if (attribute == null) return true;
final String value = attribute.getValue();
if (value == null) return true;
if (!(value.equals(StringUtil.getQualifiedName(packageQName, "*")) || value.equals(packageQName))) return true;
}
tags.add(referenceAt.getElement());
}
return true;
}
}, new TestNGSearchScope(project));
}
if (!tags.isEmpty()) {
return GotoRelatedItem.createItems(tags, "TestNG");
}
}
psiClass = PsiTreeUtil.getParentOfType(psiClass, PsiClass.class);
}
}
return Collections.emptyList();
}
示例4: fun
import com.intellij.navigation.GotoRelatedItem; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<? extends GotoRelatedItem> fun(ExtensionPointCandidate candidate) {
return GotoRelatedItem.createItems(Collections.singleton(candidate.pointer.getElement()), "DevKit");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ExtensionPointDeclarationRelatedItemLineMarkerProvider.java
示例5: fun
import com.intellij.navigation.GotoRelatedItem; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<? extends GotoRelatedItem> fun(PsiFile psiFile) {
return GotoRelatedItem.createItems(Collections.singleton(psiFile), "DevKit");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:DescriptionTypeRelatedItemLineMarkerProvider.java