diff --git a/plugins/gradle/resources/i18n/GradleBundle.properties b/plugins/gradle/resources/i18n/GradleBundle.properties index 715b2ea1240f..a4fbd505a67d 100644 --- a/plugins/gradle/resources/i18n/GradleBundle.properties +++ b/plugins/gradle/resources/i18n/GradleBundle.properties @@ -47,6 +47,10 @@ gradle.import.text.error.file.module.test.output.location=Module test output loc gradle.import.text.incomplete.tooling.api=Gradle version contains incomplete tooling API gradle.sync.title.tab=Changes +gradle.sync.change.type.gradle=Gradle local setting +gradle.sync.change.type.intellij={0} local setting +gradle.sync.change.type.conflict=Settings conflict +gradle.sync.change.type.confirmed=Confirmed settings diff gradle.library.resolve.progress.text=Resolving gradle libraries diff --git a/plugins/gradle/src/META-INF/plugin.xml b/plugins/gradle/src/META-INF/plugin.xml index 78023504c47d..66671b6de803 100644 --- a/plugins/gradle/src/META-INF/plugin.xml +++ b/plugins/gradle/src/META-INF/plugin.xml @@ -32,6 +32,7 @@ + diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleColorKeys.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleColorKeys.java new file mode 100644 index 000000000000..fde14fdf4579 --- /dev/null +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleColorKeys.java @@ -0,0 +1,30 @@ +package org.jetbrains.plugins.gradle.config; + +import com.intellij.openapi.editor.colors.ColorKey; +import com.intellij.ui.Gray; + +import java.awt.*; + +/** + * Holds keys to the colors used at gradle-specific processing. + *

+ * Thread-safe. + * + * @author Denis Zhdanov + * @since 1/18/12 4:19 PM + */ +public class GradleColorKeys { + + /** + * References color to use for indication of particular change that exists only at the gradle side. + *

+ * Example: particular dependency is added at the gradle side but not at intellij. + */ + public static final ColorKey GRADLE_LOCAL_CHANGE = ColorKey.createColorKey("GRADLE_LOCAL_CHANGE", new Color(130, 184, 22)); + public static final ColorKey GRADLE_INTELLIJ_LOCAL_CHANGE = ColorKey.createColorKey("GRADLE_INTELLIJ_LOCAL_CHANGE", new Color(16, 102, 248)); + public static final ColorKey GRADLE_CHANGE_CONFLICT = ColorKey.createColorKey("GRADLE_CHANGE_CONFLICT", new Color(255, 187, 255)); + public static final ColorKey GRADLE_CONFIRMED_CONFLICT = ColorKey.createColorKey("GRADLE_CONFIRMED_CONFLICT", Gray._208); + + private GradleColorKeys() { + } +} diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleColorSettingsPage.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleColorSettingsPage.java new file mode 100644 index 000000000000..a1a345f4b648 --- /dev/null +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleColorSettingsPage.java @@ -0,0 +1,89 @@ +package org.jetbrains.plugins.gradle.config; + +import com.intellij.openapi.application.ApplicationNamesInfo; +import com.intellij.openapi.editor.colors.TextAttributesKey; +import com.intellij.openapi.fileTypes.PlainSyntaxHighlighter; +import com.intellij.openapi.fileTypes.SyntaxHighlighter; +import com.intellij.openapi.options.colors.AttributesDescriptor; +import com.intellij.openapi.options.colors.ColorDescriptor; +import com.intellij.openapi.options.colors.ColorSettingsPage; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.plugins.gradle.ui.GradleIcons; +import org.jetbrains.plugins.gradle.util.GradleBundle; + +import javax.swing.*; +import java.util.Map; + +/** + * Provides support for defining gradle-specific color settings. + *

+ * Not thread-safe. + * + * @author Denis Zhdanov + * @since 1/18/12 4:15 PM + */ +public class GradleColorSettingsPage implements ColorSettingsPage { + + private static final ColorDescriptor[] DESCRIPTORS = { + new ColorDescriptor( + GradleBundle.message("gradle.sync.change.type.gradle"), + GradleColorKeys.GRADLE_LOCAL_CHANGE, + ColorDescriptor.Kind.FOREGROUND + ), + new ColorDescriptor( + GradleBundle.message("gradle.sync.change.type.intellij", ApplicationNamesInfo.getInstance().getProductName()), + GradleColorKeys.GRADLE_INTELLIJ_LOCAL_CHANGE, + ColorDescriptor.Kind.FOREGROUND + ), + new ColorDescriptor( + GradleBundle.message("gradle.sync.change.type.conflict"), + GradleColorKeys.GRADLE_CHANGE_CONFLICT, + ColorDescriptor.Kind.FOREGROUND + ), + new ColorDescriptor( + GradleBundle.message("gradle.sync.change.type.confirmed"), + GradleColorKeys.GRADLE_CONFIRMED_CONFLICT, + ColorDescriptor.Kind.FOREGROUND + ) + }; + + @NotNull + @Override + public String getDisplayName() { + return GradleBundle.message("gradle.name"); + } + + @Override + public Icon getIcon() { + return GradleIcons.GRADLE_ICON; + } + + @NotNull + @Override + public AttributesDescriptor[] getAttributeDescriptors() { + return new AttributesDescriptor[0]; + } + + @NotNull + @Override + public ColorDescriptor[] getColorDescriptors() { + return DESCRIPTORS; + } + + @NotNull + @Override + public SyntaxHighlighter getHighlighter() { + return new PlainSyntaxHighlighter(); + } + + @NotNull + @Override + public String getDemoText() { + return ""; + } + + @Override + public Map getAdditionalHighlightingTagToDescriptorMap() { + return null; + } +}