mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extra frame variables provider
This commit is contained in:
committed by
Egor.Ushakov
parent
869ef34350
commit
cd5e327ad9
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2000-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 com.intellij.debugger.engine;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
|
||||
/**
|
||||
* Nikolay.Tropin
|
||||
* 2014-11-25
|
||||
*/
|
||||
public class JavaSimpleGetterProvider implements SimpleGetterProvider {
|
||||
@Override
|
||||
public boolean isSimpleGetter(PsiMethod method) {
|
||||
final PsiCodeBlock body = method.getBody();
|
||||
if(body == null){
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiStatement[] statements = body.getStatements();
|
||||
if(statements.length != 1){
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiStatement statement = statements[0];
|
||||
if(!(statement instanceof PsiReturnStatement)){
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiExpression value = ((PsiReturnStatement)statement).getReturnValue();
|
||||
if(!(value instanceof PsiReferenceExpression)){
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiReferenceExpression reference = (PsiReferenceExpression)value;
|
||||
final PsiExpression qualifier = reference.getQualifierExpression();
|
||||
//noinspection HardCodedStringLiteral
|
||||
if(qualifier != null && !"this".equals(qualifier.getText())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiElement referent = reference.resolve();
|
||||
if(referent == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!(referent instanceof PsiField)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((PsiField)referent).getContainingClass().equals(method.getContainingClass());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-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.
|
||||
@@ -489,44 +489,11 @@ public abstract class DebuggerUtils {
|
||||
return machine != null && machine.canGetSyntheticAttribute() && typeComponent.isSynthetic();
|
||||
}
|
||||
|
||||
public static boolean isSimpleGetter(PsiMethod method){
|
||||
final PsiCodeBlock body = method.getBody();
|
||||
if(body == null){
|
||||
return false;
|
||||
public static boolean isSimpleGetter(PsiMethod method) {
|
||||
for (SimpleGetterProvider provider : SimpleGetterProvider.EP_NAME.getExtensions()) {
|
||||
if (provider.isSimpleGetter(method)) return true;
|
||||
}
|
||||
|
||||
final PsiStatement[] statements = body.getStatements();
|
||||
if(statements.length != 1){
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiStatement statement = statements[0];
|
||||
if(!(statement instanceof PsiReturnStatement)){
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiExpression value = ((PsiReturnStatement)statement).getReturnValue();
|
||||
if(!(value instanceof PsiReferenceExpression)){
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiReferenceExpression reference = (PsiReferenceExpression)value;
|
||||
final PsiExpression qualifier = reference.getQualifierExpression();
|
||||
//noinspection HardCodedStringLiteral
|
||||
if(qualifier != null && !"this".equals(qualifier.getText())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiElement referent = reference.resolve();
|
||||
if(referent == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!(referent instanceof PsiField)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((PsiField)referent).getContainingClass().equals(method.getContainingClass());
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isPrimitiveType(final String typeName) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2000-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 com.intellij.debugger.engine;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.psi.*;
|
||||
|
||||
/**
|
||||
* Nikolay.Tropin
|
||||
* 2014-11-25
|
||||
*/
|
||||
interface SimpleGetterProvider {
|
||||
ExtensionPointName<SimpleGetterProvider> EP_NAME = ExtensionPointName.create("com.intellij.debugger.simpleGetterProvider");
|
||||
|
||||
boolean isSimpleGetter(PsiMethod method);
|
||||
}
|
||||
@@ -115,6 +115,9 @@
|
||||
<extensionPoint name="debugger.frameExtraVarsProvider"
|
||||
interface="com.intellij.debugger.engine.FrameExtraVariablesProvider"/>
|
||||
|
||||
<extensionPoint name="debugger.simpleGetterProvider"
|
||||
interface="com.intellij.debugger.engine.SimpleGetterProvider"/>
|
||||
|
||||
<extensionPoint name="allOverridingMethodsSearch" interface="com.intellij.util.QueryExecutor"/>
|
||||
<extensionPoint name="annotatedElementsSearch" interface="com.intellij.util.QueryExecutor"/>
|
||||
<extensionPoint name="annotatedPackagesSearch" interface="com.intellij.util.QueryExecutor"/>
|
||||
@@ -1455,6 +1458,7 @@
|
||||
<xdebugger.breakpointType implementation="com.intellij.debugger.ui.breakpoints.JavaExceptionBreakpointType"/>
|
||||
<xdebugger.breakpointType implementation="com.intellij.debugger.ui.breakpoints.JavaLineBreakpointType"/>
|
||||
<debugger.jvmSmartStepIntoHandler implementation="com.intellij.debugger.actions.JavaSmartStepIntoHandler"/>
|
||||
<debugger.simpleGetterProvider implementation="com.intellij.debugger.engine.JavaSimpleGetterProvider"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.remoteServer.runtime.deployment.debug.JavaDebuggerLauncher"
|
||||
serviceImplementation="com.intellij.remoteServer.impl.runtime.deployment.debug.JavaDebuggerLauncherImpl"/>
|
||||
|
||||
Reference in New Issue
Block a user