Skip to content

Commit

Permalink
已添加多语言支持
Browse files Browse the repository at this point in the history
  • Loading branch information
bitkylin committed Jul 27, 2023
1 parent fc3aacb commit 461a2cd
Show file tree
Hide file tree
Showing 41 changed files with 405 additions and 367 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

## [Unreleased]

## [0.8.6] - 2023-07-26

### Canary Edition

- Add multi-language support, now support English and Chinese, you can configure the language by "settings".

### 金丝雀版

- 添加多语言支持,现在支持英文和中文,可以通过「settings」配置语言。

## [0.8.5] - 2023-07-25

### Canary Edition
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = com.github.bitkylin.bitkyuniversalgenerate
pluginName = bitkylin-universal-generate
pluginRepositoryUrl = https://github.com/bitkylin/bitkylin-universal-generate
# SemVer format -> https://semver.org
pluginVersion = 0.8.5
pluginVersion = 0.8.6

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 222
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
* @author bitkylin
*/
@Slf4j
public class PaddingGenerateForElementAction extends AbstractBitkylinUniversalGenerateAction {
public class PopulateMissingAnnotationForElementAction extends AbstractBitkylinUniversalGenerateAction {

public PaddingGenerateForElementAction(String text) {
public PopulateMissingAnnotationForElementAction(String text) {
super(text);
}

public PaddingGenerateForElementAction() {
public PopulateMissingAnnotationForElementAction() {
super();
}

Expand All @@ -31,13 +31,13 @@ public void actionPerformed(AnActionEvent anActionEvent) {
WriteContext writeContext = WriteContextBuilder.create(anActionEvent);

WriteCommandAction.runWriteCommandAction(writeContext.fetchProject(), () -> {
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.PADDING_WRITE_SWAGGER).writeElement();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.PADDING_WRITE_TAG).writeElement();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.POPULATE_WRITE_SWAGGER).writeElement();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.POPULATE_WRITE_TAG).writeElement();
});
}

@Override
protected ActionEnum fetchActionEnum() {
return ActionEnum.PADDING_GENERATE_FOR_ELEMENT;
return ActionEnum.POPULATE_MISSING_ANNOTATION_FOR_ELEMENT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
* @author bitkylin
*/
@Slf4j
public class PaddingGenerateForFileAction extends AbstractBitkylinUniversalGenerateAction {
public class PopulateMissingAnnotationForFileAction extends AbstractBitkylinUniversalGenerateAction {

public PaddingGenerateForFileAction(String text) {
public PopulateMissingAnnotationForFileAction(String text) {
super(text);
}

public PaddingGenerateForFileAction() {
public PopulateMissingAnnotationForFileAction() {
super();
}

Expand All @@ -31,13 +31,13 @@ public void actionPerformed(AnActionEvent anActionEvent) {
WriteContext writeContext = WriteContextBuilder.create(anActionEvent);

WriteCommandAction.runWriteCommandAction(writeContext.fetchProject(), () -> {
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.PADDING_WRITE_SWAGGER).writeFile();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.PADDING_WRITE_TAG).writeFile();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.POPULATE_WRITE_SWAGGER).writeFile();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.POPULATE_WRITE_TAG).writeFile();
});
}

@Override
protected ActionEnum fetchActionEnum() {
return ActionEnum.PADDING_GENERATE_FOR_FILE;
return ActionEnum.POPULATE_MISSING_ANNOTATION_FOR_FILE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* @author bitkylin
*/
@Slf4j
public class MergeSwaggerToJavaDocForFileAction extends AbstractBitkylinUniversalGenerateAction {
public class PopulateSwaggerToJavaDocForElementAction extends AbstractBitkylinUniversalGenerateAction {

public MergeSwaggerToJavaDocForFileAction(String text) {
public PopulateSwaggerToJavaDocForElementAction(String text) {
super(text);
}

public MergeSwaggerToJavaDocForFileAction() {
public PopulateSwaggerToJavaDocForElementAction() {
super();
}

Expand All @@ -29,12 +29,12 @@ public void actionPerformed(AnActionEvent anActionEvent) {
WriteContext writeContext = WriteContextBuilder.create(anActionEvent);

WriteCommandAction.runWriteCommandAction(writeContext.fetchProject(), () -> {
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.MERGE_SWAGGER_TO_JAVA_DOC).writeFile();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.POPULATE_SWAGGER_TO_JAVA_DOC).writeElement();
});
}

@Override
protected ActionEnum fetchActionEnum() {
return ActionEnum.MERGE_SWAGGER_TO_JAVA_DOC_FOR_FILE;
return ActionEnum.POPULATE_SWAGGER_TO_JAVA_DOC_FOR_ELEMENT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* @author bitkylin
*/
@Slf4j
public class MergeSwaggerToJavaDocForElementAction extends AbstractBitkylinUniversalGenerateAction {
public class PopulateSwaggerToJavaDocForFileAction extends AbstractBitkylinUniversalGenerateAction {

public MergeSwaggerToJavaDocForElementAction(String text) {
public PopulateSwaggerToJavaDocForFileAction(String text) {
super(text);
}

public MergeSwaggerToJavaDocForElementAction() {
public PopulateSwaggerToJavaDocForFileAction() {
super();
}

Expand All @@ -29,12 +29,12 @@ public void actionPerformed(AnActionEvent anActionEvent) {
WriteContext writeContext = WriteContextBuilder.create(anActionEvent);

WriteCommandAction.runWriteCommandAction(writeContext.fetchProject(), () -> {
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.MERGE_SWAGGER_TO_JAVA_DOC).writeElement();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.POPULATE_SWAGGER_TO_JAVA_DOC).writeFile();
});
}

@Override
protected ActionEnum fetchActionEnum() {
return ActionEnum.MERGE_SWAGGER_TO_JAVA_DOC_FOR_ELEMENT;
return ActionEnum.POPULATE_SWAGGER_TO_JAVA_DOC_FOR_FILE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
* @author bitkylin
*/
@Slf4j
public class RenewGenerateForElementAction extends AbstractBitkylinUniversalGenerateAction {
public class ReGenerateGenerateForElementAction extends AbstractBitkylinUniversalGenerateAction {

public RenewGenerateForElementAction(String text) {
public ReGenerateGenerateForElementAction(String text) {
super(text);
}

public RenewGenerateForElementAction() {
public ReGenerateGenerateForElementAction() {
super();
}

Expand All @@ -31,13 +31,13 @@ public void actionPerformed(AnActionEvent anActionEvent) {
WriteContext writeContext = WriteContextBuilder.create(anActionEvent);

WriteCommandAction.runWriteCommandAction(writeContext.fetchProject(), () -> {
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.RENEW_WRITE_SWAGGER).writeElement();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.RENEW_WRITE_TAG).writeElement();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.RE_GENERATE_WRITE_SWAGGER).writeElement();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.RE_GENERATE_WRITE_TAG).writeElement();
});
}

@Override
protected ActionEnum fetchActionEnum() {
return ActionEnum.RENEW_GENERATE_FOR_ELEMENT;
return ActionEnum.RE_GENERATE_ANNOTATION_FOR_ELEMENT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
* @author bitkylin
*/
@Slf4j
public class RenewGenerateForFileAction extends AbstractBitkylinUniversalGenerateAction {
public class ReGenerateGenerateForFileAction extends AbstractBitkylinUniversalGenerateAction {

public RenewGenerateForFileAction(String text) {
public ReGenerateGenerateForFileAction(String text) {
super(text);
}

public RenewGenerateForFileAction() {
public ReGenerateGenerateForFileAction() {
super();
}

Expand All @@ -31,13 +31,13 @@ public void actionPerformed(AnActionEvent anActionEvent) {
WriteContext writeContext = WriteContextBuilder.create(anActionEvent);

WriteCommandAction.runWriteCommandAction(writeContext.fetchProject(), () -> {
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.RENEW_WRITE_SWAGGER).writeFile();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.RENEW_WRITE_TAG).writeFile();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.RE_GENERATE_WRITE_SWAGGER).writeFile();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.RE_GENERATE_WRITE_TAG).writeFile();
});
}

@Override
protected ActionEnum fetchActionEnum() {
return ActionEnum.RENEW_GENERATE_FOR_FILE;
return ActionEnum.RE_GENERATE_ANNOTATION_FOR_FILE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* @author bitkylin
*/
@Slf4j
public class PaddingSwaggerToJavaDocForFileAction extends AbstractBitkylinUniversalGenerateAction {
public class ReGenerateSwaggerToJavaDocForElementAction extends AbstractBitkylinUniversalGenerateAction {

public PaddingSwaggerToJavaDocForFileAction(String text) {
public ReGenerateSwaggerToJavaDocForElementAction(String text) {
super(text);
}

public PaddingSwaggerToJavaDocForFileAction() {
public ReGenerateSwaggerToJavaDocForElementAction() {
super();
}

Expand All @@ -29,12 +29,12 @@ public void actionPerformed(AnActionEvent anActionEvent) {
WriteContext writeContext = WriteContextBuilder.create(anActionEvent);

WriteCommandAction.runWriteCommandAction(writeContext.fetchProject(), () -> {
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.PADDING_SWAGGER_TO_JAVA_DOC).writeFile();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.RE_GENERATE_SWAGGER_TO_JAVA_DOC).writeElement();
});
}

@Override
protected ActionEnum fetchActionEnum() {
return ActionEnum.PADDING_SWAGGER_TO_JAVA_DOC_FOR_FILE;
return ActionEnum.RE_GENERATE_SWAGGER_TO_JAVA_DOC_FOR_ELEMENT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* @author bitkylin
*/
@Slf4j
public class PaddingSwaggerToJavaDocForElementAction extends AbstractBitkylinUniversalGenerateAction {
public class ReGenerateSwaggerToJavaDocForFileAction extends AbstractBitkylinUniversalGenerateAction {

public PaddingSwaggerToJavaDocForElementAction(String text) {
public ReGenerateSwaggerToJavaDocForFileAction(String text) {
super(text);
}

public PaddingSwaggerToJavaDocForElementAction() {
public ReGenerateSwaggerToJavaDocForFileAction() {
super();
}

Expand All @@ -29,12 +29,12 @@ public void actionPerformed(AnActionEvent anActionEvent) {
WriteContext writeContext = WriteContextBuilder.create(anActionEvent);

WriteCommandAction.runWriteCommandAction(writeContext.fetchProject(), () -> {
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.PADDING_SWAGGER_TO_JAVA_DOC).writeElement();
CommandCommandTypeProcessorFactory.decide(writeContext, WriteCommand.Command.RE_GENERATE_SWAGGER_TO_JAVA_DOC).writeFile();
});
}

@Override
protected ActionEnum fetchActionEnum() {
return ActionEnum.PADDING_SWAGGER_TO_JAVA_DOC_FOR_ELEMENT;
return ActionEnum.RE_GENERATE_SWAGGER_TO_JAVA_DOC_FOR_FILE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
*/
public abstract class AbstractBitkylinUniversalGenerateAction extends AnAction {

public AbstractBitkylinUniversalGenerateAction(String text) {
protected AbstractBitkylinUniversalGenerateAction(String text) {
super(text);
}

public AbstractBitkylinUniversalGenerateAction() {
protected AbstractBitkylinUniversalGenerateAction() {
super();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@ public class GenerateAnnotationActionGroup extends AbstractBitkylinUniversalGene

@Override
public AnAction @NotNull [] getChildren(@Nullable AnActionEvent anActionEvent) {
ActionConfig actionConfig = new ActionConfig();
if (DumbService.isDumb(anActionEvent.getProject())) {
anActionEvent.getPresentation().setEnabled(false);
updateGroupText(anActionEvent, actionConfig, ActionGroupEnum.GENERATE_ANNOTATION, actionConfig.fetchTextForDumbMode());
return new AnAction[0];
}
ActionConfig actionConfig = new ActionConfig();
WriteContext writeContext = WriteContextBuilder.create(anActionEvent);
if (writeContext.fetchSelected()) {
updateGroupText(anActionEvent, actionConfig, ActionGroupEnum.GENERATE_ANNOTATION, actionConfig.fetchTextForElement());
return new AnAction[]{
ActionFactory.create(actionConfig, ActionEnum.PADDING_GENERATE_FOR_ELEMENT),
ActionFactory.create(actionConfig, ActionEnum.RENEW_GENERATE_FOR_ELEMENT)
ActionFactory.create(actionConfig, ActionEnum.POPULATE_MISSING_ANNOTATION_FOR_ELEMENT),
ActionFactory.create(actionConfig, ActionEnum.RE_GENERATE_ANNOTATION_FOR_ELEMENT)
};
}
updateGroupText(anActionEvent, actionConfig, ActionGroupEnum.GENERATE_ANNOTATION, actionConfig.fetchTextForFile());
return new AnAction[]{
ActionFactory.create(actionConfig, ActionEnum.PADDING_GENERATE_FOR_FILE),
ActionFactory.create(actionConfig, ActionEnum.RENEW_GENERATE_FOR_FILE)
ActionFactory.create(actionConfig, ActionEnum.POPULATE_MISSING_ANNOTATION_FOR_FILE),
ActionFactory.create(actionConfig, ActionEnum.RE_GENERATE_ANNOTATION_FOR_FILE)
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@ public class SwaggerToJavaDocActionGroup extends AbstractBitkylinUniversalGenera

@Override
public AnAction @NotNull [] getChildren(@Nullable AnActionEvent anActionEvent) {
ActionConfig actionConfig = new ActionConfig();
if (DumbService.isDumb(anActionEvent.getProject())) {
anActionEvent.getPresentation().setEnabled(false);
updateGroupText(anActionEvent, actionConfig, ActionGroupEnum.SWAGGER_TO_JAVA_DOC, actionConfig.fetchTextForDumbMode());
return new AnAction[0];
}
ActionConfig actionConfig = new ActionConfig();
WriteContext writeContext = WriteContextBuilder.create(anActionEvent);
if (writeContext.fetchSelected()) {
updateGroupText(anActionEvent, actionConfig, ActionGroupEnum.SWAGGER_TO_JAVA_DOC, actionConfig.fetchTextForElement());
return new AnAction[]{
ActionFactory.create(actionConfig, ActionEnum.MERGE_SWAGGER_TO_JAVA_DOC_FOR_ELEMENT),
ActionFactory.create(actionConfig, ActionEnum.PADDING_SWAGGER_TO_JAVA_DOC_FOR_ELEMENT)
ActionFactory.create(actionConfig, ActionEnum.POPULATE_SWAGGER_TO_JAVA_DOC_FOR_ELEMENT),
ActionFactory.create(actionConfig, ActionEnum.RE_GENERATE_SWAGGER_TO_JAVA_DOC_FOR_ELEMENT)
};
}
updateGroupText(anActionEvent, actionConfig, ActionGroupEnum.SWAGGER_TO_JAVA_DOC, actionConfig.fetchTextForFile());
return new AnAction[]{
ActionFactory.create(actionConfig, ActionEnum.MERGE_SWAGGER_TO_JAVA_DOC_FOR_FILE),
ActionFactory.create(actionConfig, ActionEnum.PADDING_SWAGGER_TO_JAVA_DOC_FOR_FILE)
ActionFactory.create(actionConfig, ActionEnum.POPULATE_SWAGGER_TO_JAVA_DOC_FOR_FILE),
ActionFactory.create(actionConfig, ActionEnum.RE_GENERATE_SWAGGER_TO_JAVA_DOC_FOR_FILE)
};
}

Expand Down
Loading

0 comments on commit 461a2cd

Please sign in to comment.