mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[by peter:] get quick doc info from the place-specific documentation provider; DomChildrenDescription<: PomTarget
This commit is contained in:
+1
-1
@@ -753,7 +753,7 @@ public class DocumentationManager {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static DocumentationProvider getProviderFromElement(@Nullable PsiElement element, @Nullable PsiElement originalElement) {
|
||||
public static DocumentationProvider getProviderFromElement(@Nullable PsiElement element, @Nullable PsiElement originalElement) {
|
||||
if (element != null && !element.isValid()) {
|
||||
element = null;
|
||||
}
|
||||
|
||||
@@ -223,8 +223,8 @@ public class CtrlMouseHandler extends AbstractProjectComponent {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String generateInfo(PsiElement element) {
|
||||
final DocumentationProvider documentationProvider = DocumentationManager.getProviderFromElement(element);
|
||||
private static String generateInfo(PsiElement element, PsiElement atPointer) {
|
||||
final DocumentationProvider documentationProvider = DocumentationManager.getProviderFromElement(element, atPointer);
|
||||
|
||||
String info = documentationProvider.getQuickNavigateInfo(element);
|
||||
if (info != null) {
|
||||
@@ -305,7 +305,7 @@ public class CtrlMouseHandler extends AbstractProjectComponent {
|
||||
@Nullable
|
||||
public String getInfo() {
|
||||
try {
|
||||
return generateInfo(myTargetElement);
|
||||
return generateInfo(myTargetElement, myElementAtPointer);
|
||||
}
|
||||
catch (IndexNotReadyException e) {
|
||||
showDumbModeNotification(myTargetElement.getProject());
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.psi.impl;
|
||||
|
||||
import com.intellij.ide.IconProvider;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.pom.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -164,6 +165,14 @@ public class PomTargetPsiElementImpl extends RenameableFakePsiElement implements
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Language getLanguage() {
|
||||
if (myTarget instanceof PsiTarget) {
|
||||
return ((PsiTarget)myTarget).getNavigationElement().getLanguage();
|
||||
}
|
||||
return Language.ANY;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Project getProject() {
|
||||
|
||||
@@ -21,6 +21,25 @@ public abstract class DomChildDescriptionImpl extends AbstractDomChildDescriptio
|
||||
myTagName = tagName;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return myTagName.getLocalName();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void navigate(boolean requestFocus) {
|
||||
}
|
||||
|
||||
public boolean canNavigate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canNavigateToSource() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getXmlElementName() {
|
||||
return myTagName.getLocalName();
|
||||
|
||||
@@ -17,9 +17,9 @@ package com.intellij.xml.impl.dom;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.pom.references.PomService;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.FakePsiElement;
|
||||
import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.xml.XmlDocument;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
@@ -204,11 +204,7 @@ public class DomElementXmlDescriptor implements XmlElementDescriptor {
|
||||
|
||||
if (declaration != null) return declaration.getXmlElement();
|
||||
|
||||
return new FakePsiElement() {
|
||||
public PsiElement getParent() {
|
||||
return DomUtil.getFile(mySomeElement);
|
||||
}
|
||||
};
|
||||
return PomService.convertToPsi(myManager.getProject(), myChildrenDescription);
|
||||
}
|
||||
|
||||
@NonNls
|
||||
@@ -255,6 +251,25 @@ public class DomElementXmlDescriptor implements XmlElementDescriptor {
|
||||
myDomElement = domElement;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return getXmlElementName();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void navigate(boolean requestFocus) {
|
||||
}
|
||||
|
||||
public boolean canNavigate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canNavigateToSource() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public XmlName getXmlName() {
|
||||
throw new UnsupportedOperationException("Method getXmlName not implemented in " + getClass());
|
||||
@@ -304,4 +319,5 @@ public class DomElementXmlDescriptor implements XmlElementDescriptor {
|
||||
throw new UnsupportedOperationException("Method getAnnotation not implemented in " + getClass());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.util.xml.reflect;
|
||||
|
||||
import com.intellij.pom.PomNamedTarget;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomNameStrategy;
|
||||
import com.intellij.util.xml.XmlName;
|
||||
@@ -23,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public interface DomChildrenDescription extends AbstractDomChildrenDescription {
|
||||
public interface DomChildrenDescription extends AbstractDomChildrenDescription, PomNamedTarget {
|
||||
|
||||
@NotNull
|
||||
XmlName getXmlName();
|
||||
|
||||
Reference in New Issue
Block a user