Skip to content

Commit

Permalink
Merge pull request #218 from Couchbase-Ecosystem/1.1.4
Browse files Browse the repository at this point in the history
1.1.4 release
  • Loading branch information
deniswsrosa authored Aug 22, 2024
2 parents a840300 + 14ee427 commit acc49e1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = "com.couchbase"
version = "1.1.3"
version = "1.1.4"
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.couchbase.intellij.database.DataLoader;
import com.couchbase.intellij.tree.node.*;
import com.couchbase.intellij.workbench.Log;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.ui.treeStructure.Tree;

Expand Down Expand Up @@ -48,7 +49,7 @@ public static void handle(Tree tree, TreeExpansionEvent event) {
} else if (expandedTreeNode.getUserObject() instanceof SearchNodeDescriptor) {
DataLoader.listSearchIndexes(expandedTreeNode, tree);
} else {
throw new UnsupportedOperationException("Not implemented yet");
Log.debug("Tree not implemented yet " + expandedTreeNode.getUserObject());
}
}
}
Expand Down
52 changes: 39 additions & 13 deletions src/main/java/com/couchbase/intellij/tree/TreeToolBarBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
workbenchCounter++;
String fileName = "workbench" + workbenchCounter + ".sqlpp";
VirtualFile virtualFile = new LightVirtualFile(fileName, FileTypeManager.getInstance().getFileTypeByExtension("sqlpp"), "");
VirtualFile virtualFile = new LightVirtualFile(fileName, FileTypeManager.getInstance()
.getFileTypeByExtension(
"sqlpp"), "");
// Open the file in the editor
FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
fileEditorManager.openFile(virtualFile, true);
Expand All @@ -60,9 +62,15 @@ public void update(AnActionEvent e) {
e.getPresentation().setEnabled(shouldEnable);
e.getPresentation().setVisible(shouldEnable);
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}
};

newWorkbench.getTemplatePresentation().setIcon(IconLoader.getIcon("/assets/icons/new_query.svg", CouchbaseWindowContent.class));
newWorkbench.getTemplatePresentation()
.setIcon(IconLoader.getIcon("/assets/icons/new_query.svg", CouchbaseWindowContent.class));


AnAction newSearchWorkbench = new AnAction("New Search Workbench") {
Expand All @@ -81,7 +89,10 @@ public void actionPerformed(@NotNull AnActionEvent e) {
"fields": ["*"]
}
""";
VirtualFile virtualFile = new LightVirtualFile(fileName, FileTypeManager.getInstance().getFileTypeByExtension("cbs.json"), fileContent);
VirtualFile virtualFile = new LightVirtualFile(fileName, FileTypeManager.getInstance()
.getFileTypeByExtension(
"cbs.json"),
fileContent);
FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
fileEditorManager.openFile(virtualFile, true);
} catch (Exception ex) {
Expand All @@ -97,9 +108,15 @@ public void update(AnActionEvent e) {
e.getPresentation().setEnabled(shouldEnable);
e.getPresentation().setVisible(shouldEnable);
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}
};

newSearchWorkbench.getTemplatePresentation().setIcon(IconLoader.getIcon("/assets/icons/search_workbench2.svg", CouchbaseWindowContent.class));
newSearchWorkbench.getTemplatePresentation().setIcon(
IconLoader.getIcon("/assets/icons/search_workbench2.svg", CouchbaseWindowContent.class));


AnAction addConnectionAction = new AnAction("Add New Connection") {
Expand All @@ -110,7 +127,8 @@ public void actionPerformed(@NotNull AnActionEvent e) {
dialog.show();
}
};
addConnectionAction.getTemplatePresentation().setIcon(IconLoader.getIcon("/assets/icons/new_database.svg", CouchbaseWindowContent.class));
addConnectionAction.getTemplatePresentation()
.setIcon(IconLoader.getIcon("/assets/icons/new_database.svg", CouchbaseWindowContent.class));

AnAction cbshellAction = new AnAction("Open New CB Shell") {
@Override
Expand All @@ -119,11 +137,13 @@ public void actionPerformed(@NotNull AnActionEvent e) {
if (ActiveCluster.getInstance().get() != null) {
CBShell.openNewTerminal();
} else {
Messages.showErrorDialog("You need to connect to a cluster first before running CB Shell", "Couchbase Plugin Error");
Messages.showErrorDialog("You need to connect to a cluster first before running CB Shell",
"Couchbase Plugin Error");
}
}
};
cbshellAction.getTemplatePresentation().setIcon(IconLoader.getIcon("/assets/icons/cbshell.svg", CouchbaseWindowContent.class));
cbshellAction.getTemplatePresentation()
.setIcon(IconLoader.getIcon("/assets/icons/cbshell.svg", CouchbaseWindowContent.class));

AnAction ellipsisAction = new AnAction("More Options") {
@Override
Expand All @@ -143,9 +163,11 @@ public void actionPerformed(@NotNull AnActionEvent e) {

if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
try {
Desktop.getDesktop().browse(new URI("https://github.com/couchbaselabs/couchbase_jetbrains_plugin/issues"));
Desktop.getDesktop().browse(new URI(
"https://github.com/couchbaselabs/couchbase_jetbrains_plugin/issues"));
} catch (IOException | URISyntaxException ex) {
Log.error("Could not open the project's home: https://github.com/couchbaselabs/couchbase_jetbrains_plugin/issues");
Log.error(
"Could not open the project's home: https://github.com/couchbaselabs/couchbase_jetbrains_plugin/issues");
}
}
});
Expand All @@ -156,7 +178,8 @@ public void actionPerformed(@NotNull AnActionEvent e) {

if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
try {
Desktop.getDesktop().browse(new URI("https://www.youtube.com/watch?v=RiHLyop_KUM&ab_channel=Couchbase"));
Desktop.getDesktop()
.browse(new URI("https://www.youtube.com/watch?v=RiHLyop_KUM&ab_channel=Couchbase"));
} catch (IOException | URISyntaxException ex) {
Log.error("Could not open the plugin's tour video");
}
Expand All @@ -169,7 +192,8 @@ public void actionPerformed(@NotNull AnActionEvent e) {
menu.show(component, component.getWidth() / 2, component.getHeight() / 2);
}
};
ellipsisAction.getTemplatePresentation().setIcon(IconLoader.getIcon("/assets/icons/ellipsis_horizontal.svg", CouchbaseWindowContent.class));
ellipsisAction.getTemplatePresentation().setIcon(
IconLoader.getIcon("/assets/icons/ellipsis_horizontal.svg", CouchbaseWindowContent.class));
ellipsisAction.getTemplatePresentation().setDescription("More options");

DefaultActionGroup leftActionGroup = new DefaultActionGroup();
Expand All @@ -193,7 +217,8 @@ public void actionPerformed(@NotNull AnActionEvent e) {
leftActionToolbar.setTargetComponent(toolBarPanel);
toolBarPanel.add(leftActionToolbar.getComponent(), BorderLayout.WEST);

ActionToolbar rightActionToolbar = ActionManager.getInstance().createActionToolbar("MoreOptions", rightActionGroup, true);
ActionToolbar rightActionToolbar = ActionManager.getInstance()
.createActionToolbar("MoreOptions", rightActionGroup, true);
rightActionToolbar.setTargetComponent(toolBarPanel);
toolBarPanel.add(rightActionToolbar.getComponent(), BorderLayout.EAST);
ActiveCluster.getInstance().registerNewConnectionListener(() -> {
Expand All @@ -207,7 +232,8 @@ public void actionPerformed(@NotNull AnActionEvent e) {
}

public void showGotItTooltip() {
GotItTooltip tooltip = new GotItTooltip(UUID.randomUUID().toString(), "Click here to connect to a new Couchbase Cluster", null);
GotItTooltip tooltip = new GotItTooltip(UUID.randomUUID().toString(),
"Click here to connect to a new Couchbase Cluster", null);
tooltip.show(leftActionToolbar.getComponent(), GotItTooltip.BOTTOM_MIDDLE);
}
}

0 comments on commit acc49e1

Please sign in to comment.