Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ide version upgrade #85

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ pluginRepositoryUrl = https://github.com/JetBrains-Research/tasktracker-3
pluginVersion = 0.0.1

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 222
pluginUntilBuild = 231.*
pluginSinceBuild = 223
pluginUntilBuild = 233.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC
platformVersion = 2022.2.4
platformVersion = 2023.2.5

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,19 @@ data class Scenario(

@Suppress("ReturnCount")
fun getNextUnit(project: Project): ScenarioUnit? {
if (!currentStepIterator.notNullAndHasNext()) {
return null
}
cleanStepSettings()
val currentStep = getNextStep() ?: return null
currentStep.prepareSettings(project)
currentStepIterator = currentStep.getUnits().iterator()
return if (currentStepIterator.notNullAndHasNext()) {
currentStepIterator?.next()
} else {
null
if (currentStepIterator.notNullAndHasNext()) {
cleanStepSettings()
val currentStep = getNextStep() ?: return null
currentStep.prepareSettings(project)
currentStepIterator = currentStep.getUnits().iterator()
if (currentStepIterator.notNullAndHasNext()) {
return null
}
}
return currentStepIterator?.next()
}

private fun Iterator<ScenarioUnit>?.notNullAndHasNext() = this?.hasNext() ?: false
private fun Iterator<ScenarioUnit>?.notNullAndHasNext() = this?.hasNext() != true

private fun cleanStepSettings() =
MainPanelStorage.activeIdeHandlers.forEach {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.jetbrains.research.tasktracker.ui.main.panel

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.util.io.FileUtil
import org.jetbrains.concurrency.Promise
import org.jetbrains.research.tasktracker.config.MainTaskTrackerConfig
import org.jetbrains.research.tasktracker.ui.main.panel.models.ButtonState
import org.jetbrains.research.tasktracker.ui.main.panel.models.LinkType
Expand Down Expand Up @@ -79,3 +81,12 @@ fun saveAgreements(agreementString: String) {
FileUtil.createIfDoesntExist(agreementFile)
agreementFile.writeText(agreementString)
}

fun<T> Promise<T>.runOnSuccess(task: (response: T) -> Unit) =
onSuccess {
ApplicationManager.getApplication().invokeLater {
task(it)
}
}.onError {
error(it.localizedMessage)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.jetbrains.research.tasktracker.config.scenario.models.*
import org.jetbrains.research.tasktracker.tracking.TaskFileHandler
import org.jetbrains.research.tasktracker.tracking.activity.ActivityTracker
import org.jetbrains.research.tasktracker.ui.main.panel.MainPluginPanelFactory
import org.jetbrains.research.tasktracker.ui.main.panel.runOnSuccess
import org.jetbrains.research.tasktracker.ui.main.panel.storage.MainPanelStorage
import org.jetbrains.research.tasktracker.ui.main.panel.template.*
import org.jetbrains.research.tasktracker.util.UIBundle
Expand All @@ -25,17 +26,13 @@ typealias Panel = MainPluginPanelFactory
fun Panel.agreementAcceptance() {
loadBasePage(AgreementTemplate.loadCurrentTemplate(), "ui.button.next", false)
setNextAction {
checkInputs()
.onSuccess {
if (!it) {
welcomePage()
} else {
notifyError(project, UIBundle.message("ui.please.fill"))
}
}
.onError {
error(it.localizedMessage)
checkInputs().runOnSuccess {
if (!it) {
welcomePage()
} else {
notifyError(project, UIBundle.message("ui.please.fill"))
}
}
}
}

Expand All @@ -58,10 +55,8 @@ private fun Panel.selectTask(taskIds: List<String>, allRequired: Boolean = true)
val tasks = TaskTrackerPlugin.mainConfig.taskContentConfig?.tasks?.filter { it.id in taskIds } ?: emptyList()
loadBasePage(TasksPageTemplate(tasks))
setNextAction {
mainWindow.getElementValue("tasks").onSuccess { name ->
mainWindow.getElementValue("tasks").runOnSuccess { name ->
solveTask(name.toString(), if (allRequired) taskIds.filter { it != name } else emptyList())
}.onError {
error(it.localizedMessage)
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion ij-plugin/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<resource-bundle>messages.MyBundle</resource-bundle>

<extensions defaultExtensionNs="com.intellij">
<toolWindow factoryClass="org.jetbrains.research.tasktracker.ui.main.panel.MainPluginPanelFactory"
<toolWindow doNotActivateOnStart="true"
factoryClass="org.jetbrains.research.tasktracker.ui.main.panel.MainPluginPanelFactory"
id="TaskTracker" anchor="right"/>
<postStartupActivity implementation="org.jetbrains.research.tasktracker.activities.InitActivity"/>
<notificationGroup id="tasktracker" displayType="BALLOON"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ class InspectionConfigTest : LightPlatformTestCase() {
}

companion object {
const val DEFAULT_ENABLED_INSPECTION_SIZE = 55
const val DISABLE_SELECTED_ENABLED_INSPECTION_SIZE = 53
const val ADD_SELECTED_ENABLED_INSPECTION_SIZE = 57
const val DEFAULT_ENABLED_INSPECTION_SIZE = 53
const val DISABLE_SELECTED_ENABLED_INSPECTION_SIZE = 51
const val ADD_SELECTED_ENABLED_INSPECTION_SIZE = 55
val enableSelectedTools = listOf("LongLine", "TodoComment")
val disableSelectedTools = listOf("CheckTagEmptyBody", "RegExpRedundantEscape")
val addSelectedTools = listOf("EmptyDirectory", "ProblematicWhitespace")
Expand Down
Loading