use of org.springsource.ide.eclipse.commons.ui.ICoreRunnable in project eclipse-integration-commons by spring-projects.
the class ConfiguratorPreferencesPage method doInstall.
protected void doInstall(final ConfigurableExtension extension) {
// FIXME use directory where extension is installed
final File installDirectory = new File(userLocationText.getText());
if (!installDirectory.canWrite()) {
UiStatusHandler.logAndDisplay(new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind("Installation failed. The directory ''{0}'' is not writeable.", userLocationText.getText())));
return;
}
try {
final IStatus[] status = new IStatus[1];
UiUtil.busyCursorWhile(new ICoreRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
status[0] = extension.install(installDirectory, monitor);
if (status[0].getSeverity() != IStatus.ERROR) {
IStatus configurationStatus = extension.configure(monitor);
if (status[0].getSeverity() != IStatus.OK) {
MultiStatus result = new MultiStatus(Activator.PLUGIN_ID, 0, NLS.bind("The installation of {0} generated warning. See error log for details.", extension.getLabel()), null);
result.add(status[0]);
result.add(configurationStatus);
status[0] = result;
} else {
status[0] = configurationStatus;
}
}
}
});
handleResult(extension, status);
doRefresh();
} catch (OperationCanceledException ignored) {
// cancelled
} catch (CoreException e) {
UiStatusHandler.logAndDisplay(e.getStatus());
}
}
use of org.springsource.ide.eclipse.commons.ui.ICoreRunnable in project eclipse-integration-commons by spring-projects.
the class ConfiguratorPreferencesPage method doConfigure.
protected void doConfigure(final ConfigurableExtension extension) {
try {
final IStatus[] status = new IStatus[1];
UiUtil.busyCursorWhile(new ICoreRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
status[0] = extension.configure(monitor);
}
});
handleResult(extension, status);
doRefresh();
} catch (OperationCanceledException ignored) {
// cancelled
} catch (CoreException e) {
UiStatusHandler.logAndDisplay(e.getStatus());
}
}
use of org.springsource.ide.eclipse.commons.ui.ICoreRunnable in project eclipse-integration-commons by spring-projects.
the class IdeUiUtils method createTaskData.
private static TaskData createTaskData(final TaskRepository taskRepository, final String projectKey) throws CoreException {
AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(JIRA_CONNECTOR_KIND);
final AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
final TaskData taskData = new TaskData(taskDataHandler.getAttributeMapper(taskRepository), JIRA_CONNECTOR_KIND, taskRepository.getRepositoryUrl(), "");
ICoreRunnable runner = new ICoreRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
TaskMapping mapping = new TaskMapping() {
@Override
public String getProduct() {
return projectKey;
}
};
if (!taskDataHandler.initializeTaskData(taskRepository, taskData, mapping, monitor)) {
throw new CoreException(new Status(Status.ERROR, IdeUiPlugin.PLUGIN_ID, "The repository does not have a project with key: " + projectKey));
}
}
};
UiUtil.busyCursorWhile(runner);
return taskData;
}
Aggregations