Skip to content

Commit

Permalink
fix: windows paths #5
Browse files Browse the repository at this point in the history
  • Loading branch information
gmyasoedov committed Mar 25, 2024
1 parent eb5e7c7 commit c8ed1d3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ class ChangeProfileStateAction : ExternalSystemNodeAction<ProfileData>(ProfileDa
val state = ProfileState()
state.simpleProfile = simpleProfile
state.activationProfile = activationProfile
ProjectProfilesStateService.getInstance(project).state.mapping.put(profileData.stateKey, state)
ProjectProfilesStateService.getInstance(project).state.mapping[profileData.stateKey] = state
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import com.intellij.openapi.externalSystem.service.notification.ExternalSystemNo
import com.intellij.openapi.externalSystem.service.notification.NotificationData
import com.intellij.openapi.externalSystem.service.notification.callback.OpenExternalSystemSettingsCallback
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.registry.Registry
import ru.rzn.gmyasoedov.gmaven.GMavenConstants
import ru.rzn.gmyasoedov.gmaven.project.externalSystem.notification.OpenGMavenSettingsCallback
import ru.rzn.gmyasoedov.gmaven.project.externalSystem.notification.ShowFullLogCallback
import ru.rzn.gmyasoedov.gmaven.utils.MavenLog

class GMavenNotificationExtension : ExternalSystemNotificationExtension {

Expand All @@ -17,6 +19,7 @@ class GMavenNotificationExtension : ExternalSystemNotificationExtension {
override fun customize(
notificationData: NotificationData, project: Project, externalProjectPath: String, error: Throwable?
) {
printError(error)
val e = (if (error is ExternalSystemException) error else null) ?: return
for (fix in e.quickFixes) {
if (OpenGMavenSettingsCallback.ID == fix) {
Expand All @@ -33,4 +36,11 @@ class GMavenNotificationExtension : ExternalSystemNotificationExtension {
}
}
}

private fun printError(error: Throwable?) {
if (!Registry.`is`("gmaven.show.all.errors")) return
if (error?.stackTrace?.any { it.className.contains("ru.rzn.gmyasoedov.gmaven") } == true) {
MavenLog.LOG.error(error)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ fun fillExecutionWorkSpace(
?.externalProjectStructure ?: return

val allModules = ExternalSystemApiUtil.findAll(projectDataNode, ProjectKeys.MODULE)
val mainModuleNode = allModules.first { it.data.linkedExternalProjectPath == projectSettings.externalProjectPath }

val mainModuleNode = allModules
.find { MavenUtils.equalsPaths(it.data.linkedExternalProjectPath, projectSettings.externalProjectPath) }
workspace.externalProjectPath = projectSettings.externalProjectPath
workspace.projectBuildFile = if (projectSettings.projectBuildFile != null) projectSettings.projectBuildFile else
mainModuleNode.data.getProperty(GMavenConstants.MODULE_PROP_BUILD_FILE)
mainModuleNode?.data?.getProperty(GMavenConstants.MODULE_PROP_BUILD_FILE)

val isRootPath = MavenUtils.equalsPaths(projectSettings.externalProjectPath, projectPath)
var targetModuleNode: DataNode<ModuleData>? = null
Expand Down
2 changes: 2 additions & 0 deletions gmaven/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@
description="New import logic for library"/>
<registryKey key="gmaven.search.artifact.maven.central" defaultValue="true"
description="Search artifacts in maven central"/>
<registryKey key="gmaven.show.all.errors" defaultValue="false"
description="Print all GMaven errors in idea.log"/>
<registryKey key="GMAVEN.system.in.process" defaultValue="true"
description="Whether IDEA should use 'in-process' mode for interaction with plugin api"/>

Expand Down

0 comments on commit c8ed1d3

Please sign in to comment.