Skip to content

Commit

Permalink
remove auto reload optiom
Browse files Browse the repository at this point in the history
  • Loading branch information
yevheniyJ committed Feb 12, 2024
1 parent 175de9b commit 375cf56
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 33 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,6 @@ If you are not using branching, make sure the `Use Git Branch` option is disable

Note that a **branch is required for string-based** projects.

#### Automatic reload

By default, the plugin will automatically reload files tree after each change in configuration file. To disable this, please uncheck the `Automatically reload on change` option.

#### Automatic uploads

By default, the plugin will automatically upload source files to Crowdin on every change. To disable this, please uncheck the `Automatically upload on change` option.
Expand Down
28 changes: 13 additions & 15 deletions src/main/java/com/crowdin/event/FileChangeListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,19 @@ public void after(List<? extends VFileEvent> events) {

CrowdingSettingsState settings = CrowdingSettingsState.getInstance(project);

if (settings.autoReload) {
VirtualFile crowdinPropertyFile = CrowdinFileProvider.getCrowdinConfigFile(project);
boolean crowdinPropertiesFileUpdated = events.stream().anyMatch(e -> Objects.equals(e.getFile(), crowdinPropertyFile));
if (crowdinPropertiesFileUpdated) {
try {
CrowdinPropertiesLoader.load(project);
} catch (Exception e) {
NotificationUtil.showErrorMessage(project, e.getMessage());
return;
}
ApplicationManager.getApplication().invokeAndWait(() -> CrowdinPanelWindowFactory.reloadPanels(project, false));
if (events.size() == 1) {
//no need to start task below as it's just an update in config file
return;
}
VirtualFile crowdinPropertyFile = CrowdinFileProvider.getCrowdinConfigFile(project);
boolean crowdinPropertiesFileUpdated = events.stream().anyMatch(e -> Objects.equals(e.getFile(), crowdinPropertyFile));
if (crowdinPropertiesFileUpdated) {
try {
CrowdinPropertiesLoader.load(project);
} catch (Exception e) {
NotificationUtil.showErrorMessage(project, e.getMessage());
return;
}
ApplicationManager.getApplication().invokeAndWait(() -> CrowdinPanelWindowFactory.reloadPanels(project, false));
if (events.size() == 1) {
//no need to start task below as it's just an update in config file
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public boolean isModified() {
!Objects.equals(this.settingsPanel.getProjectId(), instance.projectId) ||
!Objects.equals(this.settingsPanel.getCompletionFileExtensions(), instance.fileExtensions) ||
!Objects.equals(this.settingsPanel.getAutoUpload(), instance.autoUpload) ||
!Objects.equals(this.settingsPanel.getAutoReload(), instance.autoReload) ||
!Objects.equals(this.settingsPanel.getUseGitBranch(), instance.useGitBranch) ||
!Objects.equals(this.settingsPanel.getEnableCompletion(), instance.enableCompletion) ||
!Objects.equals(this.settingsPanel.getDoNotShowConfirmation(), instance.doNotShowConfirmation);
Expand All @@ -60,7 +59,6 @@ public void apply() {
instance.fileExtensions = this.settingsPanel.getCompletionFileExtensions();
instance.doNotShowConfirmation = this.settingsPanel.getDoNotShowConfirmation();
instance.autoUpload = this.settingsPanel.getAutoUpload();
instance.autoReload = this.settingsPanel.getAutoReload();
instance.useGitBranch = this.settingsPanel.getUseGitBranch();
instance.enableCompletion = this.settingsPanel.getEnableCompletion();

Expand Down Expand Up @@ -92,7 +90,6 @@ public void reset() {
this.settingsPanel.setCompletionFileExtensions(instance.fileExtensions);
this.settingsPanel.setDoNotShowConfirmation(instance.doNotShowConfirmation);
this.settingsPanel.setAutoUpload(instance.autoUpload);
this.settingsPanel.setAutoReload(instance.autoReload);
this.settingsPanel.setUseGitBranch(instance.useGitBranch);
this.settingsPanel.setEnableCompletion(instance.enableCompletion);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class CrowdingSettingsState implements PersistentStateComponent<CrowdingS
public boolean doNotShowConfirmation = false;
public boolean useGitBranch = false;
public boolean autoUpload = true;
public boolean autoReload = true;
public boolean enableCompletion = true;

public String getApiToken() {
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/com/crowdin/settings/SettingsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class SettingsPanel {
private final JBCheckBox doNotShowConfirmation = new JBCheckBox("Do not show confirmation dialogs ");
private final JBCheckBox useGitBranch = new JBCheckBox("Use Git Branch ");
private final JBCheckBox autoUpload = new JBCheckBox("Automatically upload on change ");
private final JBCheckBox autoReload = new JBCheckBox("Automatically reload on change ");
private final JBCheckBox enableCompletion = new JBCheckBox("Enable Autocompletion ");

public SettingsPanel() {
Expand All @@ -34,7 +33,6 @@ public SettingsPanel() {
.addComponent(new JBLabel("Settings"), 20)
.addSeparator()
.addComponent(useGitBranch, 5)
.addComponent(autoReload, 5)
.addComponent(autoUpload, 5)
.addComponent(doNotShowConfirmation, 5)
.addComponent(new JBLabel("Autocomplete"), 10)
Expand Down Expand Up @@ -107,14 +105,6 @@ public boolean getAutoUpload() {
return this.autoUpload.isSelected();
}

public void setAutoReload(boolean autoReload) {
this.autoReload.setSelected(autoReload);
}

public boolean getAutoReload() {
return this.autoReload.isSelected();
}

public void setEnableCompletion(boolean enableCompletion) {
this.enableCompletion.setSelected(enableCompletion);
}
Expand Down

0 comments on commit 375cf56

Please sign in to comment.