use of com.openshift.restclient.model.IProject in project jbosstools-openshift by jbosstools.
the class EditDefaultRouteHandler method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final Shell shell = HandlerUtil.getActiveShell(event);
ISelection currentSelection = UIUtils.getCurrentSelection(event);
IServiceWrapper service = UIUtils.getFirstElement(currentSelection, IServiceWrapper.class);
if (service != null) {
new RouteOpenerJob(service.getWrapped().getNamespaceName(), shell) {
@Override
protected IStatus run(IProgressMonitor monitor) {
this.routes = service.getResourcesOfKind(ResourceKind.ROUTE).stream().map(r -> (IRoute) r.getWrapped()).collect(Collectors.toList());
return Status.OK_STATUS;
}
}.schedule();
return Status.OK_STATUS;
}
final IProject project = UIUtils.getFirstElement(currentSelection, IProject.class);
if (project != null) {
new RouteOpenerJob(project.getName(), shell) {
@Override
protected IStatus run(IProgressMonitor monitor) {
this.routes = project.getResources(ResourceKind.ROUTE);
return Status.OK_STATUS;
}
}.schedule();
return Status.OK_STATUS;
}
return Status.OK_STATUS;
}
use of com.openshift.restclient.model.IProject in project jbosstools-openshift by jbosstools.
the class ServerSettingsWizardPageModel method getDeployProject.
protected org.eclipse.core.resources.IProject getDeployProject(IResource resource) {
// TODO: JBIDE-23490 check if association can be done for non service resources
if (resource == null) {
return null;
}
IProject openShiftProject = getOpenShiftProject(resource);
List<IBuildConfig> buildConfigs = getBuildConfigs(openShiftProject);
IBuildConfig buildConfig = ResourceUtils.getBuildConfigFor(resource, buildConfigs);
return ResourceUtils.getWorkspaceProjectFor(buildConfig, getProjects());
}
use of com.openshift.restclient.model.IProject in project jbosstools-openshift by jbosstools.
the class ManageProjectsWizardPage method createTable.
protected TableViewer createTable(Composite tableContainer) {
Table table = new Table(tableContainer, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
table.setLinesVisible(true);
table.setHeaderVisible(true);
ICellToolTipProvider<IProject> cellToolTipProvider = new ICellToolTipProvider<IProject>() {
@Override
public String getToolTipText(IProject object) {
return object.getDescription();
}
@Override
public int getToolTipDisplayDelayTime(IProject object) {
return 0;
}
};
this.viewer = new TableViewerBuilder(table, tableContainer).contentProvider(new ArrayContentProvider()).column(new IColumnLabelProvider<IProject>() {
@Override
public String getValue(IProject project) {
return project.getName();
}
}).cellToolTipProvider(cellToolTipProvider).name("Name").align(SWT.LEFT).weight(1).minWidth(75).buildColumn().column(new IColumnLabelProvider<IProject>() {
@Override
public String getValue(IProject project) {
return project.getDisplayName();
}
}).cellToolTipProvider(cellToolTipProvider).name("Display Name").align(SWT.LEFT).weight(2).minWidth(100).buildColumn().buildViewer();
return viewer;
}
use of com.openshift.restclient.model.IProject 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;
}
use of com.openshift.restclient.model.IProject in project jbosstools-openshift by jbosstools.
the class NewResourceWizard method init.
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
Connection connection = UIUtils.getFirstElement(selection, Connection.class);
if (connection == null) {
IProject project = UIUtils.getFirstElement(selection, IProject.class);
if (project != null) {
model.setConnection(ConnectionsRegistryUtil.getConnectionFor(project));
model.setProject(project);
}
} else {
model.setConnection(connection);
}
}
Aggregations