use of org.talend.designer.maven.aether.AbsDynamicProgressMonitor in project tbd-studio-se by Talend.
the class DynamicDistributionDetailsForm method performOk.
@Override
public boolean performOk() {
try {
final Throwable[] throwable = new Throwable[1];
run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
DynamicDistributionSetupData dynamicBuildConfigurationData = getDynamicDistributionSetupData();
try {
IDynamicMonitor dMonitor = new AbsDynamicProgressMonitor(monitor) {
@Override
public void writeMessage(String message) {
if (isDebuging()) {
System.out.print(message);
}
}
};
saveDynamicDistribution(newDynamicPluginCache, dynamicBuildConfigurationData.getDynamicDistributionsGroup(), dynamicBuildConfigurationData.getActionType(), dMonitor);
} catch (Exception e) {
throwable[0] = e;
}
}
});
if (throwable[0] != null) {
throw throwable[0];
}
return true;
} catch (Throwable e) {
ExceptionHandler.process(e);
String message = e.getMessage();
if (StringUtils.isEmpty(message)) {
// $NON-NLS-1$
message = Messages.getString("ExceptionDialog.message.empty");
}
// $NON-NLS-1$
ExceptionMessageDialog.openError(getShell(), Messages.getString("ExceptionDialog.title"), message, e);
}
return false;
}
use of org.talend.designer.maven.aether.AbsDynamicProgressMonitor in project tbd-studio-se by Talend.
the class DynamicDistributionPreferenceForm method doDelete.
private void doDelete(IDynamicPlugin dynamicPlugin) throws Throwable {
final Throwable[] throwable = new Throwable[1];
ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(getShell());
progressDialog.run(true, false, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor pMonitor) throws InvocationTargetException, InterruptedException {
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(new RepositoryWorkUnit<Boolean>(// $NON-NLS-1$
Messages.getString("DynamicDistributionPreferenceForm.form.deleteExistingConfig.workunit.title")) {
@Override
protected void run() throws LoginException, PersistenceException {
IDynamicMonitor monitor = new AbsDynamicProgressMonitor(pMonitor) {
@Override
public void writeMessage(String message) {
// nothing to do
}
};
try {
IDynamicPluginConfiguration pluginConfiguration = dynamicPlugin.getPluginConfiguration();
monitor.beginTask(// $NON-NLS-1$
Messages.getString(// $NON-NLS-1$
"DynamicDistributionPreferenceForm.delete.progress.unregist", pluginConfiguration.getName()), IDynamicMonitor.UNKNOWN);
String distribution = pluginConfiguration.getDistribution();
IDynamicDistributionsGroup dynamicDistributionGroup = DynamicDistributionManager.getInstance().getDynamicDistributionGroup(distribution);
dynamicDistributionGroup.unregister(dynamicPlugin, monitor, false);
monitor.setTaskName(// $NON-NLS-1$
Messages.getString(// $NON-NLS-1$
"DynamicDistributionPreferenceForm.delete.progress.deleteFile", pluginConfiguration.getName()));
String filePath = (String) pluginConfiguration.getAttribute(DynamicConstants.ATTR_FILE_PATH);
File file = new File(filePath);
file.delete();
monitor.setTaskName(// $NON-NLS-1$
Messages.getString("DynamicDistributionPreferenceForm.delete.progress.resetCache"));
DynamicDistributionManager.getInstance().resetSystemCache();
} catch (Throwable e) {
throwable[0] = e;
}
}
});
}
});
if (throwable[0] != null) {
throw throwable[0];
}
}
Aggregations