Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
- uses: actions/setup-java@v3
with:
java-version: '21'
distribution: adopt
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3
- name: Run the Gradle package task
Expand Down
92 changes: 54 additions & 38 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import org.jetbrains.intellij.platform.gradle.IntelliJPlatform
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType

plugins {
id("java")
id("org.jetbrains.intellij") version "1.17.3"
id("org.jetbrains.intellij.platform") version "2.5.0"
}

group = "com.couchbase"
version = "1.1.6.1"
version = "1.1.6.2"
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand All @@ -17,6 +20,9 @@ repositories {
mavenCentral()
gradlePluginPortal()
maven { url = uri("https://mobile.maven.couchbase.com/maven2/dev/") }
intellijPlatform {
defaultRepositories()
}
}

dependencies {
Expand Down Expand Up @@ -62,47 +68,57 @@ dependencies {

testImplementation("org.testcontainers:couchbase:1.19.7")



intellijPlatform {
intellijIdeaCommunity("2025.1")
bundledPlugin("com.intellij.java")
bundledPlugin("com.intellij.modules.json")
bundledPlugin("org.jetbrains.plugins.terminal")
}
}

// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
version.set("2024.2")
type.set("IC") // Target IDE Platform

plugins.set(listOf("com.intellij.java", "org.jetbrains.plugins.terminal"))
}

tasks {
// Set the JVM compatibility versions
withType<JavaCompile> {
sourceCompatibility = "21"
targetCompatibility = "21"
intellijPlatform {
pluginConfiguration {
id = "com.couchbase.couchbase-intellij-plugin"
name = "Couchbase"
version = "${project.version}"
description = """
Couchbase is an award-winning distributed NoSQL cloud database that delivers unmatched versatility, performance, scalability, and financial value for all of your cloud, mobile, on-premises, hybrid, distributed cloud, and edge computing applications.<br>
The plugin provides integrated support for Couchbase within the IntelliJ IDEA, making it easier to interact with your Couchbase databases directly from your development environment.<br>
<ul>
<li><strong>Connection Management:</strong> Easily connect to your local or remote Couchbase clusters and manage your connections within the IntelliJ IDEA.</li>
<li><strong>Data Manipulation:</strong> View, add, update, and delete documents in your Couchbase buckets directly from IntelliJ.</li>
<li><strong>SQL++ Support:</strong> Write and execute SQL++ queries from within IntelliJ. The plugin includes syntax highlighting, error checking, and auto-completion features for SQL++ (previously known as N1QL), making it easier to write and debug your queries.</li>
</ul>
For more information visit the
<a href="https://github.com/couchbaselabs/couchbase_jetbrains_plugin">project repo</a>.
""".trimIndent()
Comment on lines +86 to +96

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The plugin description is quite verbose. Consider summarizing it for better readability in the IDE plugin manager. Perhaps focus on the core features and benefits.

description = """
            Provides integrated support for Couchbase within IntelliJ IDEA, making it easier to interact with your Couchbase databases directly from your development environment. Key features include Connection Management, Data Manipulation, and SQL++ Support.
        """.trimIndent()

changeNotes = """
1.1.6.2 — adds support for 2025.1
""".trimIndent()
Comment on lines +97 to +99

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The change notes are minimal. Expand on the changes for better user understanding. What specific improvements or bug fixes are included in this version?

changeNotes = """
            1.1.6.2 — Updated plugin to support IntelliJ 2025.1 and included minor bug fixes.
        """.trimIndent()

ideaVersion {
sinceBuild = "251.23774.435"
untilBuild = "251.*"
}
vendor {
name = "Couchbase"
url = "https://www.couchbase.com"
email = "[email protected]"
}
}

patchPluginXml {
sinceBuild.set("242.22855.74")
untilBuild.set("242.*")
}

signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
}

publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
}

val patchArgs =
listOf("--add-exports java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED")

test {
jvmArgs(patchArgs)
pluginVerification {
ides{
ide(IntelliJPlatformType.IntellijIdeaCommunity, "2025.1")
}
}
}

//intellij {
// version.set("2025.1")
// type.set("IC") // Target IDE Platform
//
// plugins.set(listOf("com.intellij.java", "org.jetbrains.plugins.terminal"))
// plugins.add("json")
// plugins.add("intellij.json.backend")
//}

46 changes: 31 additions & 15 deletions src/main/java/com/couchbase/intellij/tree/NewCollectionDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.couchbase.client.java.manager.collection.CollectionSpec;
import com.couchbase.intellij.database.ActiveCluster;
import com.couchbase.intellij.database.DataLoader;
import com.couchbase.intellij.tree.node.CollectionsNodeDescriptor;
import com.couchbase.intellij.tree.node.ScopeNodeDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.ui.treeStructure.Tree;
Expand All @@ -28,8 +30,7 @@ public class NewCollectionDialog extends DialogWrapper {
private JLabel errorLabel;
private JSpinner maxTTL;

protected NewCollectionDialog(Project project, String bucket, String scope, DefaultMutableTreeNode
clickedNode, Tree tree) {
protected NewCollectionDialog(Project project, String bucket, String scope, DefaultMutableTreeNode clickedNode, Tree tree) {
super(project);
this.bucketName = bucket;
this.scopeName = scope;
Expand Down Expand Up @@ -68,10 +69,9 @@ protected JComponent createCenterPanel() {
gbc.gridy = 1;
maxTTL = new JSpinner(new SpinnerNumberModel(0, 0, 2147483648L, 1));

panel.add(TemplateUtil.createComponentWithBalloon(maxTTL, "The maximum time-to-live (TTL) for all documents in this collection in seconds. If enabled and a document is mutated with no TTL or a TTL greater than the maximum, its TTL will be set to the collection TTL." +
"The largest TTL allowed is 2147483647 seconds. A 0 value means TTL is disabled.\n" +
"\n" +
"NOTE: if collection-level TTL is set, bucket-level TTL is ignored.\n"), gbc);
panel.add(TemplateUtil.createComponentWithBalloon(maxTTL,
"The maximum time-to-live (TTL) for all documents in this collection in seconds. If enabled and a document is mutated with no TTL or a TTL greater than the maximum, its TTL will be set to the collection TTL." + "The largest TTL allowed is 2147483647 seconds. A 0 value means TTL is disabled.\n" + "\n" + "NOTE: if collection-level TTL is set, bucket-level TTL is ignored.\n"),
gbc);


gbc.gridy = 2;
Expand All @@ -91,17 +91,16 @@ protected void doOKAction() {
}

if (!textField.getText().matches("[a-zA-Z0-9_]+")) {
errorLabel
.setText("Special characters are not allowed in collection creation");
errorLabel.setText("Special characters are not allowed in collection creation");
return;
}

String collectionName = textField.getText();
List<CollectionSpec> collections = ActiveCluster.getInstance().get().bucket(bucketName)
.collections().getAllScopes().stream()
.filter(scope -> scope.name().equals(scopeName))
.flatMap(scope -> scope.collections().stream())
.collect(Collectors.toList());
List<CollectionSpec> collections = ActiveCluster.getInstance().get().bucket(bucketName).collections()
.getAllScopes().stream()
.filter(scope -> scope.name().equals(scopeName))
.flatMap(scope -> scope.collections().stream())
.collect(Collectors.toList());

for (CollectionSpec collection : collections) {
if (collection.name().equals(collectionName)) {
Expand All @@ -117,10 +116,27 @@ protected void doOKAction() {
if (ttl.longValue() <= 0) {
colManager.createCollection(CollectionSpec.create(collectionName, scopeName));
} else {
colManager.createCollection(CollectionSpec.create(collectionName, scopeName, Duration.ofSeconds(ttl.longValue())));
colManager.createCollection(
CollectionSpec.create(collectionName, scopeName, Duration.ofSeconds(ttl.longValue())));
}

DataLoader.listCollections(clickedNode, tree);
Object userObject = clickedNode.getUserObject();
if (userObject instanceof ScopeNodeDescriptor) {
int childCount = clickedNode.getChildCount();
for (int i = 0; i < childCount; i++) {
DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) clickedNode.getChildAt(i);
Object childUserObject = childNode.getUserObject();

if (childUserObject instanceof CollectionsNodeDescriptor) {
DataLoader.listCollections(childNode, tree);
break;
}
}


} else {
DataLoader.listCollections(clickedNode, tree);
}
super.doOKAction();
}

Expand Down
Loading
Loading