Skip to content

Commit afeb665

Browse files
authored
Merge pull request #1 from ranbest/123
123
2 parents 9698abd + b2e2245 commit afeb665

File tree

6 files changed

+44
-23
lines changed

6 files changed

+44
-23
lines changed

build.gradle

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
22
repositories {
3-
maven { url 'http://dl.bintray.com/jetbrains/intellij-plugin-service' }
3+
maven { url 'https://dl.bintray.com/jetbrains/intellij-plugin-service' }
44
mavenCentral()
55
}
66
dependencies {
@@ -9,7 +9,14 @@ buildscript {
99
}
1010

1111
plugins {
12-
id "org.jetbrains.intellij" version "0.2.5"
12+
id "org.jetbrains.intellij" version "1.0"
13+
}
14+
15+
intellij {
16+
version 'IC-2020.3'
17+
// plugins 'coverage'
18+
// pluginName 'CodeGlance'
19+
updateSinceUntilBuild = false
1320
}
1421

1522
allprojects {
@@ -21,10 +28,11 @@ allprojects {
2128
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
2229

2330
apply plugin: 'org.jetbrains.intellij'
31+
2432
intellij {
25-
version ideaVersion
26-
plugins 'coverage'
27-
pluginName 'CodeGlance'
33+
version 'IC-2020.3'
34+
// plugins 'coverage'
35+
// pluginName 'CodeGlance'
2836
updateSinceUntilBuild = false
2937
}
3038

@@ -47,6 +55,6 @@ dependencies {
4755
testCompile "org.testng:testng:6.8.5"
4856
}
4957

50-
task wrapper(type: Wrapper) {
51-
gradleVersion = '3.3'
58+
wrapper {
59+
gradleVersion = '7.0.2'
5260
}

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ideaVersion = IC-14.1.4
2-
javaVersion = 1.6
3-
kotlinVersion = 1.0.5
4-
version = 1.5.4
1+
ideaVersion = IC-2021.1.0
2+
javaVersion = 1.8
3+
kotlinVersion = 1.4.32
4+
version = 1.5.5

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip

src/main/java/net/vektah/codeglance/GlancePanel.kt

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ import java.lang.ref.SoftReference
4848
/**
4949
* This JPanel gets injected into editor windows and renders a image generated by GlanceFileRenderer
5050
*/
51-
class GlancePanel(private val project: Project, fileEditor: FileEditor, private val container: JPanel, private val runner: TaskRunner) : JPanel(), VisibleAreaListener {
51+
class GlancePanel(private val project: Project, fileEditor: FileEditor, private val container: JPanel, private val runner: TaskRunner) : JPanel(),
52+
VisibleAreaListener {
5253
private val editor = (fileEditor as TextEditor).editor
5354
private var mapRef = SoftReference<Minimap>(null)
5455
private val configService = ServiceManager.getService(ConfigService::class.java)
@@ -62,7 +63,7 @@ class GlancePanel(private val project: Project, fileEditor: FileEditor, private
6263
// Anonymous Listeners that should be cleaned up.
6364
private val componentListener: ComponentListener
6465
private val documentListener: DocumentListener
65-
private val selectionListener: SelectionListener = SelectionListener { repaint() }
66+
private val selectionListener: SelectionListener
6667

6768
private val isDisabled: Boolean
6869
get() = config.disabled || editor.document.textLength > config.maxFileSize || editor.document.lineCount < config.minLineCount || container.width < config.minWindowWidth
@@ -85,8 +86,8 @@ class GlancePanel(private val project: Project, fileEditor: FileEditor, private
8586
}
8687
container.addComponentListener(componentListener)
8788

88-
documentListener = object : DocumentAdapter() {
89-
override fun documentChanged(documentEvent: DocumentEvent?) {
89+
documentListener = object : DocumentListener {
90+
override fun documentChanged(event: DocumentEvent) {
9091
updateImage()
9192
}
9293
}
@@ -96,6 +97,12 @@ class GlancePanel(private val project: Project, fileEditor: FileEditor, private
9697

9798
editor.scrollingModel.addVisibleAreaListener(this)
9899

100+
selectionListener = object :SelectionListener{
101+
override fun selectionChanged(e: SelectionEvent) {
102+
repaint()
103+
}
104+
}
105+
99106
editor.selectionModel.addSelectionListener(selectionListener)
100107
updateSize()
101108
updateImage()
@@ -120,7 +127,7 @@ class GlancePanel(private val project: Project, fileEditor: FileEditor, private
120127

121128
// the minimap is held by a soft reference so the GC can delete it at any time.
122129
// if its been deleted and we want it again (active tab) we recreate it.
123-
private fun getOrCreateMap() : Minimap? {
130+
private fun getOrCreateMap(): Minimap? {
124131
var map = mapRef.get()
125132

126133
if (map == null) {
@@ -170,10 +177,12 @@ class GlancePanel(private val project: Project, fileEditor: FileEditor, private
170177

171178

172179
if (buf != null) {
173-
g.drawImage(buf,
180+
g.drawImage(
181+
buf,
174182
0, 0, buf!!.width, buf!!.height,
175183
0, 0, buf!!.width, buf!!.height,
176-
null)
184+
null
185+
)
177186
}
178187
paintSelections(g)
179188
scrollbar.paint(gfx)
@@ -251,7 +260,7 @@ class GlancePanel(private val project: Project, fileEditor: FileEditor, private
251260
}
252261

253262
private fun paintSelections(g: Graphics2D) {
254-
paintSelection(g, editor.selectionModel.selectionStart, editor.selectionModel.selectionEnd)
263+
paintSelection(g, editor.selectionModel.selectionStart, editor.selectionModel.selectionEnd)
255264

256265
for ((index, start) in editor.selectionModel.blockSelectionStarts.withIndex()) {
257266
paintSelection(g, start, editor.selectionModel.blockSelectionEnds[index])

src/main/java/net/vektah/codeglance/config/ConfigService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import java.lang.ref.WeakReference
77
@State(
88
name = "CodeGlance",
99
storages = arrayOf(
10-
Storage(id = "other", file = StoragePathMacros.APP_CONFIG + "/CodeGlance.xml")
10+
Storage(value = StoragePathMacros.WORKSPACE_FILE + "/CodeGlance.xml")
1111
)
1212
)
1313
class ConfigService : PersistentStateComponent<Config> {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin url="https://github.com/Vektah/CodeGlance">
22
<id>net.vektah.codeglance</id>
3-
<name>CodeGlance</name>
4-
<version>1.5.4</version>
3+
<name>CodeGlance3</name>
4+
<version>1.5.5</version>
55
<vendor email="adam@vektah.net" url="https://github.com/Vektah/CodeGlance">Vektah</vendor>
66

77
<description>
@@ -10,6 +10,10 @@
1010
</description>
1111

1212
<change-notes><![CDATA[
13+
<h3>1.5.5</h3>
14+
<ul>
15+
<li>update to 2020.3</li>
16+
</ul>
1317
<h3>1.5.4</h3>
1418
<ul>
1519
<li>Bugfix: Viewport position now calculates correctly for large files -@ru5k</li>

0 commit comments

Comments
 (0)