use of org.talend.designer.maven.aether.AbsDynamicProgressMonitor in project tbd-studio-se by Talend.
the class DynamicDistributionManager method load.
@Override
public void load(IProgressMonitor monitor, boolean resetModulesCache) throws Exception {
if (isLoaded()) {
return;
}
synchronized (this) {
if (isLoaded()) {
return;
}
IDynamicMonitor dynMonitor = new AbsDynamicProgressMonitor(monitor) {
@Override
public void writeMessage(String message) {
// nothing to do
}
};
registerAll(dynMonitor, resetModulesCache);
setLoaded(true);
}
}
use of org.talend.designer.maven.aether.AbsDynamicProgressMonitor in project tbd-studio-se by Talend.
the class DynamicDistributionManager method reset.
@Override
public void reset(IProgressMonitor monitor) {
if (!isLoaded) {
return;
}
if (monitor == null) {
monitor = new NullProgressMonitor();
}
IDynamicMonitor dynamicMonitor = new AbsDynamicProgressMonitor(monitor) {
@Override
public void writeMessage(String message) {
// nothing to do
}
};
try {
unregisterAll(dynamicMonitor, false);
usersPluginsCache = null;
resetSystemCache();
isLoaded = false;
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
use of org.talend.designer.maven.aether.AbsDynamicProgressMonitor in project tbd-studio-se by Talend.
the class DynamicDistributionManager method reloadAllDynamicDistributions.
@Override
public void reloadAllDynamicDistributions(IProgressMonitor monitor) throws Exception {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
IDynamicMonitor dynamicMonitor = new AbsDynamicProgressMonitor(monitor) {
@Override
public void writeMessage(String message) {
// nothing to do
}
};
unregisterAll(dynamicMonitor, false);
usersPluginsCache = null;
registerAll(dynamicMonitor, false);
resetSystemCache();
}
use of org.talend.designer.maven.aether.AbsDynamicProgressMonitor in project tbd-studio-se by Talend.
the class DynamicDistributionOptionForm method getVersionList.
private List<String> getVersionList() throws Exception {
final List<List<String>> result = new ArrayList<>();
try {
DynamicDistributionSetupData dynConfigData = getDynamicDistributionSetupData();
IDynamicDistributionsGroup dynDistrGroup = dynConfigData.getDynamicDistributionsGroup();
final Throwable[] throwable = new Throwable[1];
final boolean showOnlyCompatibleVersions = showOnlyCompatibleBtn.getSelection();
run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
IDynamicMonitor dMonitor = new AbsDynamicProgressMonitor(monitor) {
@Override
public void writeMessage(String message) {
if (isDebuging()) {
System.out.print(message);
}
}
};
// $NON-NLS-1$
dMonitor.beginTask(// $NON-NLS-1$
Messages.getString("DynamicDistributionOptionForm.progress.fetchVersions"), IDynamicMonitor.UNKNOWN);
List<String> version = null;
if (showOnlyCompatibleVersions) {
version = dynDistrGroup.getCompatibleVersions(dMonitor);
} else {
version = dynDistrGroup.getAllVersions(dMonitor);
}
result.add(version);
} catch (Exception e) {
throwable[0] = e;
}
}
});
if (throwable[0] != null) {
throw throwable[0];
}
} catch (Throwable ex) {
ExceptionHandler.process(ex);
String message = ex.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, ex);
}
if (result.isEmpty()) {
return null;
}
return result.get(0);
}
use of org.talend.designer.maven.aether.AbsDynamicProgressMonitor in project tbd-studio-se by Talend.
the class DynamicDistributionOptionForm method createNewDynamicDistribution.
private boolean createNewDynamicDistribution() {
try {
final IDynamicPlugin[] result = new IDynamicPlugin[1];
final Throwable[] throwable = new Throwable[1];
run(true, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
DynamicDistributionSetupData dynConfigData = getDynamicDistributionSetupData();
IDynamicDistributionsGroup dynDistrGroup = dynConfigData.getDynamicDistributionsGroup();
IDynamicMonitor dMonitor = new AbsDynamicProgressMonitor(monitor) {
@Override
public void writeMessage(String message) {
if (isDebuging()) {
System.out.print(message);
}
}
};
// step 1. build dynamic plugin basing on template
dMonitor.beginTask(// $NON-NLS-1$
Messages.getString(// $NON-NLS-1$
"DynamicDistributionOptionForm.progress.building", dynamicConfiguration.getName()), IDynamicMonitor.UNKNOWN);
IDynamicPlugin dynamicPlugin = dynDistrGroup.buildDynamicPlugin(dMonitor, dynamicConfiguration);
result[0] = dynamicPlugin;
// step 2. save dynamic plugin and refresh cache
if (dynamicPlugin != null) {
saveDynamicDistribution(dynamicPlugin, dynDistrGroup, ActionType.NewConfig, dMonitor);
}
} catch (Throwable e) {
throwable[0] = e;
}
}
});
if (throwable[0] != null) {
throw throwable[0];
}
IDynamicPlugin newDynamicPlugin = result[0];
if (newDynamicPlugin == null) {
// $NON-NLS-1$
throw new Exception(Messages.getString("DynamicDistributionOptionForm.newConfig.exception.noPluginGenerated"));
}
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;
}
Aggregations