Browse Source
Plugin authors should refer to Jewel documentation instead https://github.com/JetBrains/intellij-community/tree/master/platform/jewel Part of CMP-8573 ## Release Notes ### Migration Notes - Desktop Removed IntelliJ plugin sample, please refer to [Jewel](https://github.com/JetBrains/intellij-community/tree/master/platform/jewel) documentation insteadivan.matkov/update-deps-cupcake v1.9.10+dev2758
27 changed files with 0 additions and 1016 deletions
@ -1,15 +0,0 @@
@@ -1,15 +0,0 @@
|
||||
*.iml |
||||
.gradle |
||||
/local.properties |
||||
/.idea |
||||
/.idea/caches |
||||
/.idea/libraries |
||||
/.idea/modules.xml |
||||
/.idea/workspace.xml |
||||
/.idea/navEditor.xml |
||||
/.idea/assetWizardSettings.xml |
||||
.DS_Store |
||||
build/ |
||||
/captures |
||||
.externalNativeBuild |
||||
.cxx |
||||
@ -1,23 +0,0 @@
@@ -1,23 +0,0 @@
|
||||
<component name="ProjectRunConfigurationManager"> |
||||
<configuration default="false" name="runIde" type="GradleRunConfiguration" factoryName="Gradle"> |
||||
<ExternalSystemSettings> |
||||
<option name="executionName" /> |
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" /> |
||||
<option name="externalSystemIdString" value="GRADLE" /> |
||||
<option name="scriptParameters" value="" /> |
||||
<option name="taskDescriptions"> |
||||
<list /> |
||||
</option> |
||||
<option name="taskNames"> |
||||
<list> |
||||
<option value="runIde" /> |
||||
</list> |
||||
</option> |
||||
<option name="vmOptions" /> |
||||
</ExternalSystemSettings> |
||||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> |
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> |
||||
<DebugAllEnabled>false</DebugAllEnabled> |
||||
<method v="2" /> |
||||
</configuration> |
||||
</component> |
||||
@ -1,13 +0,0 @@
@@ -1,13 +0,0 @@
|
||||
## Example CFD based plugin for IntelliJ Idea. |
||||
|
||||
To run the example: |
||||
|
||||
1. from directory `compose-jb/examples/intellij-plugin`: |
||||
* Run command in terminal `./gradlew runIde`. |
||||
* Or choose **runIde** configuration in IDE and run it. |
||||
 |
||||
2. create project or open any existing |
||||
3. from menu `Tools` select `Show Compose Demo...` |
||||
|
||||
 |
||||
 |
||||
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
plugins { |
||||
id("org.jetbrains.intellij") version "1.17.2" |
||||
java |
||||
kotlin("jvm") |
||||
kotlin("plugin.compose") |
||||
id("org.jetbrains.compose") |
||||
id("idea") |
||||
} |
||||
|
||||
group = "org.example" |
||||
version = "1.0-SNAPSHOT" |
||||
|
||||
repositories { |
||||
mavenCentral() |
||||
google() |
||||
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } |
||||
} |
||||
|
||||
dependencies { |
||||
implementation(compose.desktop.currentOs) |
||||
implementation("org.jetbrains.compose.material:material-icons-core:1.6.11") |
||||
testImplementation("junit", "junit", "4.12") |
||||
} |
||||
|
||||
// See https://github.com/JetBrains/gradle-intellij-plugin/ |
||||
intellij { |
||||
version.set("2021.3") |
||||
} |
||||
|
||||
kotlin { |
||||
jvmToolchain { |
||||
languageVersion.set(JavaLanguageVersion.of(11)) |
||||
} |
||||
} |
||||
@ -1,5 +0,0 @@
@@ -1,5 +0,0 @@
|
||||
kotlin.code.style=official |
||||
kotlin.version=2.1.20 |
||||
compose.version=1.8.2 |
||||
org.gradle.configuration-cache=true |
||||
org.gradle.caching=true |
||||
Binary file not shown.
@ -1,5 +0,0 @@
@@ -1,5 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME |
||||
distributionPath=wrapper/dists |
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip |
||||
zipStoreBase=GRADLE_USER_HOME |
||||
zipStorePath=wrapper/dists |
||||
@ -1,240 +0,0 @@
@@ -1,240 +0,0 @@
|
||||
#!/bin/sh |
||||
|
||||
# |
||||
# Copyright © 2015-2021 the original authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# https://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
# |
||||
|
||||
############################################################################## |
||||
# |
||||
# Gradle start up script for POSIX generated by Gradle. |
||||
# |
||||
# Important for running: |
||||
# |
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is |
||||
# noncompliant, but you have some other compliant shell such as ksh or |
||||
# bash, then to run this script, type that shell name before the whole |
||||
# command line, like: |
||||
# |
||||
# ksh Gradle |
||||
# |
||||
# Busybox and similar reduced shells will NOT work, because this script |
||||
# requires all of these POSIX shell features: |
||||
# * functions; |
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», |
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»; |
||||
# * compound commands having a testable exit status, especially «case»; |
||||
# * various built-in commands including «command», «set», and «ulimit». |
||||
# |
||||
# Important for patching: |
||||
# |
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided |
||||
# by Bash, Ksh, etc; in particular arrays are avoided. |
||||
# |
||||
# The "traditional" practice of packing multiple parameters into a |
||||
# space-separated string is a well documented source of bugs and security |
||||
# problems, so this is (mostly) avoided, by progressively accumulating |
||||
# options in "$@", and eventually passing that to Java. |
||||
# |
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, |
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; |
||||
# see the in-line comments for details. |
||||
# |
||||
# There are tweaks for specific operating systems such as AIX, CygWin, |
||||
# Darwin, MinGW, and NonStop. |
||||
# |
||||
# (3) This script is generated from the Groovy template |
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt |
||||
# within the Gradle project. |
||||
# |
||||
# You can find Gradle at https://github.com/gradle/gradle/. |
||||
# |
||||
############################################################################## |
||||
|
||||
# Attempt to set APP_HOME |
||||
|
||||
# Resolve links: $0 may be a link |
||||
app_path=$0 |
||||
|
||||
# Need this for daisy-chained symlinks. |
||||
while |
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path |
||||
[ -h "$app_path" ] |
||||
do |
||||
ls=$( ls -ld "$app_path" ) |
||||
link=${ls#*' -> '} |
||||
case $link in #( |
||||
/*) app_path=$link ;; #( |
||||
*) app_path=$APP_HOME$link ;; |
||||
esac |
||||
done |
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit |
||||
|
||||
APP_NAME="Gradle" |
||||
APP_BASE_NAME=${0##*/} |
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' |
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value. |
||||
MAX_FD=maximum |
||||
|
||||
warn () { |
||||
echo "$*" |
||||
} >&2 |
||||
|
||||
die () { |
||||
echo |
||||
echo "$*" |
||||
echo |
||||
exit 1 |
||||
} >&2 |
||||
|
||||
# OS specific support (must be 'true' or 'false'). |
||||
cygwin=false |
||||
msys=false |
||||
darwin=false |
||||
nonstop=false |
||||
case "$( uname )" in #( |
||||
CYGWIN* ) cygwin=true ;; #( |
||||
Darwin* ) darwin=true ;; #( |
||||
MSYS* | MINGW* ) msys=true ;; #( |
||||
NONSTOP* ) nonstop=true ;; |
||||
esac |
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar |
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM. |
||||
if [ -n "$JAVA_HOME" ] ; then |
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then |
||||
# IBM's JDK on AIX uses strange locations for the executables |
||||
JAVACMD=$JAVA_HOME/jre/sh/java |
||||
else |
||||
JAVACMD=$JAVA_HOME/bin/java |
||||
fi |
||||
if [ ! -x "$JAVACMD" ] ; then |
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME |
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the |
||||
location of your Java installation." |
||||
fi |
||||
else |
||||
JAVACMD=java |
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. |
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the |
||||
location of your Java installation." |
||||
fi |
||||
|
||||
# Increase the maximum file descriptors if we can. |
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then |
||||
case $MAX_FD in #( |
||||
max*) |
||||
MAX_FD=$( ulimit -H -n ) || |
||||
warn "Could not query maximum file descriptor limit" |
||||
esac |
||||
case $MAX_FD in #( |
||||
'' | soft) :;; #( |
||||
*) |
||||
ulimit -n "$MAX_FD" || |
||||
warn "Could not set maximum file descriptor limit to $MAX_FD" |
||||
esac |
||||
fi |
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order: |
||||
# * args from the command line |
||||
# * the main class name |
||||
# * -classpath |
||||
# * -D...appname settings |
||||
# * --module-path (only if needed) |
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. |
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java |
||||
if "$cygwin" || "$msys" ; then |
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) |
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) |
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" ) |
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh |
||||
for arg do |
||||
if |
||||
case $arg in #( |
||||
-*) false ;; # don't mess with options #( |
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath |
||||
[ -e "$t" ] ;; #( |
||||
*) false ;; |
||||
esac |
||||
then |
||||
arg=$( cygpath --path --ignore --mixed "$arg" ) |
||||
fi |
||||
# Roll the args list around exactly as many times as the number of |
||||
# args, so each arg winds up back in the position where it started, but |
||||
# possibly modified. |
||||
# |
||||
# NB: a `for` loop captures its iteration list before it begins, so |
||||
# changing the positional parameters here affects neither the number of |
||||
# iterations, nor the values presented in `arg`. |
||||
shift # remove old arg |
||||
set -- "$@" "$arg" # push replacement arg |
||||
done |
||||
fi |
||||
|
||||
# Collect all arguments for the java command; |
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of |
||||
# shell script including quotes and variable substitutions, so put them in |
||||
# double quotes to make sure that they get re-expanded; and |
||||
# * put everything else in single quotes, so that it's not re-expanded. |
||||
|
||||
set -- \ |
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \ |
||||
-classpath "$CLASSPATH" \ |
||||
org.gradle.wrapper.GradleWrapperMain \ |
||||
"$@" |
||||
|
||||
# Stop when "xargs" is not available. |
||||
if ! command -v xargs >/dev/null 2>&1 |
||||
then |
||||
die "xargs is not available" |
||||
fi |
||||
|
||||
# Use "xargs" to parse quoted args. |
||||
# |
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. |
||||
# |
||||
# In Bash we could simply go: |
||||
# |
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) && |
||||
# set -- "${ARGS[@]}" "$@" |
||||
# |
||||
# but POSIX shell has neither arrays nor command substitution, so instead we |
||||
# post-process each arg (as a line of input to sed) to backslash-escape any |
||||
# character that might be a shell metacharacter, then use eval to reverse |
||||
# that process (while maintaining the separation between arguments), and wrap |
||||
# the whole thing up as a single "set" statement. |
||||
# |
||||
# This will of course break if any of these variables contains a newline or |
||||
# an unmatched quote. |
||||
# |
||||
|
||||
eval "set -- $( |
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | |
||||
xargs -n1 | |
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | |
||||
tr '\n' ' ' |
||||
)" '"$@"' |
||||
|
||||
exec "$JAVACMD" "$@" |
||||
@ -1,91 +0,0 @@
@@ -1,91 +0,0 @@
|
||||
@rem |
||||
@rem Copyright 2015 the original author or authors. |
||||
@rem |
||||
@rem Licensed under the Apache License, Version 2.0 (the "License"); |
||||
@rem you may not use this file except in compliance with the License. |
||||
@rem You may obtain a copy of the License at |
||||
@rem |
||||
@rem https://www.apache.org/licenses/LICENSE-2.0 |
||||
@rem |
||||
@rem Unless required by applicable law or agreed to in writing, software |
||||
@rem distributed under the License is distributed on an "AS IS" BASIS, |
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
@rem See the License for the specific language governing permissions and |
||||
@rem limitations under the License. |
||||
@rem |
||||
|
||||
@if "%DEBUG%"=="" @echo off |
||||
@rem ########################################################################## |
||||
@rem |
||||
@rem Gradle startup script for Windows |
||||
@rem |
||||
@rem ########################################################################## |
||||
|
||||
@rem Set local scope for the variables with windows NT shell |
||||
if "%OS%"=="Windows_NT" setlocal |
||||
|
||||
set DIRNAME=%~dp0 |
||||
if "%DIRNAME%"=="" set DIRNAME=. |
||||
set APP_BASE_NAME=%~n0 |
||||
set APP_HOME=%DIRNAME% |
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter. |
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi |
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" |
||||
|
||||
@rem Find java.exe |
||||
if defined JAVA_HOME goto findJavaFromJavaHome |
||||
|
||||
set JAVA_EXE=java.exe |
||||
%JAVA_EXE% -version >NUL 2>&1 |
||||
if %ERRORLEVEL% equ 0 goto execute |
||||
|
||||
echo. |
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. |
||||
echo. |
||||
echo Please set the JAVA_HOME variable in your environment to match the |
||||
echo location of your Java installation. |
||||
|
||||
goto fail |
||||
|
||||
:findJavaFromJavaHome |
||||
set JAVA_HOME=%JAVA_HOME:"=% |
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe |
||||
|
||||
if exist "%JAVA_EXE%" goto execute |
||||
|
||||
echo. |
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% |
||||
echo. |
||||
echo Please set the JAVA_HOME variable in your environment to match the |
||||
echo location of your Java installation. |
||||
|
||||
goto fail |
||||
|
||||
:execute |
||||
@rem Setup the command line |
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar |
||||
|
||||
|
||||
@rem Execute Gradle |
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* |
||||
|
||||
:end |
||||
@rem End local scope for the variables with windows NT shell |
||||
if %ERRORLEVEL% equ 0 goto mainEnd |
||||
|
||||
:fail |
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of |
||||
rem the _cmd.exe /c_ return code! |
||||
set EXIT_CODE=%ERRORLEVEL% |
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1 |
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% |
||||
exit /b %EXIT_CODE% |
||||
|
||||
:mainEnd |
||||
if "%OS%"=="Windows_NT" endlocal |
||||
|
||||
:omega |
||||
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 206 KiB |
|
Before Width: | Height: | Size: 152 KiB |
@ -1,9 +0,0 @@
@@ -1,9 +0,0 @@
|
||||
rootProject.name = "ComposeDemoPlugin" |
||||
|
||||
pluginManagement { |
||||
plugins { |
||||
kotlin("jvm").version(extra["kotlin.version"] as String) |
||||
kotlin("plugin.compose").version(extra["kotlin.version"] as String) |
||||
id("org.jetbrains.compose").version(extra["compose.version"] as String) |
||||
} |
||||
} |
||||
@ -1,65 +0,0 @@
@@ -1,65 +0,0 @@
|
||||
package com.jetbrains.compose |
||||
|
||||
import androidx.compose.foundation.layout.Box |
||||
import androidx.compose.foundation.layout.Column |
||||
import androidx.compose.foundation.layout.Row |
||||
import androidx.compose.foundation.layout.fillMaxHeight |
||||
import androidx.compose.foundation.layout.fillMaxSize |
||||
import androidx.compose.material.Surface |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.awt.ComposePanel |
||||
import com.intellij.openapi.actionSystem.AnActionEvent |
||||
import com.intellij.openapi.project.DumbAwareAction |
||||
import com.intellij.openapi.project.Project |
||||
import com.intellij.openapi.ui.DialogWrapper |
||||
import com.jetbrains.compose.theme.WidgetTheme |
||||
import com.jetbrains.compose.widgets.Buttons |
||||
import com.jetbrains.compose.widgets.LazyScrollable |
||||
import com.jetbrains.compose.widgets.Loaders |
||||
import com.jetbrains.compose.widgets.TextInputs |
||||
import com.jetbrains.compose.widgets.Toggles |
||||
import javax.swing.JComponent |
||||
|
||||
|
||||
/** |
||||
* @author Konstantin Bulenkov |
||||
*/ |
||||
class ComposeDemoAction : DumbAwareAction() { |
||||
override fun actionPerformed(e: AnActionEvent) { |
||||
DemoDialog(e.project).show() |
||||
} |
||||
|
||||
class DemoDialog(project: Project?) : DialogWrapper(project) { |
||||
init { |
||||
title = "Demo" |
||||
init() |
||||
} |
||||
|
||||
override fun createCenterPanel(): JComponent { |
||||
return ComposePanel().apply { |
||||
setBounds(0, 0, 800, 600) |
||||
setContent { |
||||
WidgetTheme(darkTheme = true) { |
||||
Surface(modifier = Modifier.fillMaxSize()) { |
||||
Row { |
||||
Column( |
||||
modifier = Modifier.fillMaxHeight().weight(1f) |
||||
) { |
||||
Buttons() |
||||
Loaders() |
||||
TextInputs() |
||||
Toggles() |
||||
} |
||||
Box( |
||||
modifier = Modifier.fillMaxHeight().weight(1f) |
||||
) { |
||||
LazyScrollable() |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -1,9 +0,0 @@
@@ -1,9 +0,0 @@
|
||||
package com.jetbrains.compose.theme |
||||
|
||||
import androidx.compose.ui.graphics.Color |
||||
|
||||
val green200 = Color(0xffa5d6a7) |
||||
val green500 = Color(0xff4caf50) |
||||
val green700 = Color(0xff388e3c) |
||||
|
||||
val teal200 = Color(0xff80deea) |
||||
@ -1,11 +0,0 @@
@@ -1,11 +0,0 @@
|
||||
package com.jetbrains.compose.theme |
||||
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape |
||||
import androidx.compose.material.Shapes |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
val shapes = Shapes( |
||||
small = RoundedCornerShape(4.dp), |
||||
medium = RoundedCornerShape(4.dp), |
||||
large = RoundedCornerShape(0.dp) |
||||
) |
||||
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
package com.jetbrains.compose.theme |
||||
|
||||
import androidx.compose.material.MaterialTheme |
||||
import androidx.compose.material.darkColors |
||||
import androidx.compose.material.lightColors |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.graphics.Color |
||||
import com.jetbrains.compose.theme.intellij.SwingColor |
||||
|
||||
private val DarkGreenColorPalette = darkColors( |
||||
primary = green200, |
||||
primaryVariant = green700, |
||||
secondary = teal200, |
||||
onPrimary = Color.Black, |
||||
onSecondary = Color.White, |
||||
error = Color.Red, |
||||
) |
||||
|
||||
private val LightGreenColorPalette = lightColors( |
||||
primary = green500, |
||||
primaryVariant = green700, |
||||
secondary = teal200, |
||||
onPrimary = Color.White, |
||||
onSurface = Color.Black |
||||
) |
||||
|
||||
@Composable |
||||
fun WidgetTheme( |
||||
darkTheme: Boolean = false, |
||||
content: @Composable() () -> Unit, |
||||
) { |
||||
val colors = if (darkTheme) DarkGreenColorPalette else LightGreenColorPalette |
||||
val swingColor = SwingColor() |
||||
|
||||
MaterialTheme( |
||||
colors = colors.copy( |
||||
background = swingColor.background, |
||||
onBackground = swingColor.onBackground, |
||||
surface = swingColor.background, |
||||
onSurface = swingColor.onBackground, |
||||
), |
||||
typography = typography, |
||||
shapes = shapes, |
||||
content = content |
||||
) |
||||
} |
||||
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
package com.jetbrains.compose.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 |
||||
), |
||||
) |
||||
@ -1,61 +0,0 @@
@@ -1,61 +0,0 @@
|
||||
package com.jetbrains.compose.theme.intellij |
||||
|
||||
import androidx.compose.runtime.* |
||||
import androidx.compose.ui.graphics.Color |
||||
import com.intellij.ide.ui.LafManagerListener |
||||
import com.intellij.openapi.application.ApplicationManager |
||||
import javax.swing.UIManager |
||||
import java.awt.Color as AWTColor |
||||
|
||||
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" |
||||
} |
||||
} |
||||
@ -1,13 +0,0 @@
@@ -1,13 +0,0 @@
|
||||
package com.jetbrains.compose.theme.intellij |
||||
|
||||
import com.intellij.ide.ui.LafManager |
||||
import com.intellij.ide.ui.LafManagerListener |
||||
|
||||
internal class ThemeChangeListener( |
||||
val updateColors: () -> Unit |
||||
) : LafManagerListener { |
||||
override fun lookAndFeelChanged(source: LafManager) { |
||||
updateColors() |
||||
} |
||||
} |
||||
|
||||
@ -1,57 +0,0 @@
@@ -1,57 +0,0 @@
|
||||
package com.jetbrains.compose.widgets |
||||
|
||||
import androidx.compose.foundation.layout.Row |
||||
import androidx.compose.foundation.layout.padding |
||||
import androidx.compose.material.Button |
||||
import androidx.compose.material.TextButton |
||||
import androidx.compose.material.OutlinedButton |
||||
import androidx.compose.material.Text |
||||
import androidx.compose.material.Icon |
||||
import androidx.compose.material.icons.Icons |
||||
import androidx.compose.material.icons.filled.FavoriteBorder |
||||
import androidx.compose.material.icons.filled.Refresh |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.runtime.mutableStateOf |
||||
import androidx.compose.runtime.remember |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
@Composable |
||||
fun Buttons() { |
||||
Row { |
||||
val btnEnabled = remember { mutableStateOf(true) } |
||||
Button( |
||||
onClick = { btnEnabled.value = !btnEnabled.value}, |
||||
modifier = Modifier.padding(8.dp), |
||||
enabled = btnEnabled.value |
||||
) { |
||||
Icon( |
||||
imageVector = Icons.Default.FavoriteBorder, |
||||
contentDescription = "FavoriteBorder", |
||||
modifier = Modifier.padding(end = 4.dp) |
||||
) |
||||
Text(text = "Button") |
||||
} |
||||
val btnTextEnabled = remember { mutableStateOf(true) } |
||||
TextButton( |
||||
onClick = { btnTextEnabled.value = !btnTextEnabled.value }, |
||||
modifier = Modifier.padding(8.dp), |
||||
enabled = btnTextEnabled.value |
||||
) { |
||||
Text(text = "Text Button") |
||||
} |
||||
OutlinedButton( |
||||
onClick = { |
||||
btnEnabled.value = true |
||||
btnTextEnabled.value = true |
||||
}, |
||||
modifier = Modifier.padding(8.dp) |
||||
) { |
||||
Icon( |
||||
imageVector = Icons.Default.Refresh, |
||||
contentDescription = "Refresh", |
||||
modifier = Modifier.padding(0.dp) |
||||
) |
||||
} |
||||
} |
||||
} |
||||
@ -1,68 +0,0 @@
@@ -1,68 +0,0 @@
|
||||
package com.jetbrains.compose.widgets |
||||
|
||||
import androidx.compose.foundation.background |
||||
import androidx.compose.foundation.ExperimentalFoundationApi |
||||
import androidx.compose.foundation.lazy.LazyColumn |
||||
import androidx.compose.foundation.lazy.rememberLazyListState |
||||
import androidx.compose.foundation.layout.Box |
||||
import androidx.compose.foundation.layout.fillMaxWidth |
||||
import androidx.compose.foundation.layout.fillMaxHeight |
||||
import androidx.compose.foundation.layout.fillMaxSize |
||||
import androidx.compose.foundation.layout.height |
||||
import androidx.compose.foundation.layout.padding |
||||
import androidx.compose.foundation.layout.Spacer |
||||
import androidx.compose.foundation.rememberScrollbarAdapter |
||||
import androidx.compose.foundation.shape.RoundedCornerShape |
||||
import androidx.compose.foundation.VerticalScrollbar |
||||
import androidx.compose.material.Text |
||||
import androidx.compose.material.MaterialTheme |
||||
import androidx.compose.material.Surface |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Alignment |
||||
import androidx.compose.ui.graphics.Color |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
@Composable |
||||
fun LazyScrollable() { |
||||
MaterialTheme { |
||||
Box( |
||||
modifier = Modifier.fillMaxSize() |
||||
.padding(10.dp) |
||||
) { |
||||
|
||||
val state = rememberLazyListState() |
||||
val itemCount = 100 |
||||
|
||||
LazyColumn(Modifier.fillMaxSize().padding(end = 12.dp), state) { |
||||
items(itemCount) { x -> |
||||
TextBox("Item in ScrollableColumn #$x") |
||||
Spacer(modifier = Modifier.height(5.dp)) |
||||
} |
||||
} |
||||
VerticalScrollbar( |
||||
modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(), |
||||
adapter = rememberScrollbarAdapter( |
||||
scrollState = state |
||||
) |
||||
) |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Composable |
||||
private fun TextBox(text: String = "Item") { |
||||
Surface( |
||||
color = Color(135, 135, 135, 40), |
||||
shape = RoundedCornerShape(4.dp) |
||||
) { |
||||
Box( |
||||
modifier = Modifier.height(32.dp) |
||||
.fillMaxWidth() |
||||
.padding(start = 10.dp), |
||||
contentAlignment = Alignment.CenterStart |
||||
) { |
||||
Text(text = text) |
||||
} |
||||
} |
||||
} |
||||
@ -1,39 +0,0 @@
@@ -1,39 +0,0 @@
|
||||
package com.jetbrains.compose.widgets |
||||
|
||||
import androidx.compose.foundation.layout.Box |
||||
import androidx.compose.foundation.layout.fillMaxWidth |
||||
import androidx.compose.foundation.layout.height |
||||
import androidx.compose.foundation.layout.padding |
||||
import androidx.compose.foundation.layout.Row |
||||
import androidx.compose.foundation.layout.size |
||||
import androidx.compose.material.CircularProgressIndicator |
||||
import androidx.compose.material.LinearProgressIndicator |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Alignment |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
@Composable |
||||
fun Loaders() { |
||||
Row( |
||||
modifier = Modifier.fillMaxWidth().padding(16.dp) |
||||
) { |
||||
Box( |
||||
modifier = Modifier.height(30.dp), |
||||
contentAlignment = Alignment.Center |
||||
) { |
||||
CircularProgressIndicator( |
||||
modifier = Modifier.size(20.dp, 20.dp), |
||||
strokeWidth = 4.dp |
||||
) |
||||
} |
||||
Box( |
||||
modifier = Modifier |
||||
.height(30.dp) |
||||
.padding(start = 8.dp), |
||||
contentAlignment = Alignment.Center |
||||
) { |
||||
LinearProgressIndicator(modifier = Modifier.fillMaxWidth()) |
||||
} |
||||
} |
||||
} |
||||
@ -1,53 +0,0 @@
@@ -1,53 +0,0 @@
|
||||
package com.jetbrains.compose.widgets |
||||
|
||||
import androidx.compose.foundation.layout.Column |
||||
import androidx.compose.foundation.layout.fillMaxWidth |
||||
import androidx.compose.foundation.layout.padding |
||||
import androidx.compose.foundation.text.KeyboardOptions |
||||
import androidx.compose.material.Text |
||||
import androidx.compose.material.TextField |
||||
import androidx.compose.material.OutlinedTextField |
||||
import androidx.compose.ui.text.input.KeyboardType |
||||
import androidx.compose.ui.text.input.PasswordVisualTransformation |
||||
import androidx.compose.ui.text.input.TextFieldValue |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.runtime.getValue |
||||
import androidx.compose.runtime.mutableStateOf |
||||
import androidx.compose.runtime.remember |
||||
import androidx.compose.runtime.setValue |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.text.font.FontFamily |
||||
import androidx.compose.ui.text.TextStyle |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
@Composable |
||||
fun TextInputs() { |
||||
Column( |
||||
modifier = Modifier.fillMaxWidth().padding(16.dp) |
||||
) { |
||||
var name by remember { mutableStateOf(TextFieldValue("")) } |
||||
var password by remember { mutableStateOf(TextFieldValue("")) } |
||||
|
||||
TextField( |
||||
value = name, |
||||
onValueChange = { newValue -> name = newValue }, |
||||
modifier = Modifier.padding(8.dp).fillMaxWidth(), |
||||
textStyle = TextStyle(fontFamily = FontFamily.SansSerif), |
||||
label = { Text("Account:") }, |
||||
placeholder = { Text("account name") } |
||||
) |
||||
|
||||
OutlinedTextField( |
||||
value = password, |
||||
modifier = Modifier.padding(8.dp).fillMaxWidth(), |
||||
label = { Text(text = "Password:") }, |
||||
placeholder = { Text(text = "your password") }, |
||||
textStyle = TextStyle(fontFamily = FontFamily.SansSerif), |
||||
visualTransformation = PasswordVisualTransformation(), |
||||
onValueChange = { |
||||
password = it |
||||
}, |
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password) |
||||
) |
||||
} |
||||
} |
||||
@ -1,90 +0,0 @@
@@ -1,90 +0,0 @@
|
||||
package com.jetbrains.compose.widgets |
||||
|
||||
import androidx.compose.foundation.clickable |
||||
import androidx.compose.foundation.layout.Column |
||||
import androidx.compose.foundation.layout.Row |
||||
import androidx.compose.foundation.layout.fillMaxWidth |
||||
import androidx.compose.foundation.layout.padding |
||||
import androidx.compose.foundation.text.KeyboardOptions |
||||
import androidx.compose.material.Checkbox |
||||
import androidx.compose.material.MaterialTheme |
||||
import androidx.compose.material.RadioButton |
||||
import androidx.compose.material.Slider |
||||
import androidx.compose.material.Switch |
||||
import androidx.compose.material.SwitchDefaults |
||||
import androidx.compose.material.Text |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.runtime.getValue |
||||
import androidx.compose.runtime.mutableStateOf |
||||
import androidx.compose.runtime.remember |
||||
import androidx.compose.runtime.setValue |
||||
import androidx.compose.ui.Alignment |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
@Composable |
||||
fun Toggles() { |
||||
Column { |
||||
Row { |
||||
Column( |
||||
modifier = Modifier.padding(16.dp) |
||||
) { |
||||
var checked by remember { mutableStateOf(true) } |
||||
Checkbox( |
||||
checked = checked, |
||||
modifier = Modifier.padding(8.dp), |
||||
onCheckedChange = { checked = !checked } |
||||
) |
||||
var switched by remember { mutableStateOf(true) } |
||||
Switch( |
||||
checked = switched, |
||||
colors = SwitchDefaults.colors(checkedThumbColor = MaterialTheme.colors.primary), |
||||
modifier = Modifier.padding(8.dp), |
||||
onCheckedChange = { switched = it } |
||||
) |
||||
} |
||||
Column( |
||||
modifier = Modifier.padding(16.dp) |
||||
) { |
||||
var selected by remember { mutableStateOf("Kotlin") } |
||||
Row(verticalAlignment = Alignment.CenterVertically) { |
||||
RadioButton(selected = selected == "Kotlin", onClick = { selected = "Kotlin" }) |
||||
Text( |
||||
text = "Kotlin", |
||||
modifier = Modifier.clickable(onClick = { selected = "Kotlin" }).padding(start = 4.dp) |
||||
) |
||||
} |
||||
Row(verticalAlignment = Alignment.CenterVertically) { |
||||
RadioButton(selected = selected == "Java", onClick = { selected = "Java" }) |
||||
Text( |
||||
text = "Java", |
||||
modifier = Modifier.clickable(onClick = { selected = "Java" }).padding(start = 4.dp) |
||||
) |
||||
} |
||||
Row(verticalAlignment = Alignment.CenterVertically) { |
||||
RadioButton(selected = selected == "Swift", onClick = { selected = "Swift" }) |
||||
Text( |
||||
text = "Swift", |
||||
modifier = Modifier.clickable(onClick = { selected = "Swift" }).padding(start = 4.dp) |
||||
) |
||||
} |
||||
} |
||||
} |
||||
|
||||
var sliderState by remember { mutableStateOf(0f) } |
||||
Slider(value = sliderState, modifier = Modifier.fillMaxWidth().padding(8.dp), |
||||
onValueChange = { newValue -> |
||||
sliderState = newValue |
||||
} |
||||
) |
||||
|
||||
var sliderState2 by remember { mutableStateOf(20f) } |
||||
Slider(value = sliderState2, modifier = Modifier.fillMaxWidth().padding(8.dp), |
||||
valueRange = 0f..100f, |
||||
steps = 5, |
||||
onValueChange = { newValue -> |
||||
sliderState2 = newValue |
||||
} |
||||
) |
||||
} |
||||
} |
||||
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
<idea-plugin> |
||||
<id>com.jetbrains.ComposeDemoPlugin</id> |
||||
<name>Jetpack Compose for Desktop Demo</name> |
||||
<vendor email="support@jetbrains.com" url="http://www.jetbrains.com">JetBrains</vendor> |
||||
|
||||
<description><![CDATA[ |
||||
A plugin demonstrates Jetpack compose capabilities on IntelliJ Platform |
||||
]]></description> |
||||
|
||||
<!-- please see https://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html |
||||
on how to target different products --> |
||||
<depends>com.intellij.modules.platform</depends> |
||||
|
||||
<extensions defaultExtensionNs="com.intellij"> |
||||
<!-- Add your extensions here --> |
||||
</extensions> |
||||
|
||||
<actions> |
||||
<!-- Add your actions here --> |
||||
<action id="com.jetbrains.compose.ComposeDemoAction" class="com.jetbrains.compose.ComposeDemoAction" |
||||
text="Show Compose Demo..."> |
||||
<add-to-group group-id="ToolsMenu" anchor="last"/> |
||||
</action> |
||||
</actions> |
||||
</idea-plugin> |
||||
Loading…
Reference in new issue