use of org.netxms.ui.eclipse.market.dialogs.RepositoryPropertiesDlg in project netxms by netxms.
the class RepositoryManager method addRepository.
/**
* Add repository
*/
private void addRepository() {
RepositoryPropertiesDlg dlg = new RepositoryPropertiesDlg(getSite().getShell(), null);
if (dlg.open() != Window.OK)
return;
final Repository repository = new Repository(dlg.getUrl(), dlg.getToken(), dlg.getDescription());
new ConsoleJob("Add repository", this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.addRepository(repository);
runInUIThread(new Runnable() {
@SuppressWarnings("unchecked")
@Override
public void run() {
ArrayList<RepositoryRuntimeInfo> repositories = (ArrayList<RepositoryRuntimeInfo>) viewer.getInput();
repositories.add(new RepositoryRuntimeInfo(repository));
viewer.refresh();
}
});
}
@Override
protected String getErrorMessage() {
return "Cannot add repository";
}
}.start();
}
Aggregations