Skip to content

Commit

Permalink
Update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaorx authored and kesonan committed Oct 30, 2023
1 parent 1e8d049 commit 5813866
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/cn/xiaoheiban/ui/FileChooseDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public interface OnClickListener {
private TextFieldWithBrowseButton protoPathBrowseButton;
private TextFieldWithBrowseButton templateBrowseButton;
private JTextField gozeroTextField;
private final String stylePropertyKey = "cn.xiaoheiban.go-zero" + "_style";

public FileChooseDialog(String title, String cancelText, boolean showProtoPath) {
super(true);
Expand Down Expand Up @@ -71,9 +72,9 @@ protected JComponent createCenterPanel() {
styleLabel.setText("Style");
stylePanel.add(styleLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, labelDimension, null, 0, false));

// 获取上次录入的style
String styleText = PropertiesComponent.getInstance().getValue("cn.xiaoheiban.go-zero" + "_style");
if ("".equals(styleText) || styleText==null) {
// get last style string
String styleText = PropertiesComponent.getInstance().getValue(stylePropertyKey);
if ("".equals(styleText) || styleText == null) {
styleText = "gozero";
}
gozeroTextField = new JTextField();
Expand Down Expand Up @@ -136,17 +137,17 @@ protected ValidationInfo doValidate() {
String goctlHome = templateBrowseButton.getText();
String outputBrowserPath = textFieldWithBrowseButton.getText();

// 这里记录历史值
// store style string
String style = gozeroTextField.getText();
PropertiesComponent.getInstance().setValue("cn.xiaoheiban.go-zero" + "_style", style);
PropertiesComponent.getInstance().setValue(stylePropertyKey, style);


String output = "", protoPath = "";
VirtualFile outputFile = LocalFileSystem.getInstance().findFileByPath(outputBrowserPath);
if (outputFile != null) {
output = outputFile.getPath();
}
if (protoPathBrowseButton!=null) {
if (protoPathBrowseButton != null) {
String protoBrowserPath = protoPathBrowseButton.getText();
VirtualFile protoFile = LocalFileSystem.getInstance().findFileByPath(protoBrowserPath);
if (protoFile != null) {
Expand Down

0 comments on commit 5813866

Please sign in to comment.