-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Fixed issue publishing Intellij Plugin"
This reverts commit 38c5380.
- Loading branch information
1 parent
e44aa46
commit 0e36915
Showing
25 changed files
with
1,540 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
## 2.0.1 - 2022-09-06 | ||
|
||
- Fixed issue publishing Intellij Plugin | ||
|
||
## 2.0.0 - 2022-09-02 | ||
|
||
- Updates to Kotlin 1.7.10 | ||
|
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
3 changes: 3 additions & 0 deletions
3
...ast-idea-plugin/src/main/kotlin/com/copperleaf/ballast/debugger/idea/BallastIdeaPlugin.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,3 @@ | ||
package com.copperleaf.ballast.debugger.idea | ||
|
||
class BallastIdeaPlugin |
32 changes: 32 additions & 0 deletions
32
...t-idea-plugin/src/main/kotlin/com/copperleaf/ballast/debugger/idea/base/BaseToolWindow.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,32 @@ | ||
package com.copperleaf.ballast.debugger.idea.base | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.awt.ComposePanel | ||
import com.copperleaf.ballast.debugger.idea.theme.IdeaPluginTheme | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.wm.ToolWindow | ||
import com.intellij.openapi.wm.ToolWindowFactory | ||
import com.intellij.ui.content.Content | ||
import com.intellij.ui.content.ContentFactory | ||
|
||
abstract class BaseToolWindow : ToolWindowFactory { | ||
|
||
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) { | ||
val contentFactory = ContentFactory.SERVICE.getInstance() | ||
val content: Content = contentFactory.createContent( | ||
ComposePanel().apply { | ||
setContent { | ||
IdeaPluginTheme(project) { | ||
Content() | ||
} | ||
} | ||
}, | ||
"", | ||
false, | ||
) | ||
toolWindow.contentManager.addContent(content) | ||
} | ||
|
||
@Composable | ||
abstract fun Content() | ||
} |
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
48 changes: 48 additions & 0 deletions
48
...idea-plugin/src/main/kotlin/com/copperleaf/ballast/debugger/idea/theme/IdeaPluginTheme.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,48 @@ | ||
package com.copperleaf.ballast.debugger.idea.theme | ||
|
||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.darkColors | ||
import androidx.compose.material.lightColors | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.ui.graphics.Color | ||
import com.copperleaf.ballast.debugger.di.BallastDebuggerInjector | ||
import com.copperleaf.ballast.debugger.di.LocalInjector | ||
import com.copperleaf.ballast.debugger.di.LocalProject | ||
import com.intellij.openapi.project.Project | ||
|
||
@Composable | ||
fun IdeaPluginTheme( | ||
project: Project, | ||
darkTheme: Boolean = false, | ||
content: @Composable () -> Unit, | ||
) { | ||
val primaryColor = Color(0xff_9e9e9e) | ||
val secondaryColor = Color(0xff_ffab00) | ||
|
||
val materialColors = if (darkTheme) { | ||
darkColors(primary = primaryColor, secondary = secondaryColor) | ||
} else { | ||
lightColors(primary = primaryColor, secondary = secondaryColor) | ||
} | ||
|
||
val swingColor = SwingColor() | ||
|
||
MaterialTheme( | ||
colors = materialColors.copy( | ||
background = swingColor.background, | ||
onBackground = swingColor.onBackground, | ||
surface = swingColor.background, | ||
onSurface = swingColor.onBackground, | ||
), | ||
typography = typography, | ||
content = { | ||
CompositionLocalProvider( | ||
LocalProject provides project, | ||
LocalInjector provides BallastDebuggerInjector.getInstance(project), | ||
) { | ||
content() | ||
} | ||
} | ||
) | ||
} |
74 changes: 74 additions & 0 deletions
74
ballast-idea-plugin/src/main/kotlin/com/copperleaf/ballast/debugger/idea/theme/SwingColor.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,74 @@ | ||
package com.copperleaf.ballast.debugger.idea.theme | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.DisposableEffect | ||
import androidx.compose.runtime.MutableState | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.graphics.Color | ||
import com.intellij.ide.ui.LafManager | ||
import com.intellij.ide.ui.LafManagerListener | ||
import com.intellij.openapi.application.ApplicationManager | ||
import javax.swing.UIManager | ||
import java.awt.Color as AWTColor | ||
|
||
internal class ThemeChangeListener( | ||
val updateColors: () -> Unit | ||
) : LafManagerListener { | ||
override fun lookAndFeelChanged(source: LafManager) { | ||
updateColors() | ||
} | ||
} | ||
|
||
interface SwingColor { | ||
val background: Color | ||
val onBackground: Color | ||
} | ||
|
||
@Composable | ||
fun SwingColor(): SwingColor { | ||
val swingColor = remember { SwingColorImpl() } | ||
|
||
val messageBus = remember { | ||
ApplicationManager.getApplication().messageBus.connect() | ||
} | ||
|
||
remember(messageBus) { | ||
messageBus.subscribe( | ||
LafManagerListener.TOPIC, | ||
ThemeChangeListener(swingColor::updateCurrentColors) | ||
) | ||
} | ||
|
||
DisposableEffect(messageBus) { | ||
onDispose { | ||
messageBus.disconnect() | ||
} | ||
} | ||
|
||
return swingColor | ||
} | ||
|
||
private class SwingColorImpl : SwingColor { | ||
private val _backgroundState: MutableState<Color> = mutableStateOf(getBackgroundColor) | ||
private val _onBackgroundState: MutableState<Color> = mutableStateOf(getOnBackgroundColor) | ||
|
||
override val background: Color get() = _backgroundState.value | ||
override val onBackground: Color get() = _onBackgroundState.value | ||
|
||
private val getBackgroundColor get() = getColor(BACKGROUND_KEY) | ||
private val getOnBackgroundColor get() = getColor(ON_BACKGROUND_KEY) | ||
|
||
fun updateCurrentColors() { | ||
_backgroundState.value = getBackgroundColor | ||
_onBackgroundState.value = getOnBackgroundColor | ||
} | ||
|
||
private val AWTColor.asComposeColor: Color get() = Color(red, green, blue, alpha) | ||
private fun getColor(key: String): Color = UIManager.getColor(key).asComposeColor | ||
|
||
companion object { | ||
private const val BACKGROUND_KEY = "Panel.background" | ||
private const val ON_BACKGROUND_KEY = "Panel.foreground" | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
ballast-idea-plugin/src/main/kotlin/com/copperleaf/ballast/debugger/idea/theme/typography.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,43 @@ | ||
package com.copperleaf.ballast.debugger.idea.theme | ||
|
||
import androidx.compose.material.Typography | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.sp | ||
|
||
val typography = Typography( | ||
body1 = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 16.sp | ||
), | ||
body2 = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 14.sp | ||
), | ||
button = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.W500, | ||
fontSize = 14.sp | ||
), | ||
caption = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 12.sp, | ||
), | ||
subtitle1 = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 16.sp, | ||
color = Color.Gray | ||
), | ||
subtitle2 = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 14.sp, | ||
color = Color.Gray | ||
), | ||
) |
14 changes: 14 additions & 0 deletions
14
...in/src/main/kotlin/com/copperleaf/ballast/debugger/idea/tool/BallastDebuggerToolWindow.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,14 @@ | ||
package com.copperleaf.ballast.debugger.idea.tool | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.copperleaf.ballast.debugger.idea.base.BaseToolWindow | ||
import com.copperleaf.ballast.debugger.ui.debugger.DebuggerUi | ||
import com.intellij.openapi.project.DumbAware | ||
|
||
class BallastDebuggerToolWindow : BaseToolWindow(), DumbAware { | ||
|
||
@Composable | ||
override fun Content() { | ||
DebuggerUi.run() | ||
} | ||
} |
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.