Skip to content

Commit a4660c9

Browse files
authored
Dev (#685)
* protocol update * bump * refactor * refactor * refactor * temp version * refactor * refactor * refactor * clean * organize imports * refactor * refactor * bump * bump * refactor * validate marker auth over tcp * refactor * bump * refactor * bump * bump * backwards compatibility issues * bump * bump * bump * moved packages * refactor * better error message * bump * bump * use official lib * Update build.gradle.kts * Update build.gradle.kts * Update build.gradle.kts * Update build.gradle.kts * Update build.gradle.kts * bump * Update build.gradle.kts * bump * fixes #658 * refactor * remove globalscope * fixes #666 * refactor * formatting * fix log pattern ordering * bump * live variable presentation * refactor * use protocol marshaller * require input * skip if no pattern * bump * clean * Watch log command (#673) * watch log * unused * refactor * refactor * moved portal only code to portal * protocol update * clean * watch log command * bump * refactor * format * remove subscription on mark remove * move package * move test * bump * remove mapper * remove mapper * unused * remove unused * remove unused * remove portal tests * exclude gen * use protocol type * start from current service * remove portal config from status bars * translations * skywalking reroute * skywalking reroute * bump * remove hardcoded config * view event listener merged instrument id source keys * remove portal * bump * bump * use marshaller * use marshaller * use marshaller * re-impl portal * refactor * refactor * bump * refactor * reimpl portal * move portal code * license * sw live service * bump * move packages * MARK_USER_DATA_UPDATED event * bump * activity quick stats * clean * createMethodInlayMark * increase visibility * formatting * bump * more logging * import organizing * remove specific subs instead of clearing all * fix dupe quick stat inlays * bump * remove mapper * reset * Update ViewEventListener.kt * merge refactor * Update build.gradle.kts * remove mapper * compatibility * overview wip * fix edt warning
1 parent 0f66fa2 commit a4660c9

File tree

10 files changed

+53
-16
lines changed

10 files changed

+53
-16
lines changed

marker/jvm-marker/src/main/kotlin/spp/jetbrains/marker/jvm/ArtifactNavigator.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,17 @@ object ArtifactNavigator {
5050
//todo: remove method from method names and support navigating to classes?
5151

5252
fun navigateTo(project: Project, element: LiveStackTraceElement) {
53-
ApplicationManager.getApplication().invokeLater {
53+
ApplicationManager.getApplication().runReadAction {
5454
val foundFiles = getFilesByName(project, element.sourceAsFilename()!!, allScope(project))
5555
if (foundFiles.isNotEmpty()) {
5656
val file = foundFiles[0]
5757
val document: Document = PsiDocumentManager.getInstance(file.project).getDocument(file)!!
5858
val offset = document.getLineStartOffset(element.sourceAsLineNumber()!! - 1)
59-
PsiNavigationSupport.getInstance().createNavigatable(project, file.virtualFile, offset).navigate(true)
59+
60+
ApplicationManager.getApplication().invokeLater {
61+
PsiNavigationSupport.getInstance().createNavigatable(project, file.virtualFile, offset)
62+
.navigate(true)
63+
}
6064
}
6165
}
6266
}

plugin/src/main/java/spp/jetbrains/sourcemarker/PluginIcons.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ interface Command {
4949
Icon liveBreakpointSelected = IconLoader.getIcon("/icons/command/live-breakpoint_selected.svg", PluginIcons.class);
5050
Icon liveBreakpointUnSelected = IconLoader.getIcon("/icons/command/live-breakpoint_unselected.svg", PluginIcons.class);
5151

52-
Icon livelogSelected = IconLoader.getIcon("/icons/command/live-log_selected.svg", PluginIcons.class);
53-
Icon livelogUnSelected = IconLoader.getIcon("/icons/command/live-log_unselected.svg", PluginIcons.class);
52+
Icon liveLogSelected = IconLoader.getIcon("/icons/command/live-log_selected.svg", PluginIcons.class);
53+
Icon liveLogUnSelected = IconLoader.getIcon("/icons/command/live-log_unselected.svg", PluginIcons.class);
5454

5555
Icon liveMeterSelected = IconLoader.getIcon("/icons/command/live-meter_selected.svg", PluginIcons.class);
5656
Icon liveMeterUnSelected = IconLoader.getIcon("/icons/command/live-meter_unselected.svg", PluginIcons.class);
5757

5858
Icon liveSpanSelected = IconLoader.getIcon("/icons/command/live-span_selected.svg", PluginIcons.class);
5959
Icon liveSpanUnSelected = IconLoader.getIcon("/icons/command/live-span_unselected.svg", PluginIcons.class);
6060

61+
Icon viewOverviewSelected = IconLoader.getIcon("/icons/command/view-overview_selected.svg", PluginIcons.class);
62+
Icon viewOverviewUnSelected = IconLoader.getIcon("/icons/command/view-overview_unselected.svg", PluginIcons.class);
6163
Icon viewActivitySelected = IconLoader.getIcon("/icons/command/view-activity_selected.svg", PluginIcons.class);
6264
Icon viewActivityUnSelected = IconLoader.getIcon("/icons/command/view-activity_unselected.svg", PluginIcons.class);
6365
Icon viewTracesSelected = IconLoader.getIcon("/icons/command/view-traces_selected.svg", PluginIcons.class);

plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/ControlBarController.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ object ControlBarController {
6868
@Suppress("UselessCallOnCollection") //unknown enums are null
6969
selfInfo.permissions.filterNotNull().map { it.name }.contains(it.name)
7070
})
71+
//availableCommands.add(VIEW_OVERVIEW) //todo: remove after v0.4.2
7172
}
7273

7374
private fun determineAvailableCommandsAtLocation(inlayMark: ExpressionInlayMark): List<LiveControlCommand> {
@@ -79,7 +80,7 @@ object ControlBarController {
7980
val parentMark = inlayMark.getParentSourceMark()
8081
if (parentMark is MethodSourceMark) {
8182
val loggerDetector = parentMark.getUserData(SourceMarkKeys.LOGGER_DETECTOR)
82-
if (loggerDetector != null) {
83+
if (loggerDetector != null && SourceServices.Instance.liveView != null) {
8384
runBlocking {
8485
val detectedLogs = loggerDetector.getOrFindLoggerStatements(parentMark)
8586
val logOnCurrentLine = detectedLogs.find { it.lineLocation == inlayMark.lineNumber }
@@ -95,6 +96,7 @@ object ControlBarController {
9596
fun handleCommandInput(input: String, editor: Editor) {
9697
log.info("Processing command input: {}", input)
9798
when (input) {
99+
VIEW_OVERVIEW.command -> handleViewPortalCommand(editor, VIEW_OVERVIEW)
98100
VIEW_ACTIVITY.command -> handleViewPortalCommand(editor, VIEW_ACTIVITY)
99101
VIEW_TRACES.command -> handleViewPortalCommand(editor, VIEW_TRACES)
100102
VIEW_LOGS.command -> handleViewPortalCommand(editor, VIEW_LOGS)

plugin/src/main/kotlin/spp/jetbrains/sourcemarker/command/LiveControlCommand.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ enum class LiveControlCommand(
3434
val unselectedIcon: Icon? = null
3535
) : AutocompleteFieldRow {
3636

37+
VIEW_OVERVIEW(
38+
"View Overview",
39+
"<html><span style=\"font-size: 80%; color: gray\">Live View ➛ Overview ➛ Scope: Class</span></html>",
40+
PluginIcons.Command.viewOverviewSelected,
41+
PluginIcons.Command.viewOverviewUnSelected
42+
),
3743
VIEW_ACTIVITY(
3844
"View Activity",
3945
"<html><span style=\"font-size: 80%; color: gray\">Live View ➛ Activity ➛ Scope: Method</span></html>",
@@ -75,8 +81,8 @@ enum class LiveControlCommand(
7581
ADD_LIVE_LOG(
7682
"Add Log",
7783
"<html><span style=\"font-size: 80%; color: gray\">Live Instrument ➛ Add ➛ Location: </span><span style=\"font-size: 80%; color: #E6E6E6\">On line *lineNumber*</span></html>",
78-
PluginIcons.Command.livelogSelected,
79-
PluginIcons.Command.livelogUnSelected
84+
PluginIcons.Command.liveLogSelected,
85+
PluginIcons.Command.liveLogUnSelected
8086
),
8187
ADD_LIVE_METER(
8288
"Add Meter",

plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalController.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ import org.slf4j.LoggerFactory
2828
import spp.jetbrains.marker.SourceMarker
2929
import spp.jetbrains.marker.source.mark.api.component.jcef.SourceMarkJcefComponent
3030
import spp.jetbrains.marker.source.mark.api.event.SourceMarkEventCode
31+
import spp.jetbrains.marker.source.mark.gutter.GutterMark
3132
import spp.jetbrains.portal.SourcePortal
3233
import spp.jetbrains.portal.backend.PortalServer
3334
import spp.jetbrains.portal.protocol.portal.PageType
3435
import spp.jetbrains.sourcemarker.command.LiveControlCommand
3536
import spp.jetbrains.sourcemarker.command.LiveControlCommand.*
3637
import spp.jetbrains.sourcemarker.mark.SourceMarkKeys
3738
import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig
39+
import spp.protocol.artifact.ArtifactQualifiedName
3840
import spp.protocol.marshall.KSerializers
41+
import spp.protocol.marshall.LocalMessageCodec
3942
import javax.swing.UIManager
4043

4144
class PortalController(private val markerConfig: SourceMarkerConfig) : CoroutineVerticle() {
@@ -54,9 +57,11 @@ class PortalController(private val markerConfig: SourceMarkerConfig) : Coroutine
5457
vertx.deployVerticle(portalServer).await()
5558
vertx.deployVerticle(PortalEventListener(markerConfig)).await()
5659

60+
// //todo: remove after v0.4.2
61+
// vertx.eventBus().registerDefaultCodec(ArtifactQualifiedName::class.java, LocalMessageCodec())
62+
5763
SourceMarker.addGlobalSourceMarkEventListener {
58-
if (it.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED) {
59-
//todo: only register when needed
64+
if (it.eventCode == SourceMarkEventCode.MARK_BEFORE_ADDED && it.sourceMark is GutterMark) {
6065
//register portal for source mark
6166
val portal = SourcePortal.getPortal(
6267
SourcePortal.register(it.sourceMark.artifactQualifiedName, false)
@@ -72,6 +77,7 @@ class PortalController(private val markerConfig: SourceMarkerConfig) : Coroutine
7277
it.sourceMark.addEventListener {
7378
if (it.eventCode == SourceMarkEventCode.UPDATE_PORTAL_CONFIG) {
7479
when (val command = it.params.first() as LiveControlCommand) {
80+
VIEW_OVERVIEW -> portal.configuration.config["currentPage"] = PageType.OVERVIEW
7581
VIEW_ACTIVITY -> portal.configuration.config["currentPage"] = PageType.ACTIVITY
7682
VIEW_TRACES -> portal.configuration.config["currentPage"] = PageType.TRACES
7783
VIEW_LOGS -> portal.configuration.config["currentPage"] = PageType.LOGS

plugin/src/main/kotlin/spp/jetbrains/sourcemarker/portal/PortalEventListener.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ import spp.jetbrains.sourcemarker.settings.SourceMarkerConfig
8787
import spp.protocol.SourceServices.Instance
8888
import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress
8989
import spp.protocol.artifact.ArtifactQualifiedName
90+
import spp.protocol.artifact.ArtifactType
9091
import spp.protocol.artifact.QueryTimeFrame
9192
import spp.protocol.artifact.exception.LiveStackTraceElement
9293
import spp.protocol.artifact.log.Log
@@ -232,9 +233,9 @@ class PortalEventListener(
232233
}
233234
vertx.eventBus().consumer<ArtifactQualifiedName>(FindPortal) {
234235
// val artifactQualifiedName = it.body()
235-
// val sourceMarks = SourceMarker.getSourceMarks(artifactQualifiedName)
236-
// if (sourceMarks.isNotEmpty()) {
237-
// it.reply(sourceMarks[0].getUserData(SourceMarkKeys.SOURCE_PORTAL)!!)
236+
// val portals = SourcePortal.getPortals(artifactQualifiedName)
237+
// if (portals.isNotEmpty()) {
238+
// it.reply(portals.first())
238239
// } else {
239240
// launch(vertx.dispatcher()) {
240241
// val classArtifact = findArtifact(
@@ -250,7 +251,8 @@ class PortalEventListener(
250251
// val gutterMark = creationService.getOrCreateMethodGutterMark(
251252
// fileMarker, searchArtifact.nameIdentifier!!
252253
// )!!
253-
// it.reply(gutterMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!)
254+
// println(gutterMark)
255+
// //it.reply(gutterMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!)
254256
// }
255257
// }
256258
// }
@@ -264,9 +266,9 @@ class PortalEventListener(
264266
// ApplicationManager.getApplication().invokeLater {
265267
// PsiNavigateUtil.navigate(sourceMark.getPsiElement())
266268
//
267-
// val portal = sourceMark.getUserData(SourceMarkKeys.SOURCE_PORTAL)!!
268-
// openPortal(portal)
269-
// it.reply(portal)
269+
// val portals = SourcePortal.getPortals(artifactQualifiedName)
270+
// openPortal(portals.first())
271+
// it.reply(portals.first())
270272
// }
271273
// } else {
272274
// log.warn("Failed to find portal for artifact: $artifactQualifiedName")
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)