android-ide-plugin module extracted
This commit is contained in:
committed by
Yan Zhulanow
parent
1e70369cf8
commit
1f10ab21ac
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="kotlin-runtime" level="project" />
|
||||
<orderEntry type="module" module-name="android-compiler-plugin" exported="" />
|
||||
<orderEntry type="library" exported="" scope="PROVIDED" name="android" level="project" />
|
||||
<orderEntry type="library" exported="" scope="TEST" name="android_tests" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="idea-full" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<gotoDeclarationHandler implementation="org.jetbrains.jet.plugin.android.AndroidGotoDeclarationHandler"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -0,0 +1,18 @@
|
||||
<idea-plugin version="2" url="http://kotlin.jetbrains.org">
|
||||
<id>org.jetbrains.kotlin.android</id>
|
||||
|
||||
<name>Kotlin Extensions For Android</name>
|
||||
<description>Various extensions facilitating Android development in Kotlin</description>
|
||||
<version>@snapshot@</version>
|
||||
<vendor url="http://www.jetbrains.com">JetBrains Inc.</vendor>
|
||||
|
||||
<idea-version since-build="138.977" until-build="138.9999"/>
|
||||
|
||||
<depends optional="false">org.jetbrains.kotlin</depends>
|
||||
<depends optional="false" config-file="android.xml">org.jetbrains.android</depends>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<projectService serviceInterface="org.jetbrains.jet.lang.resolve.android.AndroidUIXmlProcessor"
|
||||
serviceImplementation="org.jetbrains.jet.plugin.android.IDEAndroidUIXmlProcessor"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.android
|
||||
|
||||
import com.intellij.codeInsight.navigation.actions.GotoDeclarationHandler
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import org.jetbrains.jet.lang.resolve.android.AndroidUIXmlProcessor
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||
import org.jetbrains.jet.plugin.references.JetSimpleNameReference
|
||||
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression
|
||||
import org.jetbrains.jet.lang.psi.JetProperty
|
||||
import com.intellij.psi.impl.light.LightElement
|
||||
import com.intellij.psi.xml.XmlAttribute
|
||||
import org.jetbrains.jet.lang.resolve.android.isRClassField
|
||||
import com.intellij.psi.PsiField
|
||||
|
||||
public class AndroidGotoDeclarationHandler : GotoDeclarationHandler {
|
||||
override fun getGotoDeclarationTargets(sourceElement: PsiElement?, offset: Int, editor: Editor?): Array<PsiElement>? {
|
||||
if (sourceElement is LeafPsiElement && sourceElement.getParent() is JetSimpleNameExpression) {
|
||||
val resolved = JetSimpleNameReference(sourceElement.getParent() as JetSimpleNameExpression).resolve()
|
||||
if (resolved == null) return null
|
||||
val name = if (resolved is JetProperty) {
|
||||
resolved.getName()
|
||||
}
|
||||
else if (isRClassField(resolved)) {
|
||||
(resolved as PsiField).getName()
|
||||
}
|
||||
else null
|
||||
if (name != null) {
|
||||
val parser = ServiceManager.getService(sourceElement.getProject(), javaClass<AndroidUIXmlProcessor>())
|
||||
val psiElement = parser?.resourceManager?.idToXmlAttribute(name) as? XmlAttribute
|
||||
if (psiElement != null) {
|
||||
return array(psiElement.getValueElement()!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getActionText(context: DataContext?): String? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.android
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.refactoring.rename.RenamePsiElementProcessor
|
||||
import org.jetbrains.jet.asJava.*
|
||||
import org.jetbrains.jet.lang.psi.JetProperty
|
||||
import org.jetbrains.jet.lang.resolve.android.isAndroidSyntheticElement
|
||||
import com.intellij.openapi.components.ServiceManager
|
||||
import org.jetbrains.jet.lang.resolve.android.AndroidUIXmlProcessor
|
||||
import com.intellij.psi.search.SearchScope
|
||||
import com.intellij.psi.xml.XmlAttributeValue
|
||||
import org.jetbrains.android.dom.wrappers.LazyValueResourceElementWrapper
|
||||
import org.jetbrains.android.util.AndroidResourceUtil
|
||||
import com.intellij.psi.xml.XmlAttribute
|
||||
import com.intellij.psi.impl.light.LightElement
|
||||
import org.jetbrains.jet.lang.resolve.android.isRClassField
|
||||
|
||||
public class AndroidRenameProcessor : RenamePsiElementProcessor() {
|
||||
override fun canProcessElement(element: PsiElement): Boolean {
|
||||
// either renaming synthetic property, or value in ui xml, or R class field
|
||||
return (element.namedUnwrappedElement is JetProperty &&
|
||||
isAndroidSyntheticElement(element.namedUnwrappedElement)) || element is XmlAttributeValue ||
|
||||
isRClassField(element)
|
||||
}
|
||||
|
||||
override fun prepareRenaming(element: PsiElement?, newName: String?, allRenames: MutableMap<PsiElement, String>, scope: SearchScope) {
|
||||
if (element?.namedUnwrappedElement is JetProperty) {
|
||||
renameSyntheticProperty(element!!.namedUnwrappedElement as JetProperty, newName, allRenames, scope)
|
||||
}
|
||||
else if (element is XmlAttributeValue) {
|
||||
renameAttributeValue(element, newName, allRenames, scope)
|
||||
}
|
||||
else if (element is LightElement) {
|
||||
renameLightClassField(element, newName, allRenames, scope)
|
||||
}
|
||||
}
|
||||
|
||||
private fun renameSyntheticProperty(jetProperty: JetProperty, newName: String?, allRenames: MutableMap<PsiElement, String>, scope: SearchScope) {
|
||||
val oldName = jetProperty.getName()!!
|
||||
val processor = ServiceManager.getService(jetProperty.getProject(), javaClass<AndroidUIXmlProcessor>())
|
||||
val resourceManager = processor!!.resourceManager
|
||||
val attr = resourceManager.idToXmlAttribute(oldName) as XmlAttribute
|
||||
allRenames[XmlAttributeValueWrapper(attr.getValueElement()!!)] = resourceManager.nameToIdDeclaration(newName!!)
|
||||
val name = AndroidResourceUtil.getResourceNameByReferenceText(newName)
|
||||
for (resField in AndroidResourceUtil.findIdFields(attr)) {
|
||||
allRenames.put(resField, AndroidResourceUtil.getFieldNameByResourceName(name!!))
|
||||
}
|
||||
}
|
||||
|
||||
private fun renameAttributeValue(attribute: XmlAttributeValue, newName: String?, allRenames: MutableMap<PsiElement, String>, scope: SearchScope) {
|
||||
val element1 = LazyValueResourceElementWrapper.computeLazyElement(attribute);
|
||||
val processor = ServiceManager.getService(attribute.getProject(), javaClass<AndroidUIXmlProcessor>())
|
||||
if (element1 == null) return
|
||||
val oldPropName = AndroidResourceUtil.getResourceNameByReferenceText(attribute.getValue()!!)
|
||||
val newPropName = processor!!.resourceManager.idToName(newName!!)
|
||||
renameSyntheticProperties(allRenames, newPropName, oldPropName, processor)
|
||||
}
|
||||
|
||||
private fun renameSyntheticProperties(allRenames: MutableMap<PsiElement, String>, newPropName: String, oldPropName: String?, processor: AndroidUIXmlProcessor) {
|
||||
val props = processor.lastCachedPsi?.findChildrenByClass(javaClass<JetProperty>())
|
||||
val matchedProps = props?.filter { it.getName() == oldPropName } ?: arrayListOf()
|
||||
for (prop in matchedProps) {
|
||||
allRenames[prop] = newPropName
|
||||
}
|
||||
}
|
||||
|
||||
private fun renameLightClassField(field: LightElement, newName: String?, allRenames: MutableMap<PsiElement, String>, scope: SearchScope) {
|
||||
val oldName = field.getName()!!
|
||||
val processor = ServiceManager.getService(field.getProject(), javaClass<AndroidUIXmlProcessor>())
|
||||
renameSyntheticProperties(allRenames, newName!!, oldName, processor!!)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.android
|
||||
|
||||
import com.intellij.psi.XmlElementVisitor
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.xml.XmlElement
|
||||
import com.intellij.psi.xml.XmlTag
|
||||
import com.intellij.psi.xml.XmlAttribute
|
||||
import org.jetbrains.jet.lang.resolve.android.AndroidResourceManager
|
||||
|
||||
class AndroidXmlVisitor(val resourceManager: AndroidResourceManager, val elementCallback: (String, String, XmlAttribute) -> Unit) : XmlElementVisitor() {
|
||||
|
||||
override fun visitElement(element: PsiElement) {
|
||||
element.acceptChildren(this)
|
||||
}
|
||||
|
||||
override fun visitXmlElement(element: XmlElement?) {
|
||||
element?.acceptChildren(this)
|
||||
}
|
||||
|
||||
override fun visitXmlTag(tag: XmlTag?) {
|
||||
val attribute = tag?.getAttribute(resourceManager.idAttribute)
|
||||
if (attribute != null && attribute.getValue() != null) {
|
||||
val classNameAttr = tag?.getAttribute(resourceManager.classAttributeNoNamespace)?.getValue() ?: tag?.getLocalName()
|
||||
elementCallback(resourceManager.idToName(attribute.getValue()), classNameAttr!!, attribute)
|
||||
}
|
||||
tag?.acceptChildren(this)
|
||||
}
|
||||
}
|
||||
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.android
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.jet.lang.resolve.android.AndroidResourceManagerBase
|
||||
import com.intellij.psi.PsiElement
|
||||
import java.util.HashMap
|
||||
import com.intellij.psi.xml.XmlAttribute
|
||||
import com.intellij.psi.PsiFile
|
||||
import org.jetbrains.android.facet.AndroidFacet
|
||||
import org.jetbrains.jet.lang.resolve.android.AndroidManifest
|
||||
import com.intellij.openapi.module.ModuleManager
|
||||
import java.util.ArrayList
|
||||
|
||||
public class IDEAndroidResourceManager(project: Project, searchPath: String?) : AndroidResourceManagerBase(project, searchPath) {
|
||||
|
||||
private class NoAndroidFacetException: Exception("No android facet found in project")
|
||||
|
||||
override fun getLayoutXmlFiles(): Collection<PsiFile> {
|
||||
try {
|
||||
val facet = getAndroidFacet()
|
||||
return facet.getAllResourceDirectories() flatMap { it.findChild("layout")?.getChildren()!! map { vritualFileToPsi(it)!! } }
|
||||
} catch (e: NoAndroidFacetException) {
|
||||
return ArrayList(0)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getAndroidFacet(): AndroidFacet {
|
||||
for (module in ModuleManager.getInstance(project).getModules()) {
|
||||
val facet = AndroidFacet.getInstance(module)
|
||||
if (facet != null) return facet
|
||||
}
|
||||
throw NoAndroidFacetException()
|
||||
}
|
||||
|
||||
override fun readManifest(): AndroidManifest {
|
||||
val facet = getAndroidFacet()
|
||||
val attributeValue = facet.getManifest()!!.getPackage()
|
||||
return AndroidManifest(attributeValue!!.getRawText()!!)
|
||||
}
|
||||
|
||||
override fun idToXmlAttribute(id: String): PsiElement? {
|
||||
var ret: PsiElement? = null
|
||||
for (file in getLayoutXmlFiles()) {
|
||||
file.accept(AndroidXmlVisitor(this, { retId, wClass, valueElement ->
|
||||
if (retId == id) ret = valueElement
|
||||
}))
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.android
|
||||
|
||||
import org.jetbrains.jet.lang.resolve.android.AndroidUIXmlProcessor
|
||||
import com.intellij.openapi.project.Project
|
||||
import java.util.ArrayList
|
||||
import com.intellij.psi.PsiFile
|
||||
import org.jetbrains.jet.lang.resolve.android.AndroidWidget
|
||||
import org.jetbrains.jet.lang.resolve.android.KotlinStringWriter
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import org.jetbrains.jet.lang.resolve.android.CliAndroidResourceManager
|
||||
import org.jetbrains.jet.lang.resolve.android.AndroidResourceManager
|
||||
|
||||
class IDEAndroidUIXmlProcessor(project: Project) : AndroidUIXmlProcessor(project) {
|
||||
override val searchPath: String? = project.getBasePath() + "/res/layout/"
|
||||
override var androidAppPackage: String = ""
|
||||
get() = resourceManager.readManifest()._package
|
||||
|
||||
override val resourceManager: IDEAndroidResourceManager = IDEAndroidResourceManager(project, searchPath)
|
||||
|
||||
override fun parseSingleFileImpl(file: PsiFile): String {
|
||||
val ids: MutableCollection<AndroidWidget> = ArrayList()
|
||||
file.accept(AndroidXmlVisitor(resourceManager, { id, wClass, valueElement ->
|
||||
ids.add(AndroidWidget(id, wClass))
|
||||
}))
|
||||
return produceKotlinProperties(KotlinStringWriter(), ids).toString()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.android;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
|
||||
public class TestConst {
|
||||
public static final Key<String> TESTDATA_PATH = Key.create("");
|
||||
}
|
||||
+455
@@ -0,0 +1,455 @@
|
||||
/*
|
||||
* Copyright 2010-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.plugin.android;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.navigation.NavigationItem;
|
||||
import com.intellij.navigation.PsiElementNavigationItem;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.meta.PsiMetaOwner;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.PsiElementProcessor;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.xml.XmlAttributeValue;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: Eugene.Kudelevsky
|
||||
* Date: Aug 6, 2009
|
||||
* Time: 7:08:02 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
|
||||
public class XmlAttributeValueWrapper implements XmlAttributeValue, PsiNamedElement, PsiElementNavigationItem {
|
||||
private final XmlAttributeValue myWrappee;
|
||||
private final String myFileName;
|
||||
private final String myDirName;
|
||||
|
||||
public XmlAttributeValueWrapper(@NotNull XmlAttributeValue wrappeeElement) {
|
||||
if (!(wrappeeElement instanceof NavigationItem)) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (!(wrappeeElement instanceof PsiMetaOwner)) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
myWrappee = wrappeeElement;
|
||||
final PsiFile file = getContainingFile();
|
||||
myFileName = file != null ? file.getName() : null;
|
||||
final PsiDirectory dir = file != null ? file.getContainingDirectory() : null;
|
||||
myDirName = dir != null ? dir.getName() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Project getProject() throws PsiInvalidElementAccessException {
|
||||
return myWrappee.getProject();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Language getLanguage() {
|
||||
return myWrappee.getLanguage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiManager getManager() {
|
||||
return myWrappee.getManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiElement[] getChildren() {
|
||||
return myWrappee.getChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getParent() {
|
||||
return myWrappee.getParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement getFirstChild() {
|
||||
return myWrappee.getFirstChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement getLastChild() {
|
||||
return myWrappee.getLastChild();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement getNextSibling() {
|
||||
return myWrappee.getNextSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement getPrevSibling() {
|
||||
return myWrappee.getPrevSibling();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiFile getContainingFile() throws PsiInvalidElementAccessException {
|
||||
return myWrappee.getContainingFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextRange getTextRange() {
|
||||
return myWrappee.getTextRange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartOffsetInParent() {
|
||||
return myWrappee.getStartOffsetInParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextLength() {
|
||||
return myWrappee.getTextLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement findElementAt(int offset) {
|
||||
return myWrappee.findElementAt(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiReference findReferenceAt(int offset) {
|
||||
return myWrappee.findReferenceAt(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextOffset() {
|
||||
return myWrappee.getTextOffset();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public String getText() {
|
||||
return myWrappee.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public char[] textToCharArray() {
|
||||
return myWrappee.textToCharArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getNavigationElement() {
|
||||
return myWrappee.getNavigationElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getOriginalElement() {
|
||||
return myWrappee.getOriginalElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean textMatches(@NotNull @NonNls CharSequence text) {
|
||||
return myWrappee.textMatches(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean textMatches(@NotNull PsiElement element) {
|
||||
return myWrappee.textMatches(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean textContains(char c) {
|
||||
return myWrappee.textContains(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
myWrappee.accept(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptChildren(@NotNull PsiElementVisitor visitor) {
|
||||
myWrappee.acceptChildren(visitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement copy() {
|
||||
return myWrappee.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement add(@NotNull PsiElement element) throws IncorrectOperationException {
|
||||
return myWrappee.add(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement addBefore(@NotNull PsiElement element, PsiElement anchor) throws IncorrectOperationException {
|
||||
return myWrappee.addBefore(element, anchor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement addAfter(@NotNull PsiElement element, PsiElement anchor) throws IncorrectOperationException {
|
||||
return myWrappee.addAfter(element, anchor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkAdd(@NotNull PsiElement element) throws IncorrectOperationException {
|
||||
myWrappee.checkAdd(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement addRange(PsiElement first, PsiElement last) throws IncorrectOperationException {
|
||||
return myWrappee.addRange(first, last);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement addRangeBefore(@NotNull PsiElement first, @NotNull PsiElement last, PsiElement anchor)
|
||||
throws IncorrectOperationException {
|
||||
return myWrappee.addRangeBefore(first, last, anchor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement addRangeAfter(PsiElement first, PsiElement last, PsiElement anchor) throws IncorrectOperationException {
|
||||
return myWrappee.addRangeAfter(first, last, anchor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete() throws IncorrectOperationException {
|
||||
myWrappee.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkDelete() throws IncorrectOperationException {
|
||||
myWrappee.checkDelete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteChildRange(PsiElement first, PsiElement last) throws IncorrectOperationException {
|
||||
myWrappee.deleteChildRange(first, last);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement replace(@NotNull PsiElement newElement) throws IncorrectOperationException {
|
||||
return myWrappee.replace(newElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return myWrappee.isValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWritable() {
|
||||
return myWrappee.isWritable();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiReference getReference() {
|
||||
return myWrappee.getReference();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiReference[] getReferences() {
|
||||
return myWrappee.getReferences();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T> T getCopyableUserData(Key<T> key) {
|
||||
return myWrappee.getCopyableUserData(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void putCopyableUserData(Key<T> key, T value) {
|
||||
myWrappee.putCopyableUserData(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processDeclarations(
|
||||
@NotNull PsiScopeProcessor processor,
|
||||
@NotNull ResolveState state,
|
||||
@Nullable PsiElement lastParent,
|
||||
@NotNull PsiElement place
|
||||
) {
|
||||
return myWrappee.processDeclarations(processor, state, lastParent, place);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement getContext() {
|
||||
return myWrappee.getContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPhysical() {
|
||||
return myWrappee.isPhysical();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public GlobalSearchScope getResolveScope() {
|
||||
return myWrappee.getResolveScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public SearchScope getUseScope() {
|
||||
return myWrappee.getUseScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ASTNode getNode() {
|
||||
return myWrappee.getNode();
|
||||
}
|
||||
|
||||
@NonNls
|
||||
public String toString() {
|
||||
return myWrappee.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEquivalentTo(PsiElement another) {
|
||||
return myWrappee == another || myWrappee.isEquivalentTo(another);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
XmlAttributeValueWrapper that = (XmlAttributeValueWrapper) o;
|
||||
|
||||
if (!myWrappee.equals(that.myWrappee)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return myWrappee.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getUserData(@NotNull Key<T> key) {
|
||||
return myWrappee.getUserData(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void putUserData(@NotNull Key<T> key, @Nullable T value) {
|
||||
myWrappee.putUserData(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int flags) {
|
||||
return myWrappee.getIcon(flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ((NavigationItem) myWrappee).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException {
|
||||
XmlAttribute attribute = (XmlAttribute) myWrappee.getParent();
|
||||
attribute.setValue(name);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemPresentation getPresentation() {
|
||||
return new ItemPresentation() {
|
||||
@Override
|
||||
@Nullable
|
||||
public String getPresentableText() {
|
||||
String name = ((NavigationItem) myWrappee).getName();
|
||||
if (myDirName == null || myFileName == null) {
|
||||
return name;
|
||||
}
|
||||
return name + " (..." + File.separatorChar + myDirName +
|
||||
File.separatorChar + myFileName + ')';
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocationString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(boolean open) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigate(boolean requestFocus) {
|
||||
((NavigationItem) myWrappee).navigate(requestFocus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNavigate() {
|
||||
return ((NavigationItem) myWrappee).canNavigate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNavigateToSource() {
|
||||
return ((NavigationItem) myWrappee).canNavigateToSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return myWrappee.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextRange getValueTextRange() {
|
||||
return myWrappee.getValueTextRange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean processElements(PsiElementProcessor processor, PsiElement place) {
|
||||
return myWrappee.processElements(processor, place);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement getTargetElement() {
|
||||
return myWrappee;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user