import com.intellij.debugger.settings.NodeRendererSettings;
import com.intellij.debugger.ui.tree.FieldDescriptor;
import com.intellij.debugger.ui.tree.NodeDescriptor;
+import com.intellij.debugger.ui.tree.NodeDescriptorNameAdjuster;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.JavaPsiFacade;
@Override
public String getName() {
final String fieldName = myField.name();
- if (isOuterLocalVariableValue() && NodeRendererSettings.getInstance().getClassRenderer().SHOW_VAL_FIELDS_AS_LOCAL_VARIABLES) {
- return StringUtil.trimStart(fieldName, OUTER_LOCAL_VAR_FIELD_PREFIX);
+ NodeDescriptorNameAdjuster nameAdjuster = NodeDescriptorNameAdjuster.findFor(this);
+ if (nameAdjuster != null) {
+ return nameAdjuster.fixName(fieldName, this);
}
return fieldName;
}
--- /dev/null
+/*
+ * Copyright 2000-2015 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.ui.impl.watch;
+
+import com.intellij.debugger.settings.NodeRendererSettings;
+import com.intellij.debugger.ui.tree.NodeDescriptor;
+import com.intellij.debugger.ui.tree.NodeDescriptorNameAdjuster;
+import com.intellij.openapi.util.text.StringUtil;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Nikolay.Tropin
+ */
+public class FieldOuterLocalNameAdjuster extends NodeDescriptorNameAdjuster {
+
+ @Override
+ public boolean shouldApply(@NotNull NodeDescriptor descriptor) {
+ if (descriptor instanceof FieldDescriptorImpl && NodeRendererSettings.getInstance().getClassRenderer().SHOW_VAL_FIELDS_AS_LOCAL_VARIABLES) {
+ return ((FieldDescriptorImpl)descriptor).isOuterLocalVariableValue();
+ }
+ return false;
+ }
+
+ @Override
+ public String fixName(String name, @NotNull NodeDescriptor descriptor) {
+ return StringUtil.trimStart(name, FieldDescriptorImpl.OUTER_LOCAL_VAR_FIELD_PREFIX);
+ }
+}
import com.intellij.debugger.jdi.StackFrameProxyImpl;
import com.intellij.debugger.ui.tree.LocalVariableDescriptor;
import com.intellij.debugger.ui.tree.NodeDescriptor;
+import com.intellij.debugger.ui.tree.NodeDescriptorNameAdjuster;
import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiElementFactory;
@Override
public String getName() {
- return myLocalVariable.name();
+ String varName = myLocalVariable.name();
+ NodeDescriptorNameAdjuster nameAdjuster = NodeDescriptorNameAdjuster.findFor(this);
+ if (nameAdjuster != null) {
+ return nameAdjuster.fixName(varName, this);
+ }
+ return varName;
}
@Nullable
--- /dev/null
+/*
+ * Copyright 2000-2015 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.ui.tree;
+
+import com.intellij.openapi.extensions.ExtensionPointName;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Nikolay.Tropin
+ */
+public abstract class NodeDescriptorNameAdjuster {
+ public static ExtensionPointName<NodeDescriptorNameAdjuster> EP_NAME = ExtensionPointName.create("com.intellij.debugger.nodeNameAdjuster");
+
+ public abstract boolean shouldApply(@NotNull NodeDescriptor descriptor);
+
+ public abstract String fixName(String name, @NotNull NodeDescriptor descriptor);
+
+ public static NodeDescriptorNameAdjuster findFor(@NotNull NodeDescriptor descriptor) {
+ for (NodeDescriptorNameAdjuster adjuster:EP_NAME.getExtensions()) {
+ if (adjuster.shouldApply(descriptor)) return adjuster;
+ }
+ return null;
+ }
+}
<extensionPoint name="debugger.sourcePositionHighlighter"
interface="com.intellij.debugger.engine.SourcePositionHighlighter"/>
+ <extensionPoint name="debugger.nodeNameAdjuster"
+ interface="com.intellij.debugger.ui.tree.NodeDescriptorNameAdjuster"/>
+
+
<extensionPoint name="allOverridingMethodsSearch" interface="com.intellij.util.QueryExecutor"/>
<extensionPoint name="annotatedElementsSearch" interface="com.intellij.util.QueryExecutor"/>
<extensionPoint name="annotatedPackagesSearch" interface="com.intellij.util.QueryExecutor"/>
<debugger.nodeRenderer implementation="com.intellij.debugger.ui.tree.render.FileObjectRenderer"/>
<debugger.nodeRenderer implementation="com.intellij.debugger.ui.tree.render.StackTraceElementObjectRenderer"/>
+ <debugger.nodeNameAdjuster implementation="com.intellij.debugger.ui.impl.watch.FieldOuterLocalNameAdjuster"/>
+
<applicationService serviceInterface="com.intellij.remoteServer.runtime.deployment.debug.JavaDebuggerLauncher"
serviceImplementation="com.intellij.remoteServer.impl.runtime.deployment.debug.JavaDebuggerLauncherImpl"/>