AddSubmoduleWizard wizard = new AddSubmoduleWizard(repo);
WizardDialog dialog = new WizardDialog(getShell(event), wizard);
if (dialog.open() == Window.OK) {
final String path = wizard.getPath();
final String uri = wizard.getUri().toPrivateASCIIString();
final SubmoduleAddOperation op = new SubmoduleAddOperation(repo,
path, uri);
Job job = new WorkspaceJob(MessageFormat.format(
UIText.SubmoduleAddCommand_JobTitle, path, uri)) {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) {
monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
try {
op.execute(monitor);
} catch (CoreException e) {
Activator.logError(UIText.SubmoduleAddCommand_AddError,
e);
}
return Status.OK_STATUS;
}
@Override
public boolean belongsTo(Object family) {
if (JobFamilies.SUBMODULE_ADD.equals(family))
return true;
return super.belongsTo(family);
}
};
job.setUser(true);
job.setRule(op.getSchedulingRule());
job.schedule();
}
return null;
}