generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into intro-course
- Loading branch information
Showing
12 changed files
with
200 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
ij-plugin/src/main/kotlin/org/jetbrains/research/tasktracker/tracking/TrackingService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.jetbrains.research.tasktracker.tracking | ||
|
||
import com.intellij.openapi.Disposable | ||
import com.intellij.openapi.application.ApplicationManager | ||
import com.intellij.openapi.components.Service | ||
import com.intellij.openapi.project.Project | ||
import kotlinx.coroutines.runBlocking | ||
import org.jetbrains.research.tasktracker.tracking.activity.ActivityTracker | ||
import org.jetbrains.research.tasktracker.tracking.fileEditor.FileEditorTracker | ||
import org.jetbrains.research.tasktracker.tracking.toolWindow.ToolWindowTracker | ||
|
||
@Service(Service.Level.PROJECT) | ||
class TrackingService : Disposable { | ||
|
||
private val trackers: MutableList<BaseTracker> = mutableListOf() | ||
|
||
fun startTracking(project: Project) { | ||
if (trackers.isNotEmpty()) { // Otherwise we can lose data | ||
return | ||
} | ||
trackers.addAll( | ||
listOf( | ||
ActivityTracker(project), | ||
ToolWindowTracker(project), | ||
FileEditorTracker(project) | ||
) | ||
) | ||
trackers.forEach { it.startTracking() } | ||
} | ||
|
||
/** | ||
* Stops the tracking process by calling the stopTracking method of each tracker. | ||
* After stopping the tracking, it invokes the send method of each tracker to send the tracked data. | ||
* | ||
* @param success A lambda that will be executed after the tracking is stopped and the data is sent successfully. | ||
* @param failure A lambda that will be executed if there is a failure in stopping the tracking or sending the data. | ||
*/ | ||
fun stopTracking(success: () -> Unit = {}, failure: () -> Unit = {}) { | ||
trackers.forEach { | ||
it.stopTracking() | ||
} | ||
ApplicationManager.getApplication().invokeAndWait { | ||
runBlocking { | ||
val result = trackers.all { | ||
it.send() | ||
} | ||
trackers.clear() | ||
if (result) success.invoke() else failure.invoke() | ||
} | ||
} | ||
} | ||
|
||
override fun dispose() { | ||
stopTracking() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/template/LoadTemplate.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.jetbrains.research.tasktracker.ui.main.panel.template | ||
|
||
class LoadTemplate : HtmlBaseFileTemplate() { | ||
override val contentFilename: String | ||
get() = "load" | ||
override val cssFilename: String | ||
get() = "load" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...src/main/resources/org/jetbrains/research/tasktracker/ui/main/panel/template/css/load.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
.lds-default { | ||
display: inline-block; | ||
position: relative; | ||
width: 80px; | ||
height: 80px; | ||
} | ||
|
||
.lds-default div { | ||
position: absolute; | ||
width: 6px; | ||
height: 6px; | ||
background: #fff; | ||
border-radius: 50%; | ||
animation: lds-default 1.2s linear infinite; | ||
} | ||
|
||
.lds-default div:nth-child(1) { | ||
animation-delay: 0s; | ||
top: 37px; | ||
left: 66px; | ||
} | ||
|
||
.lds-default div:nth-child(2) { | ||
animation-delay: -0.1s; | ||
top: 22px; | ||
left: 62px; | ||
} | ||
|
||
.lds-default div:nth-child(3) { | ||
animation-delay: -0.2s; | ||
top: 11px; | ||
left: 52px; | ||
} | ||
|
||
.lds-default div:nth-child(4) { | ||
animation-delay: -0.3s; | ||
top: 7px; | ||
left: 37px; | ||
} | ||
|
||
.lds-default div:nth-child(5) { | ||
animation-delay: -0.4s; | ||
top: 11px; | ||
left: 22px; | ||
} | ||
|
||
.lds-default div:nth-child(6) { | ||
animation-delay: -0.5s; | ||
top: 22px; | ||
left: 11px; | ||
} | ||
|
||
.lds-default div:nth-child(7) { | ||
animation-delay: -0.6s; | ||
top: 37px; | ||
left: 7px; | ||
} | ||
|
||
.lds-default div:nth-child(8) { | ||
animation-delay: -0.7s; | ||
top: 52px; | ||
left: 11px; | ||
} | ||
|
||
.lds-default div:nth-child(9) { | ||
animation-delay: -0.8s; | ||
top: 62px; | ||
left: 22px; | ||
} | ||
|
||
.lds-default div:nth-child(10) { | ||
animation-delay: -0.9s; | ||
top: 66px; | ||
left: 37px; | ||
} | ||
|
||
.lds-default div:nth-child(11) { | ||
animation-delay: -1s; | ||
top: 62px; | ||
left: 52px; | ||
} | ||
|
||
.lds-default div:nth-child(12) { | ||
animation-delay: -1.1s; | ||
top: 52px; | ||
left: 62px; | ||
} | ||
|
||
@keyframes lds-default { | ||
0%, 20%, 80%, 100% { | ||
transform: scale(1); | ||
} | ||
50% { | ||
transform: scale(1.5); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...in/src/main/resources/org/jetbrains/research/tasktracker/ui/main/panel/template/load.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class="container"> | ||
<div class="lds-default"> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
</div> | ||
<br> | ||
<p class="small-font"> | ||
Please wait while the data is being sent | ||
</p> | ||
</div> |