Skip to content

Commit

Permalink
Settings option from chat
Browse files Browse the repository at this point in the history
  • Loading branch information
jShiwaniGupta committed Oct 26, 2024
1 parent 5705871 commit c1f46dc
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ public class AssistantTopComponent extends TopComponent {
public static final ImageIcon saveToEditorIcon = new ImageIcon(AssistantTopComponent.class.getResource("/icons/saveToEditorIcon.png"));
public static final ImageIcon newEditorIcon = new ImageIcon(AssistantTopComponent.class.getResource("/icons/newEditorIcon.png"));
public static final ImageIcon attachIcon = new ImageIcon(AssistantTopComponent.class.getResource("/icons/attachIcon.gif"));
public static final ImageIcon settingsIcon = new ImageIcon(AssistantTopComponent.class.getResource("/icons/settingsIcon.png"));



public static final String PREFERENCE_KEY = "AssistantTopComponentOpen";
private final JPanel parentPanel;
Expand Down
29 changes: 20 additions & 9 deletions src/main/java/io/github/jeddict/ai/hints/LearnFix.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
import static io.github.jeddict.ai.components.AssistantTopComponent.newEditorIcon;
import static io.github.jeddict.ai.components.AssistantTopComponent.progressIcon;
import static io.github.jeddict.ai.components.AssistantTopComponent.saveToEditorIcon;
import static io.github.jeddict.ai.components.AssistantTopComponent.settingsIcon;
import io.github.jeddict.ai.util.EditorUtil;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
Expand All @@ -99,6 +100,7 @@
import javax.swing.JFrame;
import javax.swing.JTable;
import javax.swing.table.TableColumn;
import org.netbeans.api.options.OptionsDisplayer;

/**
*
Expand Down Expand Up @@ -466,17 +468,26 @@ private JPanel createBottomPanel(String type, String fileName, String title, Con
openInBrowserButton.setMaximumSize(buttonSize);
openInBrowserButton.setEnabled(topComponent.getAllEditorCount() > 0);
westButtonPanel.add(openInBrowserButton);

JButton optionsButton = createButton(settingsIcon); // Replace with actual icon path
optionsButton.setToolTipText("Open Jeddict AI Assistant Settings");
optionsButton.setPreferredSize(buttonSize);
optionsButton.setMaximumSize(buttonSize);
optionsButton.addActionListener(e -> {
OptionsDisplayer.getDefault().open("JeddictAIAssistant");
});
westButtonPanel.add(optionsButton);

// Jeddict Button (West)
JButton jeddictButton = createButton(logoIcon);
jeddictButton.addActionListener(e -> {
try {
Desktop.getDesktop().browse(new URI("https://jeddict.github.io/page.html?l=tutorial/AI"));
} catch (Exception ex) {
ex.printStackTrace();
}
});
westButtonPanel.add(jeddictButton);
// JButton jeddictButton = createButton(logoIcon);
// jeddictButton.addActionListener(e -> {
// try {
// Desktop.getDesktop().browse(new URI("https://jeddict.github.io/page.html?l=tutorial/AI"));
// } catch (Exception ex) {
// ex.printStackTrace();
// }
// });
// westButtonPanel.add(jeddictButton);

// New Chat Button (West)
JButton newChatButton = createButton(newEditorIcon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.openide.util.Lookup;

@OptionsPanelController.TopLevelRegistration(
id = "JeddictAIAssistant",
categoryName = "#OptionsCategory_Name_JeddictAIAssistant",
iconBase = "icons/logo32.png",
keywords = "#OptionsCategory_Keywords_JeddictAIAssistant",
Expand Down
Binary file added src/main/resources/icons/settingsIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c1f46dc

Please sign in to comment.