Skip to content

Commit 8b3b8a0

Browse files
committed
feat: remove disposable
1 parent 111098b commit 8b3b8a0

File tree

6 files changed

+1
-33
lines changed

6 files changed

+1
-33
lines changed
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
package com.github.xepozz.call.base.api
22

3-
import com.intellij.openapi.Disposable
43
import javax.swing.JComponent
54

6-
/**
7-
* Simple output wrapper API. In Phase 1, a console-based implementation is enough.
8-
*/
9-
interface Wrapper : Disposable {
5+
interface Wrapper {
106
val component: JComponent
117
}

src/main/kotlin/com/github/xepozz/call/base/inlay/ExecutionInlayProvider.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import com.intellij.icons.AllIcons
2525
import com.intellij.openapi.application.invokeLater
2626
import com.intellij.openapi.editor.Editor
2727
import com.intellij.openapi.project.Project
28-
import com.intellij.openapi.util.Disposer
2928
import com.intellij.psi.PsiElement
3029
import com.intellij.psi.PsiFile
3130
import com.intellij.ui.dsl.builder.panel
@@ -145,7 +144,6 @@ class ExecutionInlayProvider : InlayHintsProvider<NoSettings> {
145144
var runPres: InlayPresentation = factory.withTooltip(tooltip, withIcon)
146145
runPres = factory.withCursorOnHover(runPres, Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))
147146
runPres = factory.onClick(runPres, MouseButton.Left) { _, _ ->
148-
if (project == null) return@onClick
149147
val featureGenerator = feature ?: return@onClick
150148
run(editor, project, featureGenerator, match, key, lineEndOffset)
151149
}
@@ -161,7 +159,6 @@ class ExecutionInlayProvider : InlayHintsProvider<NoSettings> {
161159
var rerunPres: InlayPresentation = factory.withTooltip(rerunTooltip, withIcon)
162160
rerunPres = factory.withCursorOnHover(rerunPres, Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))
163161
rerunPres = factory.onClick(rerunPres, MouseButton.Left) { _, _ ->
164-
if (project == null) return@onClick
165162
val feat = feature ?: return@onClick
166163
run(editor, project, feat, match, key, lineEndOffset)
167164
}
@@ -221,10 +218,6 @@ class ExecutionInlayProvider : InlayHintsProvider<NoSettings> {
221218
container.remove(oldWrapper.component)
222219
}
223220
mountWrapperIntoContainer(container, wrapper)
224-
try {
225-
oldWrapper?.dispose()
226-
} catch (_: Throwable) {
227-
}
228221
current.wrapper = wrapper
229222
current.state = ExecutionState.RUNNING
230223
}
@@ -268,8 +261,6 @@ class ExecutionInlayProvider : InlayHintsProvider<NoSettings> {
268261
invokeLater {
269262
session.container?.parent?.remove(session.container)
270263
}
271-
try { session.wrapper?.dispose() } catch (_: Throwable) { }
272-
Disposer.dispose(session.disposable)
273264
}
274265

275266
private fun toggleCollapse(session: Session) {

src/main/kotlin/com/github/xepozz/call/base/inlay/Session.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package com.github.xepozz.call.base.inlay
33
import com.github.xepozz.call.base.api.Wrapper
44
import com.github.xepozz.call.base.handlers.ExecutionState
55
import com.intellij.execution.process.ProcessHandler
6-
import com.intellij.openapi.Disposable
7-
import com.intellij.openapi.util.Disposer
86
import javax.swing.JPanel
97

108
internal data class Session(
@@ -13,5 +11,4 @@ internal data class Session(
1311
var state: ExecutionState = ExecutionState.IDLE,
1412
var processHandler: ProcessHandler? = null,
1513
var collapsed: Boolean = false,
16-
val disposable: Disposable = Disposer.newDisposable("Call.Inlay.Session")
1714
)

src/main/kotlin/com/github/xepozz/call/feature/http/HttpWrapperPanel.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,4 @@ class HttpWrapperPanel(project: Project) : Wrapper {
2121
addTab("Body", bodyConsole.component)
2222
// addTab("Preview", bodyConsole.component)
2323
}
24-
25-
override fun dispose() {
26-
bodyConsole.dispose()
27-
headersConsole.dispose()
28-
console.dispose()
29-
}
3024
}

src/main/kotlin/com/github/xepozz/call/feature/shell/ConsoleWrapperPanel.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,4 @@ class ConsoleWrapperPanel(project: Project) : Wrapper {
3232
add(console.component)
3333
}
3434

35-
override fun dispose() {
36-
console.dispose()
37-
}
3835
}

src/main/resources/META-INF/plugin.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<resource-bundle>messages.MyBundle</resource-bundle>
1313

1414
<extensions defaultExtensionNs="com.intellij">
15-
<!-- New unified inlay provider based on the extensible mechanism -->
1615
<codeInsight.inlayProvider
1716
language="HTML"
1817
implementationClass="com.github.xepozz.call.base.inlay.ExecutionInlayProvider"/>
@@ -29,15 +28,9 @@
2928
interface="com.github.xepozz.call.base.api.FeatureGenerator"
3029
area="IDEA_PROJECT"
3130
name="feature"/>
32-
<extensionPoint
33-
dynamic="true"
34-
interface="com.github.xepozz.call.base.api.WrapperFactory"
35-
area="IDEA_PROJECT"
36-
name="wrapperFactory"/>
3731
</extensionPoints>
3832

3933
<extensions defaultExtensionNs="com.github.xepozz.call">
40-
<!-- Default implementations for the new architecture (Phase 1) -->
4134
<languageTextExtractor
4235
order="last"
4336
implementation="com.github.xepozz.call.base.extractors.AdapterLanguageExtractor"/>

0 commit comments

Comments
 (0)