Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51090f4e1d | ||
|
|
6a421a7078 | ||
|
|
b9050a46a9 | ||
|
|
3a4c03affe |
No files matched your search
+13
-3
@@ -5,14 +5,15 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val kotlinVersion = "1.4.0"
|
val kotlinVersion = "1.4.0"
|
||||||
val kotlinBukkitAPIVersion = "0.1.0-SNAPSHOT"
|
val kotlinBukkitAPIVersion = "0.2.0-SNAPSHOT"
|
||||||
val bukkriptVersion = "0.1.0-SNAPSHOT"
|
val bukkriptVersion = "0.2.0-SNAPSHOT"
|
||||||
|
|
||||||
group = "br.com.devsrsouza.kotlinbukkitapi"
|
group = "br.com.devsrsouza.kotlinbukkitapi"
|
||||||
version = "0.0.5"
|
version = "0.0.6"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
|
mavenLocal()
|
||||||
maven("http://nexus.devsrsouza.com.br/repository/maven-public/")
|
maven("http://nexus.devsrsouza.com.br/repository/maven-public/")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +86,15 @@ tasks.getByName<org.jetbrains.intellij.tasks.PatchPluginXmlTask>("patchPluginXml
|
|||||||
|
|
||||||
|
|
||||||
changeNotes("""
|
changeNotes("""
|
||||||
|
<h3>0.0.6</h3>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Update the embedded version of Bukkript and KotlinBukkitAPI.</li>
|
||||||
|
<li>Adding KotlinBukkitAPI 0.2.0-SNAPSHOT to the Project Wizard.</li>
|
||||||
|
<li>Improving overall performance of Menu Preview.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<h3>0.0.5</h3>
|
<h3>0.0.5</h3>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|||||||
+28
-10
@@ -25,7 +25,7 @@ class MenuPreviewFileEditor(
|
|||||||
) : UserDataHolderBase(), FileEditor {
|
) : UserDataHolderBase(), FileEditor {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val REBUILD_DELAY_MILLISECONDS = 200
|
const val REBUILD_DELAY_MILLISECONDS = 80
|
||||||
}
|
}
|
||||||
|
|
||||||
private val mySwingAlarm = Alarm(Alarm.ThreadToUse.SWING_THREAD, this)
|
private val mySwingAlarm = Alarm(Alarm.ThreadToUse.SWING_THREAD, this)
|
||||||
@@ -42,11 +42,7 @@ class MenuPreviewFileEditor(
|
|||||||
private lateinit var currentScroll: JBScrollPane
|
private lateinit var currentScroll: JBScrollPane
|
||||||
private var currentSelectedLine: Int? = null
|
private var currentSelectedLine: Int? = null
|
||||||
|
|
||||||
init {
|
private val documentListener = object : DocumentListener {
|
||||||
rebuild(null)
|
|
||||||
|
|
||||||
// listen to the source code changes to rebuild the UI
|
|
||||||
myDocument.addDocumentListener(object : DocumentListener {
|
|
||||||
override fun beforeDocumentChange(event: DocumentEvent) {
|
override fun beforeDocumentChange(event: DocumentEvent) {
|
||||||
mySwingAlarm.cancelAllRequests()
|
mySwingAlarm.cancelAllRequests()
|
||||||
}
|
}
|
||||||
@@ -55,18 +51,30 @@ class MenuPreviewFileEditor(
|
|||||||
rebuild(currentScroll.viewport.viewPosition)
|
rebuild(currentScroll.viewport.viewPosition)
|
||||||
}, REBUILD_DELAY_MILLISECONDS)
|
}, REBUILD_DELAY_MILLISECONDS)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
// listen to cursor changes to make a slot selectable
|
private val caretListener = object : CaretListener {
|
||||||
mainEditor.editor.caretModel.addCaretListener(object : CaretListener {
|
|
||||||
override fun caretPositionChanged(event: CaretEvent) {
|
override fun caretPositionChanged(event: CaretEvent) {
|
||||||
currentSelectedLine = event.newPosition.line
|
currentSelectedLine = event.newPosition.line
|
||||||
|
mySwingAlarm.addRequest({
|
||||||
rebuild(currentScroll.viewport.viewPosition)
|
rebuild(currentScroll.viewport.viewPosition)
|
||||||
|
}, REBUILD_DELAY_MILLISECONDS)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
fun setup() {
|
||||||
|
rebuild(null)
|
||||||
|
|
||||||
|
// listen to the source code changes to rebuild the UI
|
||||||
|
myDocument.addDocumentListener(documentListener)
|
||||||
|
|
||||||
|
// listen to cursor changes to make a slot selectable
|
||||||
|
mainEditor.editor.caretModel.addCaretListener(caretListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun rebuild(currentViewPosition: Point?) {
|
fun rebuild(currentViewPosition: Point?) {
|
||||||
|
if(!myUi.isShowing) return
|
||||||
|
|
||||||
val tree = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument) ?: return
|
val tree = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument) ?: return
|
||||||
|
|
||||||
// clear the old UI
|
// clear the old UI
|
||||||
@@ -146,8 +154,18 @@ class MenuPreviewFileEditor(
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun selectNotify() {
|
||||||
|
setup()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun deselectNotify() {
|
||||||
|
dispose()
|
||||||
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
mySwingAlarm.cancelAllRequests()
|
mySwingAlarm.cancelAllRequests()
|
||||||
|
myDocument.removeDocumentListener(documentListener)
|
||||||
|
mainEditor.editor.caretModel.removeCaretListener(caretListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun JComponent.centerComponent(): JPanel {
|
private fun JComponent.centerComponent(): JPanel {
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ package br.com.devsrsouza.kotlinbukkitapi.tooling.wizard
|
|||||||
|
|
||||||
object Versions {
|
object Versions {
|
||||||
val `v0_1_0-SNAPSHOT` = KotlinBukkitAPIVersion("0.1.0-SNAPSHOT")
|
val `v0_1_0-SNAPSHOT` = KotlinBukkitAPIVersion("0.1.0-SNAPSHOT")
|
||||||
|
val `v0_2_0-SNAPSHOT` = KotlinBukkitAPIVersion("0.2.0-SNAPSHOT")
|
||||||
|
|
||||||
val ALL = arrayOf(
|
val ALL = arrayOf(
|
||||||
|
`v0_2_0-SNAPSHOT`,
|
||||||
`v0_1_0-SNAPSHOT`
|
`v0_1_0-SNAPSHOT`
|
||||||
)
|
)
|
||||||
|
|
||||||
val LAST = `v0_1_0-SNAPSHOT`
|
val LAST = `v0_2_0-SNAPSHOT`
|
||||||
|
|
||||||
val visitorAll = ALL.associate { it.version to it }
|
val visitorAll = ALL.associate { it.version to it }
|
||||||
|
|
||||||
@@ -26,9 +28,9 @@ data class KotlinBukkitAPIVersion(
|
|||||||
|
|
||||||
val repositories = listOf(
|
val repositories = listOf(
|
||||||
"http://nexus.devsrsouza.com.br/repository/maven-public/",
|
"http://nexus.devsrsouza.com.br/repository/maven-public/",
|
||||||
"https://oss.jfrog.org/oss-snapshot-local/",
|
/*"https://oss.jfrog.org/oss-snapshot-local/", // TODO: create a option to provide this repositories optionally
|
||||||
"http://nexus.okkero.com/repository/maven-releases/",
|
"http://nexus.okkero.com/repository/maven-releases/",
|
||||||
"https://repo.codemc.org/repository/maven-public"
|
"https://repo.codemc.org/repository/maven-public",*/
|
||||||
)
|
)
|
||||||
|
|
||||||
val dependencies = listOf(
|
val dependencies = listOf(
|
||||||
|
|||||||
+1
@@ -43,6 +43,7 @@ fun generateGradleBuildFileContent(
|
|||||||
val plugins = externalPlugins.joinToString { "\"${it.name}\"" }
|
val plugins = externalPlugins.joinToString { "\"${it.name}\"" }
|
||||||
|
|
||||||
return """
|
return """
|
||||||
|
|// More about the setup here: https://github.com/DevSrSouza/KotlinBukkitAPI/wiki/Getting-Started
|
||||||
|plugins {
|
|plugins {
|
||||||
| kotlin("jvm") version "${kbAPIVersion.kotlinVersion}"
|
| kotlin("jvm") version "${kbAPIVersion.kotlinVersion}"
|
||||||
| kotlin("plugin.serialization") version "${kbAPIVersion.kotlinVersion}"
|
| kotlin("plugin.serialization") version "${kbAPIVersion.kotlinVersion}"
|
||||||
|
|||||||
Reference in new issue
Block a user