Skip to content

Commit 010145f

Browse files
committed
The skip works, now to make a settings panel.
1 parent ea97168 commit 010145f

File tree

6 files changed

+124
-3
lines changed

6 files changed

+124
-3
lines changed

Diff for: src/main/kotlin/de/tschallacka/phpstormxdebugskip/listeners/MyXDebugProcessListener.kt

+19-2
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,33 @@ package de.tschallacka.phpstormxdebugskip.listeners
33
import com.intellij.xdebugger.XDebugProcess
44
import com.intellij.xdebugger.XDebuggerManagerListener
55
import com.intellij.openapi.project.Project
6+
import com.intellij.openapi.util.Trinity
67
import com.intellij.xdebugger.XDebugSessionListener
78

89
class MyXDebugProcessListener(private val project: Project) : XDebuggerManagerListener {
910
override fun processStarted(debugProcess: XDebugProcess) {
10-
val session = debugProcess.session
11+
val session = debugProcess.session;
1112
session.addSessionListener(object : XDebugSessionListener {
1213
override fun sessionPaused() {
1314
var frame = session.currentStackFrame;
14-
throw RuntimeException("foobar")
15+
var frameDataObject = frame?.getEqualityObject();
16+
if (frameDataObject is Trinity<*, *, *>) {
17+
var frameData = frameDataObject as Trinity<Integer, String, String>
18+
var path = frameData.second;
19+
var functioName = frameData.third;
20+
var regex = Regex("(.*)->.*");
21+
var match = regex.matchEntire(functioName);
22+
var namespace = match?.groupValues?.get(1);
23+
if (namespace != null && isSkippableNamespace(namespace)) {
24+
session.stepOver(false);
25+
}
26+
}
1527
}
1628
})
1729
}
30+
31+
public fun isSkippableNamespace(namespace: String): Boolean {
32+
return namespace.contains("FOO\\Bar");
33+
34+
}
1835
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package de.tschallacka.phpstormxdebugskip.settings
2+
3+
import com.intellij.openapi.components.*
4+
import com.intellij.util.xmlb.XmlSerializerUtil
5+
import org.jetbrains.annotations.Nullable
6+
7+
@State(
8+
name = "de.tschallacka.phpstormxdebugskip.Settings",
9+
storages = [Storage(StoragePathMacros.WORKSPACE_FILE)]
10+
)
11+
class Settings : PersistentStateComponent<Settings.State> {
12+
13+
data class State(var namespaces: ArrayList<String> = arrayListOf(),
14+
var filepaths: ArrayList<String> = arrayListOf())
15+
16+
var settingsState: State = State()
17+
18+
override fun getState(): State? = settingsState
19+
20+
override fun loadState(state: State) {
21+
XmlSerializerUtil.copyBean(state, this.settingsState)
22+
}
23+
24+
companion object {
25+
fun getInstance(): Settings = service()
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package de.tschallacka.phpstormxdebugskip.settings
2+
3+
import com.intellij.openapi.options.Configurable
4+
import javax.swing.JComponent
5+
6+
class SettingsConfigurable : Configurable {
7+
8+
private var settingsDialog: SettingsDialog? = null
9+
10+
override fun createComponent(): JComponent? {
11+
settingsDialog = SettingsDialog()
12+
return settingsDialog?.createCenterPanel()
13+
}
14+
15+
override fun isModified(): Boolean {
16+
// Here you can implement a check to see if settings have been modified
17+
return false
18+
}
19+
20+
override fun apply() {
21+
// Here you should implement applying the settings
22+
}
23+
24+
override fun reset() {
25+
// Here you can implement resetting your settings UI to the stored state
26+
}
27+
28+
override fun getDisplayName(): String {
29+
// The display name for the settings component
30+
return "PHPStorm Xdebug Skip"
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package de.tschallacka.phpstormxdebugskip.settings
2+
3+
import com.intellij.openapi.ui.DialogWrapper
4+
import org.jetbrains.annotations.Nullable
5+
import javax.swing.*
6+
7+
class SettingsDialog : DialogWrapper(true) {
8+
private lateinit var myMainPanel: JPanel
9+
private lateinit var myNamespaceList: JList<String>
10+
private lateinit var myFilePathList: JList<String>
11+
12+
init {
13+
init()
14+
title = "Settings"
15+
}
16+
17+
@Nullable
18+
override fun createCenterPanel(): JComponent? {
19+
return myMainPanel
20+
}
21+
}

Diff for: src/main/resources/META-INF/plugin.xml

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@
1212
<implementation-class>de.tschallacka.phpstormxdebugskip.MyPluginProjectComponent</implementation-class>
1313
</component>
1414
</project-components>
15-
15+
<extensions defaultExtensionNs="com.intellij">
16+
<!-- Add your extension point here -->
17+
<projectConfigurable instance="de.tschallacka.phpstormxdebugskip.settings.SettingsConfigurable" />
18+
</extensions>
1619
</idea-plugin>

Diff for: src/main/resources/forms/settings.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.tschallacka.phpstormxdebugskip.settings.SettingsDialog">
2+
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
3+
<constraints>
4+
<xy x="20" y="20" width="500" height="400"/>
5+
</constraints>
6+
<properties/>
7+
<border type="none"/>
8+
<children>
9+
<component id="82389" class="javax.swing.JScrollPane" binding="myNamespaceList">
10+
<constraints>
11+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
12+
</constraints>
13+
</component>
14+
<component id="6346c" class="javax.swing.JScrollPane" binding="myFilePathList">
15+
<constraints>
16+
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
17+
</constraints>
18+
</component>
19+
</children>
20+
</grid>
21+
</form>

0 commit comments

Comments
 (0)