Search in sources :

Example 6 with OpenShiftExplorerLabelProvider

use of org.jboss.tools.openshift.internal.ui.explorer.OpenShiftExplorerLabelProvider in project jbosstools-openshift by jbosstools.

the class ProjectTreeSorterTest method testProjectsWithLabelProvider.

@Test
public void testProjectsWithLabelProvider() {
    final ViewerComparator comparator = new ProjectViewerComparator(new OpenShiftExplorerLabelProvider());
    IProject p1 = mockProject("default", "z");
    IProject p2 = mockProject("openshift", "y");
    IProject p3 = mockProject("a", "c");
    IProject p4 = mockProject("b2", null);
    IProject p5 = mockProject("d", "b");
    IProject[] projects = new IProject[] { p3, p5, p2, p1, p4 };
    Arrays.sort(projects, new Comparator<IProject>() {

        @Override
        public int compare(IProject o1, IProject o2) {
            return comparator.compare(null, o1, o2);
        }
    });
    assertEquals(p1, projects[0]);
    assertEquals(p2, projects[1]);
    assertEquals(p5, projects[2]);
    assertEquals(p4, projects[3]);
    assertEquals(p3, projects[4]);
}
Also used : ProjectViewerComparator(org.jboss.tools.openshift.internal.ui.comparators.ProjectViewerComparator) ViewerComparator(org.eclipse.jface.viewers.ViewerComparator) OpenShiftExplorerLabelProvider(org.jboss.tools.openshift.internal.ui.explorer.OpenShiftExplorerLabelProvider) ProjectViewerComparator(org.jboss.tools.openshift.internal.ui.comparators.ProjectViewerComparator) IProject(com.openshift.restclient.model.IProject) Test(org.junit.Test)

Example 7 with OpenShiftExplorerLabelProvider

use of org.jboss.tools.openshift.internal.ui.explorer.OpenShiftExplorerLabelProvider in project jbosstools-openshift by jbosstools.

the class OpenShiftExplorerLabelProviderTest method setup.

@Before
public void setup() throws MalformedURLException {
    when(client.getBaseURL()).thenReturn(new URL("https://localhost:8443"));
    provider = new OpenShiftExplorerLabelProvider();
}
Also used : OpenShiftExplorerLabelProvider(org.jboss.tools.openshift.internal.ui.explorer.OpenShiftExplorerLabelProvider) URL(java.net.URL) Before(org.junit.Before)

Aggregations

OpenShiftExplorerLabelProvider (org.jboss.tools.openshift.internal.ui.explorer.OpenShiftExplorerLabelProvider)7 ProjectViewerComparator (org.jboss.tools.openshift.internal.ui.comparators.ProjectViewerComparator)5 IProject (com.openshift.restclient.model.IProject)3 Test (org.junit.Test)3 Binding (org.eclipse.core.databinding.Binding)2 IObservableValue (org.eclipse.core.databinding.observable.value.IObservableValue)2 ObservableListContentProvider (org.eclipse.jface.databinding.viewers.ObservableListContentProvider)2 ComboViewer (org.eclipse.jface.viewers.ComboViewer)2 StructuredViewer (org.eclipse.jface.viewers.StructuredViewer)2 ViewerComparator (org.eclipse.jface.viewers.ViewerComparator)2 Button (org.eclipse.swt.widgets.Button)2 Label (org.eclipse.swt.widgets.Label)2 RequiredControlDecorationUpdater (org.jboss.tools.openshift.internal.common.ui.databinding.RequiredControlDecorationUpdater)2 ObservableTreeItem (org.jboss.tools.openshift.internal.ui.treeitem.ObservableTreeItem)2 ObservableTreeItem2ModelConverter (org.jboss.tools.openshift.internal.ui.treeitem.ObservableTreeItem2ModelConverter)2 URL (java.net.URL)1 IListProperty (org.eclipse.core.databinding.property.list.IListProperty)1 MultiListProperty (org.eclipse.core.databinding.property.list.MultiListProperty)1 IValidator (org.eclipse.core.databinding.validation.IValidator)1 ObservableListTreeContentProvider (org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider)1