Compare commits

...

1 Commits

Author SHA1 Message Date
Chao MENG
8fcaeef1a4 feat(TUP-29653): Improve Tacokit loading
https://jira.talendforge.org/browse/TUP-29653
2020-12-17 11:11:36 +08:00
3 changed files with 25 additions and 0 deletions

View File

@@ -44,6 +44,8 @@ public interface ITaCoKitService {
boolean isTaCoKitType(Object repoType);
void updateComponentsCache() throws Exception;
public static ITaCoKitService getInstance() throws Exception {
BundleContext bc = FrameworkUtil.getBundle(ITaCoKitService.class).getBundleContext();
Collection<ServiceReference<ITaCoKitService>> tacokitServices = Collections.emptyList();

View File

@@ -2248,6 +2248,11 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
executeMigrations(project, false, currentMonitor);
ProjectManager.getInstance().getMigrationRecords().clear();
TimeMeasurePerformance.step("logOnProject", "executeMigrations(afterLogonTasks)"); //$NON-NLS-1$ //$NON-NLS-2$
try {
ITaCoKitService.getInstance().updateComponentsCache();
} catch (Exception e) {
ExceptionHandler.process(e);
}
if (monitor != null && monitor.isCanceled()) {
throw new OperationCanceledException(""); //$NON-NLS-1$
}

View File

@@ -44,6 +44,7 @@ import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.runtime.helper.LocalComponentInstallHelper;
import org.talend.commons.runtime.helper.PatchComponentHelper;
import org.talend.commons.runtime.service.ComponentsInstallComponent;
import org.talend.commons.runtime.service.ITaCoKitService;
import org.talend.commons.runtime.service.PatchComponent;
import org.talend.commons.ui.runtime.update.PreferenceKeys;
import org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea;
@@ -577,11 +578,28 @@ public class Application implements IApplication {
}
private boolean logUserOnProject(Shell shell) {
startTacokitInBackground();
IRepositoryService service =
(IRepositoryService) GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
return service.openLoginDialog(shell);
}
private void startTacokitInBackground() {
new Thread(new Runnable() {
@Override
public void run() {
try {
ITaCoKitService.getInstance().start();
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}, "Starting tacokit...") {
}.start();
}
@Override
public void stop() {
final IWorkbench workbench = PlatformUI.getWorkbench();