mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-01 05:00:56 +00:00
Move proxy settings to a new panel(wipes out the current settings)
This commit is contained in:
parent
139bc7128f
commit
1e88b10b95
15 changed files with 281 additions and 177 deletions
|
|
@ -1,8 +1,8 @@
|
|||
package ee.carlrobert.codegpt.ide.toolwindow;
|
||||
|
||||
import static ee.carlrobert.codegpt.ide.toolwindow.components.SwingUtils.createIconLabel;
|
||||
import static ee.carlrobert.codegpt.ide.toolwindow.components.SwingUtils.createTextArea;
|
||||
import static ee.carlrobert.codegpt.ide.toolwindow.components.SwingUtils.justifyLeft;
|
||||
import static ee.carlrobert.codegpt.ide.util.SwingUtils.createIconLabel;
|
||||
import static ee.carlrobert.codegpt.ide.util.SwingUtils.createTextArea;
|
||||
import static ee.carlrobert.codegpt.ide.util.SwingUtils.justifyLeft;
|
||||
import static java.lang.String.format;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
package ee.carlrobert.codegpt.ide.toolwindow.components;
|
||||
|
||||
import com.intellij.ui.JBColor;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
public class SwingUtils {
|
||||
|
||||
public static JTextArea createTextArea(String selectedText) {
|
||||
var textArea = new JTextArea();
|
||||
textArea.append(selectedText);
|
||||
textArea.setLineWrap(true);
|
||||
textArea.setEditable(false);
|
||||
textArea.setFont(textArea.getFont().deriveFont(Font.ITALIC));
|
||||
textArea.setWrapStyleWord(true);
|
||||
textArea.setBackground(JBColor.PanelBackground);
|
||||
return textArea;
|
||||
}
|
||||
|
||||
public static JLabel createIconLabel(Icon icon, String text) {
|
||||
var iconLabel = new JLabel(icon);
|
||||
iconLabel.setText(text);
|
||||
iconLabel.setFont(iconLabel.getFont().deriveFont(iconLabel.getFont().getStyle() | Font.BOLD));
|
||||
iconLabel.setIconTextGap(8);
|
||||
return iconLabel;
|
||||
}
|
||||
|
||||
public static JButton createIconButton(Icon icon) {
|
||||
var button = new JButton(icon);
|
||||
button.setBorder(BorderFactory.createEmptyBorder());
|
||||
button.setContentAreaFilled(false);
|
||||
button.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
|
||||
return button;
|
||||
}
|
||||
|
||||
public static Box justifyLeft(Component component) {
|
||||
Box box = Box.createHorizontalBox();
|
||||
box.add(component);
|
||||
box.add(Box.createHorizontalGlue());
|
||||
return box;
|
||||
}
|
||||
|
||||
public static void addShiftEnterInputMap(JTextArea textArea, Runnable onEnter) {
|
||||
var input = textArea.getInputMap();
|
||||
var enterStroke = KeyStroke.getKeyStroke("ENTER");
|
||||
var shiftEnterStroke = KeyStroke.getKeyStroke("shift ENTER");
|
||||
input.put(shiftEnterStroke, "insert-break");
|
||||
input.put(enterStroke, "text-submit");
|
||||
|
||||
var actions = textArea.getActionMap();
|
||||
actions.put("text-submit", new AbstractAction() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
onEnter.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package ee.carlrobert.codegpt.ide.toolwindow.components;
|
||||
|
||||
import static ee.carlrobert.codegpt.ide.toolwindow.components.SwingUtils.createIconButton;
|
||||
import static ee.carlrobert.codegpt.ide.util.SwingUtils.createIconButton;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package ee.carlrobert.codegpt.ide.toolwindow.components;
|
||||
|
||||
import static ee.carlrobert.codegpt.ide.toolwindow.components.SwingUtils.addShiftEnterInputMap;
|
||||
import static ee.carlrobert.codegpt.ide.toolwindow.components.SwingUtils.createIconButton;
|
||||
import static ee.carlrobert.codegpt.ide.util.SwingUtils.addShiftEnterInputMap;
|
||||
import static ee.carlrobert.codegpt.ide.util.SwingUtils.createIconButton;
|
||||
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.components.JBTextArea;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package ee.carlrobert.codegpt.ide.toolwindow.conversations;
|
||||
|
||||
import static ee.carlrobert.codegpt.ide.toolwindow.components.SwingUtils.justifyLeft;
|
||||
import static ee.carlrobert.codegpt.ide.util.SwingUtils.justifyLeft;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ui.JBColor;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue