J2K: KtTypeCodeFragment.java

This commit is contained in:
Alexey Sedunov
2015-12-15 17:24:02 +03:00
parent 6fe48243c7
commit 24951e8a38
2 changed files with 14 additions and 19 deletions
@@ -14,25 +14,20 @@
* limitations under the License. * limitations under the License.
*/ */
package org.jetbrains.kotlin.psi; package org.jetbrains.kotlin.psi
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement
import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.KtNodeTypes
import org.jetbrains.kotlin.KtNodeTypes;
public class KtTypeCodeFragment extends KtCodeFragment { class KtTypeCodeFragment(
public KtTypeCodeFragment(Project project, String name, CharSequence text, PsiElement context) { project: Project,
super(project, name, text, null, KtNodeTypes.TYPE_CODE_FRAGMENT, context); name: String,
} text: CharSequence,
context: PsiElement?
) : KtCodeFragment(project, name, text, null, KtNodeTypes.TYPE_CODE_FRAGMENT, context) {
override fun getContentElement() = findChildByClass(KtTypeReference::class.java)
public boolean hasTypeReference() { val hasTypeReference: Boolean
return getContentElement() != null; get() = getContentElement() != null
}
@Nullable
@Override
public KtTypeReference getContentElement() {
return findChildByClass(KtTypeReference.class);
}
} }
@@ -449,6 +449,6 @@ public class KotlinChangeSignatureDialog(
} }
private fun hasTypeReference(codeFragment: PsiCodeFragment?): Boolean private fun hasTypeReference(codeFragment: PsiCodeFragment?): Boolean
= (codeFragment as? KtTypeCodeFragment)?.hasTypeReference() ?: false = (codeFragment as? KtTypeCodeFragment)?.hasTypeReference ?: false
} }
} }