generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
108 changed files
with
861 additions
and
18,123 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
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
70 changes: 70 additions & 0 deletions
70
ide-common/src/main/kotlin/org/digma/intellij/plugin/paths/DigmaPathManager.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,70 @@ | ||
package org.digma.intellij.plugin.paths | ||
|
||
import com.intellij.openapi.application.ApplicationNamesInfo | ||
import com.intellij.openapi.application.PathManager | ||
import com.intellij.openapi.util.SystemInfo | ||
import org.digma.intellij.plugin.errorreporting.ErrorReporter | ||
import java.io.File | ||
|
||
const val DIGMA_DIR = "digma-intellij-plugin" | ||
|
||
class DigmaPathManager { | ||
|
||
|
||
companion object { | ||
|
||
fun getLocalFilesDirectoryPath(): String { | ||
val ideFullName = ApplicationNamesInfo.getInstance().fullProductNameWithEdition | ||
val ideHomeDir = PathManager.getHomePath().substringAfterLast("/") | ||
val ideName = "$ideFullName-$ideHomeDir".replace(" ", "-").replace(".","-") | ||
return try { | ||
val baseDir = getBaseDirectory() | ||
val ideDir = File(baseDir,ideName) | ||
ideDir.mkdirs() | ||
ideDir.absolutePath | ||
}catch (e:Throwable){ | ||
ErrorReporter.getInstance().reportError("DigmaPathManager.getLocalFilesDirectoryPath", e) | ||
val fallback = File(System.getProperty("java.io.tmpdir"), "$DIGMA_DIR/$ideName") | ||
fallback.mkdirs() | ||
fallback.absolutePath | ||
} | ||
} | ||
|
||
|
||
private fun getUserHome(): String { | ||
//user.home should never be null, but just in case,use temp dir | ||
return System.getProperty("user.home") ?: System.getProperty("java.io.tmpdir") | ||
} | ||
|
||
|
||
private fun getBaseDirectory(): File { | ||
|
||
return try { | ||
if (SystemInfo.isMac) { | ||
val userHome = getUserHome() | ||
val digmaDir = File(userHome, "Library/Application Support/$DIGMA_DIR") | ||
digmaDir.mkdirs() | ||
digmaDir | ||
} else if (SystemInfo.isWindows) { | ||
val userHome = System.getenv("LOCALAPPDATA") ?: getUserHome() | ||
val digmaDir = File(userHome, DIGMA_DIR) | ||
digmaDir.mkdirs() | ||
digmaDir | ||
} else { | ||
//for linux or any other os | ||
val userHome = getUserHome() | ||
val digmaDir = File(userHome, ".$DIGMA_DIR") | ||
digmaDir.mkdirs() | ||
digmaDir | ||
} | ||
|
||
} catch (e: Throwable) { | ||
ErrorReporter.getInstance().reportError("DigmaPathManager.getBaseDirectory", e) | ||
val userHome = getUserHome() | ||
val digmaDir = File(userHome, ".$DIGMA_DIR") | ||
digmaDir.mkdirs() | ||
digmaDir | ||
} | ||
} | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
ide-common/src/main/kotlin/org/digma/intellij/plugin/reload/ReloadSource.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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package org.digma.intellij.plugin.reload | ||
|
||
enum class ReloadSource { | ||
RELOAD_ACTION,RELOAD_OBSERVER | ||
RELOAD_ACTION,RELOAD_OBSERVER,UI_UPDATE | ||
} |
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
Oops, something went wrong.