Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@ public void initialize() {

syncSourcesButton.setOnAction(e -> {
this.getTelemetryService().event("/Explore/SyncSources");
exploreTaskFactory.createSourceSyncTask().schedule();
var context = exploreTaskFactory.createSourceSyncTask();
context.setOnSucceeded((ignore) -> syncSourcesButton.setDisable(false));
context.setOnFailed((ignore) -> syncSourcesButton.setDisable(false));
context.setOnCancelled((ignore) -> syncSourcesButton.setDisable(false));
context.schedule();
syncSourcesButton.setDisable(true);
});

exploreChipView = new ExploreChipView(this.getApplicationDefaults(), this.exploreService.getDistinctCreators());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,14 @@ public void initialize() {
displaySwitchTabPane.getSelectionModel().select(displayListTab);
}


syncButton.setOnAction(e -> {
this.getTelemetryService().event("/Plugins/Scan");
pluginService.syncPlugins();
pluginService.syncPlugins(() -> {
syncButton.setDisable(false);
exportButton.setDisable(false);
});
syncButton.setDisable(true);
exportButton.setDisable(true);
});

taskFactory.addSyncPluginsListener(this::displayPlugins);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -62,6 +63,14 @@ public void syncPlugins() {
taskFactory.createPluginSyncTask().schedule();
}

public void syncPlugins(Runnable callback) {
var context = taskFactory.createPluginSyncTask();
context.setOnSucceeded((e) -> callback.run());
context.setOnFailed((e) -> callback.run());
context.setOnCancelled((e) -> callback.run());
context.schedule();
}

public void syncFiles() {
taskFactory.createFileStatSyncTask().schedule();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public class ProjectsController extends BaseController {
public void initialize() {
syncProjectButton.setOnAction(e -> {
this.getTelemetryService().event("/Projects/Scan");
projectService.syncProjects();
projectService.syncProjects(() -> syncProjectButton.setDisable(false));
syncProjectButton.setDisable(true);
});

projectTaskFactory.addSyncProjectsListener(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ public void syncProjects() {
taskFactory.createSyncTask().schedule();
}

public void syncProjects(Runnable callback) {
var context = taskFactory.createSyncTask();
context.setOnSucceeded((ignore) -> callback.run());
context.setOnFailed((ignore) -> callback.run());
context.setOnCancelled((ignore) -> callback.run());
context.schedule();
}

public Iterable<DawProject> getAllProjects() {
return dawProjectRepository.findAll();
}
Expand Down