use of com.openshift.restclient.model.project.IProjectRequest in project jbosstools-openshift by jbosstools.
the class OpenShift3NativeProjectUtils method createProject.
public static IProject createProject(String name, String displayName, String description, Connection connection) {
assertTrue(StringUtils.isNotBlank(name));
assertNotNull(displayName);
assertNotNull(description);
assertNotNull(connection);
IProjectRequest request = connection.getResourceFactory().stub(ResourceKind.PROJECT_REQUEST, name);
request.setDisplayName(StringUtils.isEmpty(displayName) ? name : displayName);
request.setDescription(StringUtils.isEmpty(description) ? name : description);
CreateProjectWaitCondition createProjectWaitCondition = new CreateProjectWaitCondition(connection, request);
new WaitUntil(createProjectWaitCondition, TimePeriod.VERY_LONG);
IProject createdProject = createProjectWaitCondition.getProject();
/**
* WORKAROUND: explorer wont get notified of the the new project and
* therefore wont display it unless a manual refresh is done on the
* connection. https://issues.jboss.org/browse/JBIDE-23513 remove
* this wait once WatchManager is watching projects and notifies the
* ui.
*
* @see WatchManager#KINDS
*/
new WaitUntil(new OpenShiftProjectExists(createdProject.getDisplayName(), connection));
return createdProject;
}
use of com.openshift.restclient.model.project.IProjectRequest in project jbosstools-openshift by jbosstools.
the class NewProjectWizardModel method createProject.
public IProject createProject() {
if (connection == null) {
OpenShiftUIActivator.getDefault().getLogger().logError("Could not create project, missing connection.");
return null;
}
IProjectRequest request = connection.getResourceFactory().stub(ResourceKind.PROJECT_REQUEST, getProjectName());
request.setDescription(getDescription());
request.setDisplayName(getDisplayName());
IProject project = (IProject) connection.createResource(request);
List<IProject> newProjects = new ArrayList<>(projects);
newProjects.add((IProject) connection.refresh(project));
ConnectionsRegistrySingleton.getInstance().fireConnectionChanged(connection, ConnectionProperties.PROPERTY_PROJECTS, projects, Collections.unmodifiableList(newProjects));
return this.project = project;
}
Aggregations