本文整理汇总了Java中com.intellij.pom.PomTargetPsiElement类的典型用法代码示例。如果您正苦于以下问题:Java PomTargetPsiElement类的具体用法?Java PomTargetPsiElement怎么用?Java PomTargetPsiElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PomTargetPsiElement类属于com.intellij.pom包,在下文中一共展示了PomTargetPsiElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getDescriptor
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Nullable
public static Navigatable getDescriptor(@NotNull PsiElement element) {
PsiElement original = getNavigatableOriginalElement(element);
if (original != null) {
element = original;
}
else if (!canNavigate(element)) {
return null;
}
if (element instanceof PomTargetPsiElement) {
return ((PomTargetPsiElement)element).getTarget();
}
final PsiElement navigationElement = element.getNavigationElement();
if (navigationElement instanceof PomTargetPsiElement) {
return ((PomTargetPsiElement)navigationElement).getTarget();
}
final int offset = navigationElement instanceof PsiFile ? -1 : navigationElement.getTextOffset();
final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(navigationElement);
if (virtualFile == null || !virtualFile.isValid()) {
return null;
}
OpenFileDescriptor desc = new OpenFileDescriptor(navigationElement.getProject(), virtualFile, offset);
desc.setUseCurrentWindow(FileEditorManager.USE_CURRENT_WINDOW.isIn(navigationElement));
return desc;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:EditSourceUtil.java
示例2: isValidName
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
public static boolean isValidName(final Project project, final PsiElement psiElement, final String newName) {
if (newName == null || newName.length() == 0) {
return false;
}
final Condition<String> inputValidator = RenameInputValidatorRegistry.getInputValidator(psiElement);
if (inputValidator != null) {
return inputValidator.value(newName);
}
if (psiElement instanceof PsiFile || psiElement instanceof PsiDirectory) {
return newName.indexOf('\\') < 0 && newName.indexOf('/') < 0;
}
if (psiElement instanceof PomTargetPsiElement) {
return !StringUtil.isEmptyOrSpaces(newName);
}
final PsiFile file = psiElement.getContainingFile();
final Language elementLanguage = psiElement.getLanguage();
final Language fileLanguage = file == null ? null : file.getLanguage();
Language language = fileLanguage == null ? elementLanguage : fileLanguage.isKindOf(elementLanguage) ? fileLanguage : elementLanguage;
return LanguageNamesValidation.INSTANCE.forLanguage(language).isIdentifier(newName.trim(), project);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:RenameUtil.java
示例3: generateDoc
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Override
public String generateDoc(PsiElement element, final PsiElement originalElement) {
if (element instanceof PomTargetPsiElement) {
PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof DelegatePsiTarget) {
element = ((DelegatePsiTarget)target).getNavigationElement();
}
}
final DomElement domElement = DomUtil.getDomElement(element);
if (domElement == null) {
return null;
}
ElementPresentationTemplate template = domElement.getChildDescription().getPresentationTemplate();
if (template != null) {
String documentation = template.createPresentation(domElement).getDocumentation();
if (documentation != null) return documentation;
}
return ElementPresentationManager.getDocumentationForElement(domElement);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DomDocumentationProvider.java
示例4: testNavigationToIncluded
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
public void testNavigationToIncluded() throws Throwable {
final MyElement rootElement = createDomFile("a.xml", "<root xmlns:xi=\"http://www.w3.org/2001/XInclude\">" +
"<xi:include href=\"b.xml\" xpointer=\"xpointer(/xxx/*)\"/>" +
"<child ref=\"b\"/>" +
"</root>");
final XmlFile includedFile = (XmlFile) createFile("b.xml", "<xxx><child xxx=\"b\"/></xxx>");
final List<Child> children = rootElement.getChildren();
final MyElement domTarget = children.get(0);
final GenericAttributeValue<Child> ref = children.get(1).getRef();
final MyElement value = ref.getValue();
assertEquals(domTarget, value);
myFixture.configureFromTempProjectFile("a.xml");
final int offset = ref.getXmlAttributeValue().getTextRange().getStartOffset() + 1;
myFixture.getEditor().getCaretModel().moveToOffset(offset);
final PsiElement target = GotoDeclarationAction.findTargetElement(getProject(), myFixture.getEditor(), offset);
PsiElement element = ((DomTarget)((PomTargetPsiElement)target).getTarget()).getNavigationElement();
// assertSame(PomService.convertToPsi(DomTarget.getTarget(domTarget)), target);
assertSame(includedFile.getDocument().getRootTag().getSubTags()[0].getAttributes()[0].getValueElement(), element);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DomIncludesTest.java
示例5: getAdditionalUseScope
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Override
public SearchScope getAdditionalUseScope(@NotNull PsiElement element) {
if (element instanceof PomTargetPsiElement) {
PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof DomTarget) {
DomElement domElement = ((DomTarget)target).getDomElement();
if (domElement instanceof ExtensionPoint) {
return createProjectXmlFilesScope(element);
}
}
}
if (element instanceof PsiClass &&
PsiUtil.isIdeaProject(element.getProject()) &&
((PsiClass)element).hasModifierProperty(PsiModifier.PUBLIC)) {
return createProjectXmlFilesScope(element);
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DevKitUseScopeEnlarger.java
示例6: getDescriptor
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Nullable
public static Navigatable getDescriptor(final PsiElement element) {
if (!canNavigate(element)) {
return null;
}
if (element instanceof PomTargetPsiElement) {
return ((PomTargetPsiElement)element).getTarget();
}
final PsiElement navigationElement = element.getNavigationElement();
if (navigationElement instanceof PomTargetPsiElement) {
return ((PomTargetPsiElement)navigationElement).getTarget();
}
final int offset = navigationElement instanceof PsiFile ? -1 : navigationElement.getTextOffset();
final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(navigationElement);
if (virtualFile == null || !virtualFile.isValid()) {
return null;
}
OpenFileDescriptor desc = new OpenFileDescriptor(navigationElement.getProject(), virtualFile, offset);
desc.setUseCurrentWindow(FileEditorManager.USE_CURRENT_WINDOW.isIn(navigationElement));
return desc;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:EditSourceUtil.java
示例7: generateDoc
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
public String generateDoc(PsiElement element, final PsiElement originalElement) {
if (element instanceof PomTargetPsiElement) {
PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof DelegatePsiTarget) {
element = ((DelegatePsiTarget)target).getNavigationElement();
}
}
final DomElement domElement = DomUtil.getDomElement(element);
if (domElement == null) {
return null;
}
ElementPresentationTemplate template = domElement.getChildDescription().getPresentationTemplate();
if (template != null) {
String documentation = template.createPresentation(domElement).getDocumentation();
if (documentation != null) return documentation;
}
return ElementPresentationManager.getDocumentationForElement(domElement);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:DomDocumentationProvider.java
示例8: pomElement
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
public static PsiElementPattern.Capture<PomTargetPsiElement> pomElement(final ElementPattern<? extends PomTarget> targetPattern) {
return new PsiElementPattern.Capture<PomTargetPsiElement>(PomTargetPsiElement.class).with(new PatternCondition<PomTargetPsiElement>("withPomTarget") {
@Override
public boolean accepts(@NotNull final PomTargetPsiElement element, final ProcessingContext context) {
return targetPattern.accepts(element.getTarget(), context);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PlatformPatterns.java
示例9: findTargetForUpdate
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Nullable
private Navigatable findTargetForUpdate(@NotNull DataContext dataContext) {
Navigatable[] navigatables = getNavigatables(dataContext);
if (navigatables == null) return null;
for (Navigatable navigatable : navigatables) {
if (navigatable.canNavigate()) {
return navigatable instanceof PomTargetPsiElement ? ((PomTargetPsiElement)navigatable).getTarget() : navigatable;
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:BaseNavigateToSourceAction.java
示例10: replaceModel
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Override
protected void replaceModel(@NotNull List<PsiElement> data) {
final PsiElement[] elements = myComponent.getElements();
final int includeSelfIdx = myElement instanceof PomTargetPsiElement ? 0 : 1;
final int startIdx = elements.length - includeSelfIdx;
final PsiElement[] result = new PsiElement[data.size() + includeSelfIdx];
System.arraycopy(elements, 0, result, 0, elements.length);
System.arraycopy(PsiUtilCore.toPsiElementArray(data), startIdx, result, elements.length, data.size() - startIdx);
myComponent.update(result, myComponent.getIndex());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ShowImplementationsAction.java
示例11: getNameIdentifierRange
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Nullable
public static TextRange getNameIdentifierRange(PsiFile file, PsiElement element) {
final InjectedLanguageManager injectedManager = InjectedLanguageManager.getInstance(element.getProject());
if (element instanceof PomTargetPsiElement) {
final PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof PsiDeclaredTarget) {
final PsiDeclaredTarget declaredTarget = (PsiDeclaredTarget)target;
final TextRange range = declaredTarget.getNameIdentifierRange();
if (range != null) {
if (range.getStartOffset() < 0 || range.getLength() <= 0) {
return null;
}
final PsiElement navElement = declaredTarget.getNavigationElement();
if (PsiUtilBase.isUnderPsiRoot(file, navElement)) {
return injectedManager.injectedToHost(navElement, range.shiftRight(navElement.getTextRange().getStartOffset()));
}
}
}
}
if (!PsiUtilBase.isUnderPsiRoot(file, element)) {
return null;
}
PsiElement identifier = IdentifierUtil.getNameIdentifier(element);
if (identifier != null && PsiUtilBase.isUnderPsiRoot(file, identifier)) {
return injectedManager.injectedToHost(identifier, identifier.getTextRange());
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:HighlightUsagesHandler.java
示例12: toDomElement
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Nullable
public static DomElement toDomElement(PsiElement resolve) {
if (resolve instanceof PomTargetPsiElement) {
final PomTarget target = ((PomTargetPsiElement)resolve).getTarget();
if(target instanceof DomTarget) {
return ((DomTarget)target).getDomElement();
}
return null;
}
return DomUtil.getDomElement(resolve);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AntDomReferenceBase.java
示例13: convertToAntDomElement
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Nullable
private static AntDomElement convertToAntDomElement(PsiElement element) {
if (element instanceof PomTargetPsiElement) {
final PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof DomTarget) {
final DomElement domElement = ((DomTarget)target).getDomElement();
if (domElement instanceof AntDomElement) {
return (AntDomElement)domElement;
}
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AntRenameProcessor.java
示例14: testPropertyInMacrodefParam
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
public void testPropertyInMacrodefParam() throws Exception {
PsiReference ref = configure();
final PsiElement result = ref.resolve();
assertTrue(result instanceof PomTargetPsiElement);
final PsiElement naviElem = ((DomTarget)((PomTargetPsiElement)result).getTarget()).getNavigationElement();
final DomElement domElement = DomUtil.getDomElement(naviElem);
assertNotNull(domElement);
assertNotNull(domElement.getParentOfType(AntDomMacrodefAttribute.class, false));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AntResolveTest.java
示例15: doPropertyTest
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
private void doPropertyTest() throws Exception {
PsiReference ref = configure();
PsiElement target = ref.resolve();
assertTrue(
(target instanceof PomTargetPsiElement && ((PomTargetPsiElement)target).getTarget().canNavigateToSource()) ||
(target instanceof XmlTag && ("project".equalsIgnoreCase(((XmlTag)target).getName()) || "buildnumber".equalsIgnoreCase(((XmlTag)target).getName())))
);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AntResolveTest.java
示例16: getProperty
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
public static IProperty getProperty(PsiElement element) {
if (element instanceof IProperty) {
return (IProperty)element;
}
if (element instanceof PomTargetPsiElement) {
final PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof XmlProperty) {
return (IProperty)target;
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PropertiesImplUtil.java
示例17: findExtensionPoint
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Nullable
private static ExtensionPoint findExtensionPoint(PsiElement element) {
if (element instanceof PomTargetPsiElement &&
DescriptorUtil.isPluginXml(element.getContainingFile())) {
final PomTarget pomTarget = ((PomTargetPsiElement)element).getTarget();
if (pomTarget instanceof DomTarget) {
final DomElement domElement = ((DomTarget)pomTarget).getDomElement();
if (domElement instanceof ExtensionPoint) {
return (ExtensionPoint)domElement;
}
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ExtensionPointDocumentationProvider.java
示例18: getExtensionPoint
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Override
public ExtensionPoint getExtensionPoint() {
PsiElement declaration = getChildDescription().getDeclaration(getManager().getProject());
if (declaration instanceof PomTargetPsiElement) {
PomTarget target = ((PomTargetPsiElement)declaration).getTarget();
return target instanceof DomTarget ? (ExtensionPoint)((DomTarget)target).getDomElement() : null;
}
return null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:ExtensionImpl.java
示例19: getAdditionalUseScope
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Override
public SearchScope getAdditionalUseScope(@NotNull PsiElement element) {
if (element instanceof PomTargetPsiElement) {
PomTarget target = ((PomTargetPsiElement)element).getTarget();
if (target instanceof DomTarget) {
DomElement domElement = ((DomTarget)target).getDomElement();
if (domElement instanceof ExtensionPoint) {
return GlobalSearchScope.allScope(element.getProject());
}
}
}
return null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:DevKitUseScopeEnlarger.java
示例20: getModelObject
import com.intellij.pom.PomTargetPsiElement; //导入依赖的package包/类
@Nullable
public static Object getModelObject(PsiElement element)
{
if(!(element instanceof PomTargetPsiElement))
{
return null;
}
final PomTarget target = ((PomTargetPsiElement) element).getTarget();
return target instanceof CommonModelTarget ? ((CommonModelTarget) target).getCommonElement() : target instanceof JamPomTarget ? ((JamPomTarget) target).getJamElement() : target instanceof
DomTarget ? ((DomTarget) target).getDomElement() : null;
}
开发者ID:consulo,项目名称:consulo-javaee,代码行数:12,代码来源:JamCommonUtil.java
注:本文中的com.intellij.pom.PomTargetPsiElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论