avoid leaking of internal types
- use abstract superrole bound to a public interface
- avoid passing and even mentioning unused callin argument
- pass a string id instead of IPresentationContext
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptor.java
index c39d54d..15eb54c 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptor.java
@@ -34,6 +34,7 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
+import base org.eclipse.jdt.debug.core.IJavaStackFrame;
import base org.eclipse.jdt.internal.debug.core.model.JDIReferenceType;
import base org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
import base org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
@@ -71,17 +72,22 @@
return instance;
}
+ @SuppressWarnings("abstractrelevantrole")
+ protected abstract class AbstractOTJStackFrame playedBy IJavaStackFrame {
+ // store analyzed method kind between calls:
+ protected MethodKind kind= MethodKind.PLAIN;
+
+ abstract protected boolean isOTSpecialSrc();
+ abstract protected boolean isPurelyGenerated();
+ }
@SuppressWarnings("unchecked")
- protected class OTJStackFrame playedBy JDIStackFrame
+ protected class OTJStackFrame extends AbstractOTJStackFrame playedBy JDIStackFrame
{
// === imports: ===
boolean isStatic() -> boolean isStatic();
int modifiers() -> com.sun.jdi.Method getUnderlyingMethod()
with { result <- result.modifiers() }
- // store analyzed method kind between calls:
- protected MethodKind kind= MethodKind.PLAIN;
-
// == currently unused: ==
boolean isRole;
boolean isTeam;
@@ -306,7 +312,7 @@
* @param element stackframe
* @return symbolic color name or null.
*/
- public String getFrameColorName(JDIStackFrame as OTJStackFrame element) {
+ public String getFrameColorName(IJavaStackFrame as AbstractOTJStackFrame element) {
if (element.isPurelyGenerated())
return OTDebugUIPlugin.PREF_OT_GENERATED_CODE_COLOR;
if (element.isOTSpecialSrc())
@@ -327,7 +333,7 @@
}
/** Final embellishment of a label after everything has been analyzed. */
- public String postProcess(JDIStackFrame as OTJStackFrame stackFrame, String labelText)
+ public String postProcess(IJavaStackFrame as AbstractOTJStackFrame stackFrame, String labelText)
{
if (stackFrame.kind == MethodKind.INITIAL) // this we didn't know when creating the label text
return labelText.replace(DebugUIMessages.JDIModelPresentation_line__76+' '+DebugUIMessages.JDIModelPresentation_not_available,
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptorActivator.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptorActivator.java
index 66f988c..e6aa084 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptorActivator.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/PresentationAdaptorActivator.java
@@ -21,7 +21,7 @@
import org.eclipse.objectteams.otdt.debug.ui.OTDebugUIPlugin;
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
+import org.eclipse.jdt.debug.core.IJavaStackFrame;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jface.text.source.Annotation;
@@ -91,8 +91,8 @@
String result;
within (adaptor)
result = base.getStackFrameText(stackFrame);
- if (stackFrame instanceof JDIStackFrame)
- result = adaptor.postProcess((JDIStackFrame)stackFrame, result);
+ if (stackFrame instanceof IJavaStackFrame)
+ result = adaptor.postProcess((IJavaStackFrame)stackFrame, result);
return result;
}
@@ -100,9 +100,9 @@
base when (LaunchUtils.isOTLaunch(element));
@SuppressWarnings("basecall")
callin Color getForeground(Object element) {
- if (element instanceof JDIStackFrame) {
+ if (element instanceof IJavaStackFrame) {
PresentationAdaptor adaptor = PresentationAdaptor.getInstance();
- String colorName= adaptor.getFrameColorName((JDIStackFrame)element);
+ String colorName= adaptor.getFrameColorName((IJavaStackFrame)element);
if (colorName != null)
return OTDebugUIPlugin.getPreferenceColor(colorName);
}
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/VariablesViewAdaptor.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/VariablesViewAdaptor.java
index a5fe013..34a864c 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/VariablesViewAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/VariablesViewAdaptor.java
@@ -25,7 +25,6 @@
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jdt.debug.core.IJavaFieldVariable;
import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
@@ -52,19 +51,18 @@
/** Adapt the content provider for root elements of the variables view. */
protected class StackFrameContentProvider playedBy StackFrameContentProvider {
- Object[] getAllChildren(Object parent, IPresentationContext context, IViewerUpdate monitor)
- <- replace Object[] getAllChildren(Object parent, IPresentationContext context, IViewerUpdate monitor);
+ getAllChildren <- replace getAllChildren;
- callin Object[] getAllChildren(Object parent, IPresentationContext context, IViewerUpdate monitor)
+ callin Object[] getAllChildren(Object parent, IPresentationContext context)
throws CoreException
{
- Object[] rawChildren = base.getAllChildren(parent, context, monitor);
+ Object[] rawChildren = base.getAllChildren(parent, context);
if (!context.getId().equals(IDebugUIConstants.ID_VARIABLE_VIEW))
return rawChildren;
// is filtering needed?
- if (ShowOTInternalVariablesAction.includeOTInternal(context))
+ if (ShowOTInternalVariablesAction.includeOTInternal(context.getId()))
return rawChildren;
// at this point always filter internals, but toplevel never has statics to filter:
@@ -85,7 +83,7 @@
Object[] rawChildren = base.getValueChildren(parent, value, context);
// is filtering needed?
- boolean filterOTInternals = ! ShowOTInternalVariablesAction.includeOTInternal(context);
+ boolean filterOTInternals = ! ShowOTInternalVariablesAction.includeOTInternal(context.getId());
// TeamView constantly filters statics:
boolean filterStatics = context.getId().equals(OTDebugUIPlugin.TEAM_VIEW_ID);
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/actions/ShowOTInternalVariablesAction.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/actions/ShowOTInternalVariablesAction.java
index f0643d6..ce30d12 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/actions/ShowOTInternalVariablesAction.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/actions/ShowOTInternalVariablesAction.java
@@ -56,9 +56,9 @@
return getCompositeKey();
}
- public static boolean includeOTInternal(IPresentationContext context){
+ public static boolean includeOTInternal(String contextId){
IPreferenceStore store = OTDebugAdaptorPlugin.getDefault().getPreferenceStore();
- String key = context.getId() + "." + PreferenceInitializer.PREF_SHOW_OTINTERNAL_VARIABLES; //$NON-NLS-1$
+ String key = contextId + "." + PreferenceInitializer.PREF_SHOW_OTINTERNAL_VARIABLES; //$NON-NLS-1$
return store.getBoolean(key);
}
}