Unverified Commit f2751c2c authored by Neil C Smith's avatar Neil C Smith Committed by GitHub
Browse files

Merge pull request #2715 from apache/delivery

Sync delivery to release123 for 12.3 Beta 2
parents 5a5be189 3819880b
......@@ -150,6 +150,8 @@ implements ProjectFactory, PropertyChangeListener, Runnable {
return false;
}
relative = relative.substring(pos);
if (relative.contains("*")) {
for (String segment : relative.split("/")) {
FOUND: if (segment.contains("*")) {
......
......@@ -43,6 +43,20 @@ public class FeatureProjectFactoryTest {
assertTrue(isProject(yes1, relative));
}
@Test
public void recognizeParentPath() throws IOException {
FileObject root = FileUtil.createMemoryFileSystem().getRoot();
FileObject src = FileUtil.createFolder(root, "src");
FileObject marker = FileUtil.createFolder(src, "marker");
FileObject other = FileUtil.createFolder(src, "other");
final String relative = "../marker";
assertFalse(isProject(src, relative));
assertTrue(isProject(marker, relative));
assertTrue(isProject(other, relative));
}
private static FileObject prj(FileObject root, String base, String mx, String file) throws IOException {
return root.createFolder(base).createFolder(mx).createData(file).getParent().getParent();
}
......
......@@ -57,7 +57,7 @@ public class StandardPropertiesHelpResolver extends HelpResolver {
private static final String W3C_SPEC_URL_PREFIX = "http://www.w3.org/TR/"; //NOI18N
private static final String MODULE_ARCHIVE_PATH = "www.w3.org/TR/"; //NOI18N
private static final String INDEX_HTML_FILE_NAME = "index.html"; //NOI18N
private static final String NO_HELP_MSG = NbBundle.getMessage(StandardPropertiesHelpResolver.class, "completion-help-no-documentation-found");
@Override
......@@ -171,24 +171,8 @@ public class StandardPropertiesHelpResolver extends HelpResolver {
} else {
//no pattern found, likely a bit different source
LOGGER.warning(String.format("No property anchor section pattern found for property '%s'", property.getName())); //NOI18N
//strip the <style>...</style> section from the source since it causes a garbage in the swingbrowser
int styleSectionStart = urlContent.indexOf("<style type=\"text/css\">"); //NOI18N
if(styleSectionStart >= 0) {
final String styleEndTag = "</style>"; //NOI18N
int styleSectionEnd = urlContent.indexOf(styleEndTag, styleSectionStart);
if(styleSectionEnd >= 0) {
StringBuilder buf = new StringBuilder();
buf.append(urlContent.subSequence(0, styleSectionStart));
buf.append(urlContent.subSequence(styleSectionEnd + styleEndTag.length(), urlContent.length()));
return buf.toString();
}
}
return urlContent;
LOGGER.warning(String.format("No property anchor section pattern found for property '%s'", propertyUrl)); //NOI18N
return NO_HELP_MSG;
}
} catch (MalformedURLException ex) {
LOGGER.log(Level.WARNING, null, ex);
......
......@@ -62,7 +62,8 @@ import org.openide.xml.XMLUtil;
public class HtmlCompletionItem implements CompletionItem {
protected static final int DEFAULT_SORT_PRIORITY = 20;
private static final String END_FONT = "</font>"; // NOI18N
//----------- Factory methods --------------
public static HtmlCompletionItem createTag(HtmlTag tag, String name, int substitutionOffset, String helpId, boolean possible) {
return new Tag(tag, name, substitutionOffset, helpId, possible);
......@@ -110,7 +111,8 @@ public class HtmlCompletionItem implements CompletionItem {
public static HtmlCompletionItem createFileCompletionItem(FileObject file, int substitutionOffset) {
boolean folder = file.isFolder();
String name = new StringBuilder().append(file.getNameExt()).append(folder ? '/' : "").toString();
Color color = folder ? Color.BLUE : null;
// Should match color in o.n.m.web.common.ui.api.FileReferenceCompletion.getItems()
Color color = folder ? new Color(224, 160, 65) : null;
ImageIcon icon = FileReferenceCompletion.getIcon(file);
return new FileAttributeValue(folder, name, substitutionOffset, color, icon);
......@@ -422,7 +424,7 @@ public class HtmlCompletionItem implements CompletionItem {
= ImageUtilities.loadImageIcon("org/netbeans/modules/html/editor/resources/mathml.png", false); // NOI18N
private static final Color GRAY_COLOR = Color.GRAY;
private static final Color DEFAULT_FG_COLOR = new Color(0, 0, 0xFF);
private static final Color DEFAULT_FG_COLOR = new Color(64, 64, 217);
private boolean possible;
private HtmlTag tag;
......@@ -455,19 +457,19 @@ public class HtmlCompletionItem implements CompletionItem {
@Override
protected String getLeftHtmlText() {
Color tagColor = possible ? DEFAULT_FG_COLOR : GRAY_COLOR;
boolean isPossibleHtmlTag = possible && tag != null && tag.getTagClass() == HtmlTagType.HTML;
StringBuilder b = new StringBuilder();
if (possible) {
b.append("<font color=#");
b.append(hexColorCode(DEFAULT_FG_COLOR));
b.append(">&lt;");
b.append(getItemText());
b.append("&gt;</font>");
} else {
b.append("<font color=#");
b.append(hexColorCode(GRAY_COLOR));
b.append(">&lt;");
b.append(getItemText());
b.append("&gt;</font>");
if (isPossibleHtmlTag) {
b.append("<b>");
}
b.append(getHtmlColor(tagColor));
b.append("&lt;"); // NO18N
b.append(getItemText());
b.append("&gt;"); // NOI18N
b.append(END_FONT);
if (isPossibleHtmlTag) {
b.append("</b>");
}
return b.toString();
}
......@@ -570,7 +572,7 @@ public class HtmlCompletionItem implements CompletionItem {
@Override
protected String getLeftHtmlText() {
return (type.bold ? "<b>" : "") + //NOI18N
"<font color=#" + hexColorCode(type.color) + ">&lt;/" + getItemText() + "&gt;</font>" + //NOI18N
getHtmlColor(type.color) + "&lt;/" + getItemText() + "&gt;" + END_FONT + //NOI18N
(type.bold ? "</b>" : ""); //NOI18N
}
......@@ -634,11 +636,11 @@ public class HtmlCompletionItem implements CompletionItem {
strVal = Character.toString(value);
}
return new StringBuilder()
.append("<b><font color=#")
.append(hexColorCode(FG))
.append(">")
.append("<b>") // NOI18N
.append(getHtmlColor(FG))
.append(strVal)
.append("</font></b>").toString(); //NOI18N
.append(END_FONT)
.append("</b>").toString(); // NOI18N
}
}
......@@ -738,11 +740,9 @@ public class HtmlCompletionItem implements CompletionItem {
if (required) {
sb.append("<b>"); //NOI18N
}
sb.append("<font color=#"); //NOI18N
sb.append(hexColorCode(getAttributeColor()));
sb.append(">"); //NOI18N
sb.append(getHtmlColor(getAttributeColor()));
sb.append(getItemText());
sb.append("</font>"); //NOI18N
sb.append(END_FONT);
if (required) {
sb.append("</b>"); //NOI18N
}
......@@ -772,11 +772,9 @@ public class HtmlCompletionItem implements CompletionItem {
if (required) {
sb.append("<b>"); //NOI18N
}
sb.append("<font color=#"); //NOI18N
sb.append(hexColorCode(ATTR_NAME_COLOR));
sb.append(">"); //NOI18N
sb.append(getHtmlColor(ATTR_NAME_COLOR));
sb.append(getItemText());
sb.append("</font>"); //NOI18N
sb.append(END_FONT);
if (required) {
sb.append("</b>"); //NOI18N
}
......@@ -813,11 +811,9 @@ public class HtmlCompletionItem implements CompletionItem {
return getItemText();
} else {
StringBuilder sb = new StringBuilder();
sb.append("<font color=#"); //NOI18N
sb.append(hexColorCode(color));
sb.append(">"); //NOI18N
sb.append(getHtmlColor(color));
sb.append(getItemText());
sb.append("</font>"); //NOI18N
sb.append(END_FONT);
return sb.toString();
}
}
......@@ -895,4 +891,8 @@ public class HtmlCompletionItem implements CompletionItem {
}
return s;
}
private static String getHtmlColor(Color c) {
return "<font color=#" + hexColorCode(c) + ">"; // NOI18N
}
}
......@@ -111,7 +111,8 @@ public abstract class FileReferenceCompletion<T> implements ValueCompletion<T> {
|| fileNamePart.equals(".") // ../.| case
|| fileNamePart.equals("..")) //../..| case
) { // NOI18N
result.add(createGoUpItem(anchor, Color.BLUE, PACKAGE_ICON)); // NOI18N
// Should match color in o.n.m.html.editor.api.completion.HtmlCompletionItem.createFileCompletionItem()
result.add(createGoUpItem(anchor, new Color(224, 160, 65), PACKAGE_ICON));
}
}
} catch (FileStateInvalidException | IllegalArgumentException ex) {
......
......@@ -65,7 +65,7 @@ public class TruffleDebugManager extends DebuggerManagerAdapter {
private static final String ENGINE_CLASS = "org.graalvm.polyglot.Engine";
private static final String ENGINE_BUILDER_CLASS = "org.graalvm.polyglot.Engine$Builder";
// Breakpoint on this class triggers search of existing engines
private static final String EXISTING_ENGINES_TRIGGER = "com.oracle.truffle.api.frame.FrameSlot";
private static final String EXISTING_ENGINES_TRIGGER = "com.oracle.truffle.api.frame.Frame";
private JPDABreakpoint debugManagerLoadBP;
private static final Map<JPDADebugger, Boolean> haveExistingEnginesTrigger = new WeakHashMap<>();
......
......@@ -236,6 +236,7 @@ public class TruffleAccess implements JPDABreakpointListener {
}
}
if (info == null) {
((JPDAThreadImpl) thread).addPropertyChangeListener(JPDAThreadImpl.PROP_SUSPENDED, threadResumeListener);
info = new ThreadInfo();
suspendHerePCInfos.put(thread, info);
}
......@@ -273,14 +274,17 @@ public class TruffleAccess implements JPDABreakpointListener {
JPDADebuggerImpl debugger = threadImpl.getDebugger();
Value haltInfo;
Lock writeLock = threadImpl.accessLock.writeLock();
Function<EventSet, Boolean> breakpointEventInterceptor = null;
Runnable cleanup = null;
try {
writeLock.lock();
breakpointEventInterceptor = skipSuspendedEventClearLeakingReferences(debugger, thread);
cleanup = skipSuspendedEventClearLeakingReferences(debugger, thread);
haltInfo = ClassTypeWrapper.invokeMethod(debugAccessorClass, tr, suspendHereMethod, Collections.emptyList(), ObjectReference.INVOKE_SINGLE_THREADED);
} finally {
((JPDADebuggerImpl) debugger).getOperator().removeEventInterceptor(breakpointEventInterceptor);
writeLock.unlock();
try {
cleanup.run();
} finally {
writeLock.unlock();
}
}
if (haltInfo instanceof ObjectReference) {
return (ObjectVariable) debugger.getVariable(haltInfo);
......@@ -293,7 +297,7 @@ public class TruffleAccess implements JPDABreakpointListener {
return null;
}
private static Function<EventSet, Boolean> skipSuspendedEventClearLeakingReferences(JPDADebugger debugger, JPDAThread thread) {
private static Runnable skipSuspendedEventClearLeakingReferences(JPDADebugger debugger, JPDAThread thread) {
ThreadReference tr = ((JPDAThreadImpl) thread).getThreadReference();
MethodBreakpoint clearLeakingReferencesBreakpoint = MethodBreakpoint.create("com.oracle.truffle.api.debug.SuspendedEvent", "clearLeakingReferences");
clearLeakingReferencesBreakpoint.setBreakpointType(MethodBreakpoint.TYPE_METHOD_ENTRY);
......@@ -343,7 +347,10 @@ public class TruffleAccess implements JPDABreakpointListener {
});
((JPDADebuggerImpl) debugger).getOperator().addEventInterceptor(breakpointEventInterceptor);
DebuggerManager.getDebuggerManager().addBreakpoint(clearLeakingReferencesBreakpoint);
return breakpointEventInterceptor;
return () -> { // Cleanup
((JPDADebuggerImpl) debugger).getOperator().removeEventInterceptor(breakpointEventInterceptor);
DebuggerManager.getDebuggerManager().removeBreakpoint(clearLeakingReferencesBreakpoint);
};
}
@Override
......@@ -605,6 +612,9 @@ public class TruffleAccess implements JPDABreakpointListener {
i1 = i2 + 1;
i2 = sourceDef.indexOf('\n', i1);
hostMethodName = sourceDef.substring(i1, i2);
if ("null".equals(hostMethodName)) {
hostMethodName = null;
}
i1 = i2 + 1;
i2 = sourceDef.indexOf('\n', i1);
sourcePath = sourceDef.substring(i1, i2);
......@@ -618,6 +628,9 @@ public class TruffleAccess implements JPDABreakpointListener {
i1 = i2 + 1;
i2 = sourceDef.indexOf('\n', i1);
mimeType = sourceDef.substring(i1, i2);
if ("null".equals(mimeType)) {
mimeType = null;
}
i1 = i2 + 1;
i2 = sourceDef.indexOf('\n', i1);
if (i2 < 0) {
......
......@@ -19,6 +19,7 @@
package org.netbeans.modules.debugger.jpda.truffle.access;
import com.sun.jdi.StringReference;
import java.io.InvalidObjectException;
import org.netbeans.api.debugger.jpda.InvalidExpressionException;
import org.netbeans.api.debugger.jpda.JPDAClassType;
......@@ -26,7 +27,12 @@ import org.netbeans.api.debugger.jpda.JPDADebugger;
import org.netbeans.api.debugger.jpda.JPDAThread;
import org.netbeans.api.debugger.jpda.ObjectVariable;
import org.netbeans.api.debugger.jpda.Variable;
import org.netbeans.modules.debugger.jpda.JPDADebuggerImpl;
import org.netbeans.modules.debugger.jpda.expr.InvocationExceptionTranslated;
import org.netbeans.modules.debugger.jpda.jdi.InternalExceptionWrapper;
import org.netbeans.modules.debugger.jpda.jdi.UnsupportedOperationExceptionWrapper;
import org.netbeans.modules.debugger.jpda.jdi.VMDisconnectedExceptionWrapper;
import org.netbeans.modules.debugger.jpda.truffle.PersistentValues;
import org.netbeans.modules.debugger.jpda.truffle.TruffleDebugManager;
import org.netbeans.modules.debugger.jpda.truffle.frames.TruffleStackFrame;
import org.openide.util.Exceptions;
......@@ -56,8 +62,10 @@ public class TruffleEval {
}
ObjectVariable stackFrameInstance = selectedStackFrame.getStackFrameInstance();
JPDAClassType debugAccessor = TruffleDebugManager.getDebugAccessorJPDAClass(debugger);
PersistentValues values = new PersistentValues(((JPDADebuggerImpl) debugger).getVirtualMachine());
try {
Variable mirrorExpression = debugger.createMirrorVar(expression);
StringReference expressionReference = values.mirrorOf(expression);
Variable mirrorExpression = ((JPDADebuggerImpl) debugger).getVariable(expressionReference);
Variable valueVar = debugAccessor.invokeMethod(
METHOD_EVALUATE,
METHOD_EVALUATE_ON_FRAME_SIG,
......@@ -71,7 +79,7 @@ public class TruffleEval {
((InvocationExceptionTranslated) targetException).resetInvocationMessage();
}
throw ex;
} catch (InvalidObjectException | NoSuchMethodException ex) {
} catch (InternalExceptionWrapper | NoSuchMethodException | UnsupportedOperationExceptionWrapper ex) {
try {
return debugger.createMirrorVar(ex.getLocalizedMessage());
} catch (InvalidObjectException iex) {
......@@ -79,6 +87,10 @@ public class TruffleEval {
return null;
}
//return ex.getLocalizedMessage();
} catch (VMDisconnectedExceptionWrapper ex) {
return null;
} finally {
values.collect();
}
}
......
......@@ -49,6 +49,7 @@ import org.netbeans.modules.debugger.jpda.jdi.InternalExceptionWrapper;
import org.netbeans.modules.debugger.jpda.jdi.InvalidRequestStateExceptionWrapper;
import org.netbeans.modules.debugger.jpda.jdi.VMDisconnectedExceptionWrapper;
import org.netbeans.modules.debugger.jpda.jdi.request.EventRequestManagerWrapper;
import org.netbeans.modules.debugger.jpda.models.AbstractVariable;
import org.netbeans.modules.debugger.jpda.models.JPDAThreadImpl;
import org.netbeans.modules.debugger.jpda.truffle.access.CurrentPCInfo;
import org.netbeans.modules.debugger.jpda.truffle.access.TruffleAccess;
......@@ -114,6 +115,10 @@ public class StepActionProvider extends JPDADebuggerActionProvider {
stepCmd = 3;
}
try {
// The `stepCmd` variable is not visible anywhere.
// This change of it's value should not be followed by a refresh.
// We're resuming anyway.
((AbstractVariable) currentPCInfo.getStepCommandVar()).setSilentChange(true);
currentPCInfo.getStepCommandVar().setFromMirrorObject((Integer) stepCmd);
} catch (InvalidObjectException ex) {
Exceptions.printStackTrace(ex);
......
......@@ -115,7 +115,7 @@ public final class TruffleStackFrame {
hostClassName = frameDefinition.substring(i1, i2);
i1 = i2 + 1;
i2 = frameDefinition.indexOf('\n', i1);
hostMethodName = frameDefinition.substring(i1, i2);
hostMethodName = stringOrNull(frameDefinition.substring(i1, i2));
i1 = i2 + 1;
i2 = frameDefinition.indexOf('\n', i1);
try {
......@@ -125,7 +125,7 @@ public final class TruffleStackFrame {
}
i1 = i2 + 1;
i2 = frameDefinition.indexOf('\n', i1);
mimeType = frameDefinition.substring(i1, i2);
mimeType = stringOrNull(frameDefinition.substring(i1, i2));
i1 = i2 + 1;
if (includeInternal) {
i2 = frameDefinition.indexOf('\n', i1);
......@@ -144,6 +144,14 @@ public final class TruffleStackFrame {
this.isInternal = internalFrame;
}
private static String stringOrNull(String str) {
if ("null".equals(str)) {
return null;
} else {
return str;
}
}
public final JPDADebugger getDebugger() {
return debugger;
}
......
......@@ -31,6 +31,7 @@ import org.netbeans.api.debugger.jpda.JPDAThread;
import org.netbeans.api.debugger.jpda.ObjectVariable;
import org.netbeans.api.debugger.jpda.Variable;
import org.netbeans.modules.debugger.jpda.expr.JDIVariable;
import org.netbeans.modules.debugger.jpda.models.JPDAClassTypeImpl;
import org.netbeans.modules.debugger.jpda.truffle.TruffleDebugManager;
import org.openide.util.Exceptions;
......@@ -51,6 +52,7 @@ public final class TruffleStackInfo {
private boolean includedInternalFrames;
private boolean areInternalFrames;
@Deprecated
public TruffleStackInfo(JPDADebugger debugger, JPDAThread thread, ObjectVariable stackTrace) {
this(debugger, thread, stackTrace, false);
}
......@@ -83,13 +85,16 @@ public final class TruffleStackInfo {
try {
Variable internalVar = debugger.createMirrorVar(includeInternal, true);
Variable javaFramesVar = debugger.createMirrorVar(supportsJavaFrames, true);
Variable framesVar = debugAccessor.invokeMethod(METHOD_GET_FRAMES_INFO,
Variable framesVar = ((JPDAClassTypeImpl) debugAccessor).invokeMethod(thread, METHOD_GET_FRAMES_INFO,
METHOD_GET_FRAMES_INFO_SIG,
new Variable[] { stackTrace,
internalVar,
javaFramesVar });
Field[] framesInfos = ((ObjectVariable) framesVar).getFields(0, Integer.MAX_VALUE);
String framesDesc = (String) framesInfos[0].createMirrorObject();
if (framesDesc == null) {
return new TruffleStackFrame[] {};
}
Field[] codes = ((ObjectVariable) framesInfos[1]).getFields(0, Integer.MAX_VALUE);
Field[] thiss = ((ObjectVariable) framesInfos[2]).getFields(0, Integer.MAX_VALUE);
areInternalFrames = false;
......@@ -115,7 +120,9 @@ public final class TruffleStackInfo {
depth++;
}
return truffleFrames.toArray(new TruffleStackFrame[truffleFrames.size()]);
} catch (InvalidExpressionException | NoSuchMethodException | InvalidObjectException ex) {
} catch (InvalidExpressionException | InvalidObjectException ex) {
return new TruffleStackFrame[] {};
} catch (NoSuchMethodException ex) {
Exceptions.printStackTrace(ex);
return new TruffleStackFrame[] {};
}
......
......@@ -29,10 +29,12 @@ import java.util.WeakHashMap;
import javax.swing.Action;
import javax.swing.SwingUtilities;
import org.netbeans.api.debugger.jpda.CallStackFrame;
import org.netbeans.api.debugger.jpda.JPDADebugger;
import org.netbeans.api.debugger.jpda.JPDAThread;
import org.netbeans.modules.debugger.jpda.EditorContextBridge;
import org.netbeans.modules.debugger.jpda.JPDADebuggerImpl;
import org.netbeans.modules.debugger.jpda.models.JPDAThreadImpl;
import org.netbeans.modules.debugger.jpda.truffle.access.CurrentPCInfo;
import org.netbeans.modules.debugger.jpda.truffle.access.TruffleAccess;
import org.netbeans.modules.debugger.jpda.truffle.frames.TruffleStackFrame;
......@@ -64,12 +66,14 @@ public class DebuggingTruffleActionsProvider implements NodeActionsProviderFilte
private final Action HIDE_INTERNAL_ACTION;
private final Action SHOW_HOST_ACTION;
private final Action HIDE_HOST_ACTION;
private final JPDADebuggerImpl debugger;
private final RequestProcessor requestProcessor;
private static final Map<DebuggingView.DVThread, Boolean> SHOWING_ALL_HOST_FRAMES = Collections.synchronizedMap(new WeakHashMap<>());
private static final PropertyChangeSupport SHOWING_ALL_HOST_FRAMES_CHANGE = new PropertyChangeSupport(new Object());
public DebuggingTruffleActionsProvider(ContextProvider lookupProvider) {
debugger = (JPDADebuggerImpl) lookupProvider.lookupFirst(null, JPDADebugger.class);
requestProcessor = lookupProvider.lookupFirst(null, RequestProcessor.class);
MAKE_CURRENT_ACTION = createMAKE_CURRENT_ACTION(requestProcessor);
GO_TO_SOURCE_ACTION = createGO_TO_SOURCE_ACTION(requestProcessor);
......@@ -85,7 +89,9 @@ public class DebuggingTruffleActionsProvider implements NodeActionsProviderFilte
if (node instanceof TruffleStackFrame) {
requestProcessor.post(() ->{
TruffleStackFrame f = (TruffleStackFrame) node;
CurrentPCInfo currentPCInfo = TruffleAccess.getCurrentPCInfo(f.getThread());
JPDAThread thread = f.getThread();
debugger.setCurrentThread(thread);
CurrentPCInfo currentPCInfo = TruffleAccess.getCurrentPCInfo(thread);
if (currentPCInfo != null) {
currentPCInfo.setSelectedStackFrame(f);
goToSource(f);
......@@ -189,6 +195,10 @@ public class DebuggingTruffleActionsProvider implements NodeActionsProviderFilte
public boolean isEnabled (Object node) {
if (node instanceof TruffleStackFrame) {
TruffleStackFrame f = (TruffleStackFrame) node;
JPDAThread thread = f.getThread();
if (thread != debugger.getCurrentThread()) {
return true;
}
CurrentPCInfo currentPCInfo = TruffleAccess.getCurrentPCInfo(f.getThread());
if (currentPCInfo != null) {
return f != currentPCInfo.getSelectedStackFrame();
......@@ -202,7 +212,9 @@ public class DebuggingTruffleActionsProvider implements NodeActionsProviderFilte
if (nodes.length == 0) return ;
if (nodes[0] instanceof TruffleStackFrame) {
TruffleStackFrame f = (TruffleStackFrame) nodes[0];
CurrentPCInfo currentPCInfo = TruffleAccess.getCurrentPCInfo(f.getThread());
JPDAThread thread = f.getThread();
debugger.setCurrentThread(thread);
CurrentPCInfo currentPCInfo = TruffleAccess.getCurrentPCInfo(thread);
if (currentPCInfo != null) {
currentPCInfo.setSelectedStackFrame(f);
}
......
......@@ -38,6 +38,8 @@ import org.netbeans.modules.debugger.jpda.truffle.Utils;
import org.netbeans.modules.debugger.jpda.truffle.access.CurrentPCInfo;
import org.netbeans.modules.debugger.jpda.truffle.access.TruffleAccess;
import org.netbeans.modules.debugger.jpda.truffle.frames.TruffleStackFrame;
import org.netbeans.modules.debugger.jpda.truffle.vars.impl.TruffleScope;
import org.netbeans.modules.debugger.jpda.ui.debugging.JPDADVThread;
import org.netbeans.spi.debugger.ContextProvider;
import org.netbeans.spi.debugger.DebuggerServiceRegistration;
import org.netbeans.spi.debugger.jpda.EditorContext;
......@@ -47,6 +49,7 @@ import org.netbeans.spi.viewmodel.ModelEvent;
import org.netbeans.spi.viewmodel.ModelListener;
import org.netbeans.spi.viewmodel.NodeModel;
import org.netbeans.spi.viewmodel.UnknownTypeException;
import org.openide.util.NbBundle;
import org.openide.util.WeakListeners;
import org.openide.util.WeakSet;
......@@ -64,6 +67,7 @@ public class DebuggingTruffleNodeModel implements ExtendedNodeModelFilter {
public DebuggingTruffleNodeModel(ContextProvider lookupProvider) {
debugger = lookupProvider.lookupFirst(null, JPDADebugger.class);
debugger.addPropertyChangeListener(JPDADebugger.PROP_CURRENT_THREAD, WeakListeners.propertyChange(cpiChL, debugger));
}
@Override
......@@ -106,15 +110,22 @@ public class DebuggingTruffleNodeModel implements ExtendedNodeModelFilter {
if (node instanceof TruffleStackFrame) {
return original.getIconBaseWithExtension(EmptyCallStackFrame.INSTANCE);
}
if (node instanceof TruffleScope) {
return null;
}
return original.getIconBaseWithExtension(node);
}
@Override
@NbBundle.Messages({"# {0} - thread name",
"# {1} - source location",
"CTL_Thread_State_Truffle_Suspended_At=''{0}'' suspended at ''{1}''",})
public String getDisplayName(NodeModel original, Object node) throws UnknownTypeException {
if (node instanceof TruffleStackFrame) {
TruffleStackFrame tf = (TruffleStackFrame) node;
String displayName = tf.getDisplayName();
CurrentPCInfo currentPCInfo = TruffleAccess.getCurrentPCInfo(tf.getThread());
JPDAThread thread = tf.getThread();
CurrentPCInfo currentPCInfo = TruffleAccess.getCurrentPCInfo(thread);
if (currentPCInfo != null) {
synchronized (cpisListening) {