Skip to content

Commit

Permalink
Fix some problem of Custom Prefix Panel
Browse files Browse the repository at this point in the history
  • Loading branch information
obiscr committed Apr 18, 2023
1 parent 110e692 commit 5217fe7
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void dispose() {

@Override
public String getDisplayName() {
return "Custom Actions";
return "Custom Prompt";
}

@Override
Expand Down Expand Up @@ -161,7 +161,7 @@ public void reset() {

private void createUIComponents() {
customActionsTitledBorderBox = new JPanel(new BorderLayout());
TitledSeparator tsUrl = new TitledSeparator("Custom Actions Settings");
TitledSeparator tsUrl = new TitledSeparator("Custom Prompt Settings");
customActionsTitledBorderBox.add(tsUrl,BorderLayout.CENTER);

myMainPanel = new JPanel(new BorderLayout());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class AddCustomAction extends AnAction {

private final Runnable runnable;
public AddCustomAction(Runnable runnable) {
super(() -> "Add Custom Action", AllIcons.ToolbarDecorator.AddLink);
super(() -> "Add Custom Prompt", AllIcons.Actions.AddList);
this.runnable = runnable;
}
@Override
Expand Down Expand Up @@ -72,7 +72,7 @@ static class CustomActionDialog extends DialogWrapper {
public CustomActionDialog(@Nullable Project project, Runnable runnable) {
super(project);
this.project = project;
setTitle("New Custom Action");
setTitle("New Custom Prompt");
setResizable(false);
init();
setOKActionEnabled(true);
Expand Down Expand Up @@ -146,16 +146,22 @@ private JPanel createItemPanel() {

JPanel namePanel = new JPanel(new BorderLayout());
JBLabel promptNameLabel = new JBLabel("Prompt name: ");
promptNameLabel.setIcon(AllIcons.General.ContextHelp);
promptNameLabel.setHorizontalTextPosition(SwingConstants.LEFT);
promptNameLabel.setToolTipText("<html>The name displayed in the menu, and it should be as short as possible.");
promptNameLabel.setBorder(JBUI.Borders.emptyBottom(5));
namePanel.add(promptNameLabel, BorderLayout.NORTH);
nameField.getEmptyText().setText("Type prompt name here, if empty, the prompt value will be used");
namePanel.add(nameField, BorderLayout.CENTER);

JPanel valuePanel = new JPanel(new BorderLayout());
JBLabel promptValueLabel = new JBLabel("Prompt value: ");
promptValueLabel.setIcon(AllIcons.General.ContextHelp);
promptValueLabel.setHorizontalTextPosition(SwingConstants.LEFT);
promptValueLabel.setToolTipText("<html>When asking a question, the prompt content sent to AI.");
promptValueLabel.setBorder(JBUI.Borders.emptyBottom(5));
valuePanel.add(promptValueLabel,BorderLayout.NORTH);
valueField.getEmptyText().setText("Type new custom action here");
valueField.getEmptyText().setText("Type new custom prompt here");
valueField.setFont(nameField.getFont());
valuePanel.add(valueField,BorderLayout.CENTER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
doActionPerformed(e);
};

ListPopup actionGroupPopup = JBPopupFactory.getInstance().createActionGroupPopup("Custom Action Popups",
ListPopup actionGroupPopup = JBPopupFactory.getInstance().createActionGroupPopup("Custom Prompt Popups",
new CustomPrefixActionGroup(runnable), e.getDataContext(), true, null, Integer.MAX_VALUE);
actionGroupPopup.showInBestPositionFor(e.getData(CommonDataKeys.EDITOR));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
displayName="GPT 3.5 Turbo"/>
<applicationConfigurable parentId="com.obiscr.chatgpt.settings.OpenAISettings" instance="com.obiscr.chatgpt.settings.CustomActionsPanel"
id="com.obiscr.chatgpt.settings.commandActions"
displayName="Custom Actions"/>
displayName="Custom Prompt"/>
<applicationService serviceImplementation="com.obiscr.chatgpt.settings.OpenAISettingsState"/>
<applicationService serviceImplementation="com.obiscr.chatgpt.core.TokenManager"/>
<projectService serviceImplementation="com.obiscr.chatgpt.core.ConversationManager"/>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/messages/ChatGPTBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ action.code.optimize.menu=Optimize
action.code.test.menu=Add Test Case
action.code.wrong.menu=Find Bug
action.code.explain.menu=Explain
action.code.custom.action=Custom Actions
action.code.custom.action=Custom Prompt

toolwindows.content.search=Search
toolwindows.content.online=Online ChatGPT
Expand Down

0 comments on commit 5217fe7

Please sign in to comment.