Search in sources :

Example 6 with IOpenShiftConnection

use of org.jboss.tools.openshift.core.connection.IOpenShiftConnection in project jbosstools-openshift by jbosstools.

the class ConnectionWrapper method refresh.

void refresh(ProjectWrapper projectWrapper) {
    resourceCache.flush(projectWrapper.getWrapped().getNamespaceName());
    IProject project = projectWrapper.getWrapped();
    IOpenShiftConnection connection = projectWrapper.getParent().getWrapped();
    WatchManager.getInstance().stopWatch(project, connection);
    WatchManager.getInstance().startWatch(project, connection);
    Collection<IResource> resources = new HashSet<>();
    for (String kind : RESOURCE_KINDS) {
        resources.addAll(getWrapped().getResources(kind, project.getNamespaceName()));
    }
    resources.forEach(r -> resourceCache.add(r));
    projectWrapper.updateWithResources(resources);
}
Also used : IOpenShiftConnection(org.jboss.tools.openshift.core.connection.IOpenShiftConnection) IProject(com.openshift.restclient.model.IProject) IResource(com.openshift.restclient.model.IResource) HashSet(java.util.HashSet)

Example 7 with IOpenShiftConnection

use of org.jboss.tools.openshift.core.connection.IOpenShiftConnection in project jbosstools-openshift by jbosstools.

the class RefreshTest method setUp.

@Before
public void setUp() {
    registry = new ConnectionsRegistry();
    model = new OpenshiftUIModelTestable(registry);
    listener = mock(IElementListener.class);
    model.addListener(listener);
    IOpenShiftConnection connection = mock(IOpenShiftConnection.class);
    registry.add(connection);
}
Also used : ConnectionsRegistry(org.jboss.tools.openshift.common.core.connection.ConnectionsRegistry) IElementListener(org.jboss.tools.openshift.internal.ui.models.IElementListener) IOpenShiftConnection(org.jboss.tools.openshift.core.connection.IOpenShiftConnection) Before(org.junit.Before)

Aggregations

IOpenShiftConnection (org.jboss.tools.openshift.core.connection.IOpenShiftConnection)7 IProject (com.openshift.restclient.model.IProject)3 IResource (com.openshift.restclient.model.IResource)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Before (org.junit.Before)2 ResourceKind (com.openshift.restclient.ResourceKind)1 IBuildConfig (com.openshift.restclient.model.IBuildConfig)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 Status (org.eclipse.core.runtime.Status)1 Job (org.eclipse.core.runtime.jobs.Job)1 NLS (org.eclipse.osgi.util.NLS)1